summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Harmer <sh@theharmers.co.uk>2017-08-31 15:57:12 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-09-26 10:53:08 +0000
commit3aefe68f281f1815dcb6ca73751d17b470429a0f (patch)
treeb8a4d2f874c144681b2e69c65e500a31e46c1bd0
parent72e80520d36802672eca1e93bc6c6019e6f5ffc3 (diff)
Fix gathering clip value node ids
This correctly handles the case where the blend tree consists of a single value node. Added test case to catch it. Change-Id: I8982d2081748866d163f107a4513bd2d17feb83a Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
-rw-r--r--src/animation/backend/animationutils.cpp4
-rw-r--r--src/animation/backend/clipblendvalue_p.h2
-rw-r--r--tests/auto/animation/animationutils/tst_animationutils.cpp12
-rw-r--r--tests/auto/animation/clipblendvalue/tst_clipblendvalue.cpp6
4 files changed, 19 insertions, 5 deletions
diff --git a/src/animation/backend/animationutils.cpp b/src/animation/backend/animationutils.cpp
index c12ad99f7..1583a7fd7 100644
--- a/src/animation/backend/animationutils.cpp
+++ b/src/animation/backend/animationutils.cpp
@@ -467,6 +467,10 @@ QVector<Qt3DCore::QNodeId> gatherValueNodesToEvaluate(Handler *handler,
ClipBlendNodeVisitor::VisitOnlyDependencies);
auto func = [&clipIds, nodeManager] (ClipBlendNode *blendNode) {
+ // Check if this is a value node itself
+ if (blendNode->blendType() == ClipBlendNode::ValueType)
+ clipIds.append(blendNode->peerId());
+
const auto dependencyIds = blendNode->currentDependencyIds();
for (const auto dependencyId : dependencyIds) {
// Look up the blend node and if it's a value type (clip),
diff --git a/src/animation/backend/clipblendvalue_p.h b/src/animation/backend/clipblendvalue_p.h
index 6da800f98..5ff8d2b0f 100644
--- a/src/animation/backend/clipblendvalue_p.h
+++ b/src/animation/backend/clipblendvalue_p.h
@@ -73,7 +73,7 @@ public:
inline QVector<Qt3DCore::QNodeId> currentDependencyIds() const Q_DECL_OVERRIDE
{
- return { m_clipId };
+ return {};
}
double duration() const Q_DECL_OVERRIDE;
diff --git a/tests/auto/animation/animationutils/tst_animationutils.cpp b/tests/auto/animation/animationutils/tst_animationutils.cpp
index e7a0f343d..068db7ac6 100644
--- a/tests/auto/animation/animationutils/tst_animationutils.cpp
+++ b/tests/auto/animation/animationutils/tst_animationutils.cpp
@@ -1921,6 +1921,18 @@ private Q_SLOTS:
QTest::newRow("simple lerp") << handler << lerp->peerId() << expectedIds;
}
+
+ {
+ Handler *handler = new Handler;
+
+ const auto value1 = createClipBlendValue(handler);
+ const auto clip1Id = Qt3DCore::QNodeId::createId();
+ value1->setClipId(clip1Id);
+
+ QVector<Qt3DCore::QNodeId> expectedIds = { value1->peerId() };
+
+ QTest::newRow("value only") << handler << value1->peerId() << expectedIds;
+ }
}
void checkGatherValueNodesToEvaluate()
diff --git a/tests/auto/animation/clipblendvalue/tst_clipblendvalue.cpp b/tests/auto/animation/clipblendvalue/tst_clipblendvalue.cpp
index 6fe2846b8..fcbc167ca 100644
--- a/tests/auto/animation/clipblendvalue/tst_clipblendvalue.cpp
+++ b/tests/auto/animation/clipblendvalue/tst_clipblendvalue.cpp
@@ -137,8 +137,7 @@ private Q_SLOTS:
QVector<Qt3DCore::QNodeId> actualIds = clipNode.currentDependencyIds();
// THEN
- QCOMPARE(actualIds.size(), 1);
- QCOMPARE(actualIds[0], clipId);
+ QCOMPARE(actualIds.size(), 0);
// WHEN
auto anotherClipId = Qt3DCore::QNodeId::createId();
@@ -146,8 +145,7 @@ private Q_SLOTS:
actualIds = clipNode.currentDependencyIds();
// THEN
- QCOMPARE(actualIds.size(), 1);
- QCOMPARE(actualIds[0], anotherClipId);
+ QCOMPARE(actualIds.size(), 0);
}
void checkDuration()