summaryrefslogtreecommitdiffstats
path: root/src/animation
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-05-26 22:21:21 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-05-26 22:21:22 +0200
commitfbe631c046a2246db46d0687d1c771d7d63a74e0 (patch)
tree9c66a72ab438b8df4cd2edd73d1d2864b4c07bce /src/animation
parent829675b65b8a9d661828b18bbd2703744d4c3db7 (diff)
parent08b40b9be75242505a773dc5b2a96a5ef481d6e6 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'src/animation')
-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));