summaryrefslogtreecommitdiffstats
path: root/src/animation
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2019-09-20 07:59:48 +0100
committerMike Krus <mike.krus@kdab.com>2019-09-20 11:10:16 +0100
commit6d65beef4118e896980ba881e270e5da50a1299a (patch)
tree8c2ccbbfa0ad99c86a0c138f695806287d18c225 /src/animation
parentd17f9ebe8db0ee7e365535523739f6cc5f36fdce (diff)
Update QClipBlendValue to use direct sync
Change-Id: I14add80f1519ec3047f7e5e925136230dec6874b Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/animation')
-rw-r--r--src/animation/backend/clipblendvalue.cpp20
-rw-r--r--src/animation/backend/clipblendvalue_p.h4
-rw-r--r--src/animation/frontend/qanimationaspect.cpp2
3 files changed, 8 insertions, 18 deletions
diff --git a/src/animation/backend/clipblendvalue.cpp b/src/animation/backend/clipblendvalue.cpp
index 5685d5191..e1586953b 100644
--- a/src/animation/backend/clipblendvalue.cpp
+++ b/src/animation/backend/clipblendvalue.cpp
@@ -54,22 +54,14 @@ ClipBlendValue::~ClipBlendValue()
{
}
-void ClipBlendValue::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+void ClipBlendValue::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime)
{
- ClipBlendNode::initializeFromPeer(change);
- const auto creationChange
- = qSharedPointerCast<QClipBlendNodeCreatedChange<QClipBlendValueData>>(change);
- const Qt3DAnimation::QClipBlendValueData data = creationChange->data;
- m_clipId = data.clipId;
-}
+ BackendNode::syncFromFrontEnd(frontEnd, firstTime);
+ const QClipBlendValue *node = qobject_cast<const QClipBlendValue *>(frontEnd);
+ if (!node)
+ return;
-void ClipBlendValue::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- if (e->type() == Qt3DCore::PropertyUpdated) {
- Qt3DCore::QPropertyUpdatedChangePtr change = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
- if (change->propertyName() == QByteArrayLiteral("clip"))
- m_clipId = change->value().value<Qt3DCore::QNodeId>();
- }
+ m_clipId = Qt3DCore::qIdForNode(node->clip());
}
ClipResults ClipBlendValue::doBlend(const QVector<ClipResults> &blendData) const
diff --git a/src/animation/backend/clipblendvalue_p.h b/src/animation/backend/clipblendvalue_p.h
index 168989a89..8a0f93d3d 100644
--- a/src/animation/backend/clipblendvalue_p.h
+++ b/src/animation/backend/clipblendvalue_p.h
@@ -64,7 +64,7 @@ public:
inline Qt3DCore::QNodeId clipId() const { return m_clipId; }
void setClipId(Qt3DCore::QNodeId clipId) { m_clipId = clipId; } // For unit tests
- void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) override;
+ void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override;
inline QVector<Qt3DCore::QNodeId> allDependencyIds() const override
{
@@ -86,8 +86,6 @@ protected:
ClipResults doBlend(const QVector<ClipResults> &blendData) const override;
private:
- void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) final;
-
Qt3DCore::QNodeId m_clipId;
QVector<Qt3DCore::QNodeId> m_animatorIds;
diff --git a/src/animation/frontend/qanimationaspect.cpp b/src/animation/frontend/qanimationaspect.cpp
index e3480ca2e..3b7946714 100644
--- a/src/animation/frontend/qanimationaspect.cpp
+++ b/src/animation/frontend/qanimationaspect.cpp
@@ -128,7 +128,7 @@ QAnimationAspect::QAnimationAspect(QAnimationAspectPrivate &dd, QObject *parent)
registerBackendType<QAdditiveClipBlend, true>(
QSharedPointer<Animation::ClipBlendNodeFunctor<Animation::AdditiveClipBlend, Animation::ClipAnimatorManager>>::create(d->m_handler.data(),
d->m_handler->clipBlendNodeManager()));
- registerBackendType<QClipBlendValue>(
+ registerBackendType<QClipBlendValue, true>(
QSharedPointer<Animation::ClipBlendNodeFunctor<Animation::ClipBlendValue, Animation::ClipAnimatorManager>>::create(d->m_handler.data(),
d->m_handler->clipBlendNodeManager()));
registerBackendType<Qt3DCore::QAbstractSkeleton, true>(