summaryrefslogtreecommitdiffstats
path: root/src/animation/backend/evaluateclipanimatorjob.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2017-01-30 12:42:56 +0100
committerPaul Lemire <paul.lemire@kdab.com>2017-01-30 16:22:16 +0000
commita019b0343258a4741c3337e50eb6991c5d5c94a5 (patch)
treef7072f09d6bbd18b3ffbe1e73306199ef6fa0385 /src/animation/backend/evaluateclipanimatorjob.cpp
parent989ce5f0e3d128c0d47a410e53ca57578a25d202 (diff)
Improve the clip evalution code
Change-Id: Id536ec0433f0f2f25c42d115fbf90b99e6d3844e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/animation/backend/evaluateclipanimatorjob.cpp')
-rw-r--r--src/animation/backend/evaluateclipanimatorjob.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/animation/backend/evaluateclipanimatorjob.cpp b/src/animation/backend/evaluateclipanimatorjob.cpp
index e547ec441..406a46dcd 100644
--- a/src/animation/backend/evaluateclipanimatorjob.cpp
+++ b/src/animation/backend/evaluateclipanimatorjob.cpp
@@ -63,25 +63,21 @@ void EvaluateClipAnimatorJob::run()
// Evaluate the fcurves
AnimationClip *clip = m_handler->animationClipManager()->lookupResource(clipAnimator->clipId());
Q_ASSERT(clip);
- bool finalFrame = false;
- int currentLoop = 0;
- const QVector<float> channelResults = AnimationUtils::evaluateAtGlobalTime(clip,
- globalTime,
- clipAnimator->startTime(),
- clipAnimator->loops(),
- currentLoop,
- finalFrame);
+ // Prepare for evaluation (convert global time to local time ....)
+ const AnimationUtils::AnimatorEvaluationData animatorEvaluationData = AnimationUtils::animatorEvaluationDataForAnimator(clipAnimator, globalTime);
+ const AnimationUtils::ClipPreEvaluationData preEvaluationDataForClip = AnimationUtils::evaluationDataForClip(clip, animatorEvaluationData);
+ const QVector<float> channelResults = AnimationUtils::evaluateClipAtLocalTime(clip, preEvaluationDataForClip.localTime);
- if (finalFrame)
+ if (preEvaluationDataForClip.isFinalFrame)
clipAnimator->setRunning(false);
- clipAnimator->setCurrentLoop(currentLoop);
+ clipAnimator->setCurrentLoop(preEvaluationDataForClip.currentLoop);
// Prepare property changes (if finalFrame it also prepares the change for the running property for the frontend)
const QVector<Qt3DCore::QSceneChangePtr> changes = AnimationUtils::preparePropertyChanges(clipAnimator->peerId(),
clipAnimator->mappingData(),
channelResults,
- finalFrame);
+ preEvaluationDataForClip.isFinalFrame);
// Send the property changes
clipAnimator->sendPropertyChanges(changes);