summaryrefslogtreecommitdiffstats
path: root/src/animation
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2021-11-25 15:52:09 +0100
committerPaul Lemire <paul.lemire@kdab.com>2021-11-26 11:26:21 +0100
commit98599ddee4761cf1970a97737293f5f627f3f61a (patch)
tree912e526ce5192b4f759765a1aa43845894db6ee1 /src/animation
parent6c573dc4a5a08ab7b75ed1fbd93bd0f21c61a08a (diff)
Revert "AnimationClip: fix the way we compute the duration"
Turns out we want the global clip duration and not the relative clip duration. Therefore global clip duration is always computed from 0. If the first keyframe is offset, then this means animation does nothing until t=offset. This reverts commit 7b23cb1ca5b32fcf24f889e79cec756786f86233. Pick-to: 6.2 5.15 Change-Id: Ic045a3cdea5eac4b8e35b75737e3ae6f00b9fa20 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/animation')
-rw-r--r--src/animation/backend/animationclip.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/animation/backend/animationclip.cpp b/src/animation/backend/animationclip.cpp
index 24b41a50f..d4a1f133a 100644
--- a/src/animation/backend/animationclip.cpp
+++ b/src/animation/backend/animationclip.cpp
@@ -358,17 +358,14 @@ float AnimationClip::findDuration()
{
// Iterate over the contained fcurves and find the longest one
float tMax = 0.f;
- float tMin = 1.0f;
for (const Channel &channel : qAsConst(m_channels)) {
for (const ChannelComponent &channelComponent : qAsConst(channel.channelComponents)) {
- const float tStart = channelComponent.fcurve.startTime();
- const float tEnd = channelComponent.fcurve.endTime();
- tMax = std::max(tEnd, tMax);
- tMin = std::min(tStart, tMin);
+ const float t = channelComponent.fcurve.endTime();
+ if (t > tMax)
+ tMax = t;
}
}
- // We can't have a negative duration
- return std::max(tMax - tMin, 0.0f);
+ return tMax;
}
int AnimationClip::findChannelComponentCount()