diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2017-01-29 09:13:56 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-01-29 18:56:11 +0000 |
commit | 89766b24b5f071eaf390eadce6ba635d423201e1 (patch) | |
tree | b231e02518c4dce3f4e73eafaa5e4a5a242b3e5d /src/animation/backend/blendedclipanimator.cpp | |
parent | d555d63084ac13866a78772b43b4ac6b6d9bed9b (diff) |
Build blend trees and execute them
Also added loops property to the blendedclipanimator as mandated by rebase.
Note: only handles LERP with single node for now
Change-Id: I91e071467c604279262ec04288bc7f8b2b19f4a1
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/animation/backend/blendedclipanimator.cpp')
-rw-r--r-- | src/animation/backend/blendedclipanimator.cpp | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/animation/backend/blendedclipanimator.cpp b/src/animation/backend/blendedclipanimator.cpp index 6862de74f..1cb774f72 100644 --- a/src/animation/backend/blendedclipanimator.cpp +++ b/src/animation/backend/blendedclipanimator.cpp @@ -45,8 +45,11 @@ namespace Qt3DAnimation { namespace Animation { BlendedClipAnimator::BlendedClipAnimator() - : BackendNode(ReadOnly) + : BackendNode(ReadWrite) , m_running(false) + , m_startGlobalTime(0) + , m_currentLoop(0) + , m_loops(1) { } @@ -57,7 +60,8 @@ void BlendedClipAnimator::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeB m_blendTreeRootId = data.blendTreeRootId; m_mapperId = data.mapperId; m_running = data.running; - setDirty(Handler::ClipAnimatorDirty); + m_loops = data.loops; + setDirty(Handler::BlendedClipAnimatorDirty); } void BlendedClipAnimator::cleanup() @@ -67,24 +71,39 @@ void BlendedClipAnimator::cleanup() m_blendTreeRootId = Qt3DCore::QNodeId(); m_mapperId = Qt3DCore::QNodeId(); m_running = false; + m_startGlobalTime = 0; + m_currentLoop = 0; + m_loops = 1; + m_mappingData.clear(); } void BlendedClipAnimator::setBlendTreeRootId(Qt3DCore::QNodeId blendTreeId) { m_blendTreeRootId = blendTreeId; - setDirty(Handler::ClipAnimatorDirty); + setDirty(Handler::BlendedClipAnimatorDirty); } void BlendedClipAnimator::setMapperId(Qt3DCore::QNodeId mapperId) { m_mapperId = mapperId; - setDirty(Handler::ClipAnimatorDirty); + setDirty(Handler::BlendedClipAnimatorDirty); } void BlendedClipAnimator::setRunning(bool running) { m_running = running; - setDirty(Handler::ClipAnimatorDirty); + setDirty(Handler::BlendedClipAnimatorDirty); +} + +void BlendedClipAnimator::setMappingData(const QVector<AnimationUtils::BlendingMappingData> mappingData) +{ + m_mappingData = mappingData; +} + +void BlendedClipAnimator::sendPropertyChanges(const QVector<Qt3DCore::QSceneChangePtr> &changes) +{ + for (const Qt3DCore::QSceneChangePtr &change : changes) + notifyObservers(change); } Qt3DCore::QNodeId BlendedClipAnimator::blendTreeRootId() const @@ -103,6 +122,8 @@ void BlendedClipAnimator::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) setMapperId(change->value().value<Qt3DCore::QNodeId>()); else if (change->propertyName() == QByteArrayLiteral("running")) setRunning(change->value().toBool()); + else if (change->propertyName() == QByteArrayLiteral("loops")) + m_loops = change->value().toInt(); break; } |