summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/animation/backend/animationutils.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp
index 01484476d..29de69df6 100644
--- a/src/animation/backend/animationutils.cpp
+++ b/src/animation/backend/animationutils.cpp
@@ -253,10 +253,9 @@ ClipResults evaluateClipAtLocalTime(AnimationClip *clip, float localTime)
}
} else {
// There's only one keyframe. We cant compute omega. Interpolate per component
- const int lowerKeyframeBound = channel.channelComponents[0].fcurve.lowerKeyframeBound(localTime);
- if (lowerKeyframeBound + 1 >= channel.channelComponents[0].fcurve.keyframeCount()) {
+ if (channel.channelComponents[0].fcurve.keyframeCount() == 1) {
for (const auto &channelComponent : qAsConst(channel.channelComponents))
- channelResults[i++] = channelComponent.fcurve.evaluateAtTime(localTime, lowerKeyframeBound);
+ channelResults[i++] = channelComponent.fcurve.keyframe(0).value;
} else {
auto quaternionFromChannel = [channel](const int keyframe) {
const float w = channel.channelComponents[0].fcurve.keyframe(keyframe).value;
@@ -268,6 +267,7 @@ ClipResults evaluateClipAtLocalTime(AnimationClip *clip, float localTime)
return quat;
};
+ const int lowerKeyframeBound = channel.channelComponents[0].fcurve.lowerKeyframeBound(localTime);
const auto lowerQuat = quaternionFromChannel(lowerKeyframeBound);
const auto higherQuat = quaternionFromChannel(lowerKeyframeBound + 1);
const float omega = std::acos(qBound(-1.0f, QQuaternion::dotProduct(lowerQuat, higherQuat), 1.0f));