diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-10-08 11:34:21 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2018-01-22 09:45:19 +0000 |
commit | e335ab9fbcb45840857a2abd107853947fedc178 (patch) | |
tree | f6fbf5b2ac59175602088a1df5e7ae335be9e2b6 /src/animation | |
parent | ea12f3be4b6b4e5d117bad6d5446ca8517905c0b (diff) |
Add function to apply channel defaults and call it
Change-Id: If3c9515565acf2b1b2b361e07f9abb884c13dcb5
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/animation')
-rw-r--r-- | src/animation/backend/animationutils.cpp | 7 | ||||
-rw-r--r-- | src/animation/backend/animationutils_p.h | 4 | ||||
-rw-r--r-- | src/animation/backend/evaluateblendclipanimatorjob.cpp | 1 |
3 files changed, 12 insertions, 0 deletions
diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp index 8652c7df1..44bf31854 100644 --- a/src/animation/backend/animationutils.cpp +++ b/src/animation/backend/animationutils.cpp @@ -848,6 +848,13 @@ QVector<float> defaultValueForChannel(Handler *handler, return result; } +void applyComponentDefaultValues(const QVector<ComponentValue> &componentDefaults, + ClipResults &formattedClipResults) +{ + for (const auto &componentDefault : componentDefaults) + formattedClipResults[componentDefault.componentIndex] = componentDefault.value; +} + } // Animation } // Qt3DAnimation diff --git a/src/animation/backend/animationutils_p.h b/src/animation/backend/animationutils_p.h index 8946eb755..a0ab218d4 100644 --- a/src/animation/backend/animationutils_p.h +++ b/src/animation/backend/animationutils_p.h @@ -346,6 +346,10 @@ ClipResults evaluateBlendTree(Handler *handler, Q_AUTOTEST_EXPORT QVector<float> defaultValueForChannel(Handler *handler, const ChannelNameAndType &channelDescription); +Q_AUTOTEST_EXPORT +void applyComponentDefaultValues(const QVector<ComponentValue> &componentDefaults, + ClipResults &formattedClipResults); + } // Animation } // Qt3DAnimation diff --git a/src/animation/backend/evaluateblendclipanimatorjob.cpp b/src/animation/backend/evaluateblendclipanimatorjob.cpp index 5382b9c92..d01cf3bdd 100644 --- a/src/animation/backend/evaluateblendclipanimatorjob.cpp +++ b/src/animation/backend/evaluateblendclipanimatorjob.cpp @@ -105,6 +105,7 @@ void EvaluateBlendClipAnimatorJob::run() // Reformat the clip results into the layout used by this animator/blend tree const ClipFormat format = valueNode->clipFormat(blendedClipAnimator->peerId()); ClipResults formattedClipResults = formatClipResults(rawClipResults, format.sourceClipIndices); + applyComponentDefaultValues(format.defaultComponentValues, formattedClipResults); valueNode->setClipResults(blendedClipAnimator->peerId(), formattedClipResults); } |