diff options
-rw-r--r-- | src/animation/backend/animationclip.cpp | 11 |
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() |