diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2017-01-27 17:16:45 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-01-29 09:39:51 +0000 |
commit | 181d5e5ef4314833e23518aa1addf7e44eed6429 (patch) | |
tree | 7eb8ddf29e6e239c79dd0871d582f563398bef1c /src/animation/backend/blendedclipanimator.cpp | |
parent | a6e1ac3f584eb08cecfb154ac7d96dee6beaf44d (diff) |
Completed BlenderAnimator frontend and backend
Change-Id: I5d463467811afe6245b278a1b277ec20159d3440
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/animation/backend/blendedclipanimator.cpp')
-rw-r--r-- | src/animation/backend/blendedclipanimator.cpp | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/src/animation/backend/blendedclipanimator.cpp b/src/animation/backend/blendedclipanimator.cpp index 63278dbb6..6862de74f 100644 --- a/src/animation/backend/blendedclipanimator.cpp +++ b/src/animation/backend/blendedclipanimator.cpp @@ -46,32 +46,70 @@ namespace Animation { BlendedClipAnimator::BlendedClipAnimator() : BackendNode(ReadOnly) + , m_running(false) { } void BlendedClipAnimator::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) { const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QBlendedClipAnimatorData>>(change); - const auto &data = typedChange->data; + const QBlendedClipAnimatorData &data = typedChange->data; + m_blendTreeRootId = data.blendTreeRootId; + m_mapperId = data.mapperId; + m_running = data.running; + setDirty(Handler::ClipAnimatorDirty); } void BlendedClipAnimator::cleanup() { setEnabled(false); m_handler = nullptr; + m_blendTreeRootId = Qt3DCore::QNodeId(); + m_mapperId = Qt3DCore::QNodeId(); + m_running = false; +} + +void BlendedClipAnimator::setBlendTreeRootId(Qt3DCore::QNodeId blendTreeId) +{ + m_blendTreeRootId = blendTreeId; + setDirty(Handler::ClipAnimatorDirty); +} + +void BlendedClipAnimator::setMapperId(Qt3DCore::QNodeId mapperId) +{ + m_mapperId = mapperId; + setDirty(Handler::ClipAnimatorDirty); +} + +void BlendedClipAnimator::setRunning(bool running) +{ + m_running = running; + setDirty(Handler::ClipAnimatorDirty); +} + +Qt3DCore::QNodeId BlendedClipAnimator::blendTreeRootId() const +{ + return m_blendTreeRootId; } void BlendedClipAnimator::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) { switch (e->type()) { case Qt3DCore::PropertyUpdated: { + const auto change = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e); + if (change->propertyName() == QByteArrayLiteral("blendTree")) + setBlendTreeRootId(change->value().value<Qt3DCore::QNodeId>()); + else if (change->propertyName() == QByteArrayLiteral("channelMapper")) + setMapperId(change->value().value<Qt3DCore::QNodeId>()); + else if (change->propertyName() == QByteArrayLiteral("running")) + setRunning(change->value().toBool()); break; } default: break; } - QBackendNode::sceneChangeEvent(e); + BackendNode::sceneChangeEvent(e); } } // namespace Animation |