diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-03-16 13:26:41 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2017-03-25 08:07:15 +0000 |
commit | c7d15b7c5e044f40167f4a79be8bf4f569c6b8be (patch) | |
tree | 6379fbcb58408b2b7657081d3545a320148f966b /src/animation/backend/lerpclipblend.cpp | |
parent | b2a274103eff2a684f0aa91c7f18ee8b358d6dd1 (diff) |
Add function to recursively calculate duration of a blend tree
The resulting duration is independent of which animators the blend
tree is associated with so this can be implemented as a simple set
of virtual functions in the concrete classes.
The value node simply returns the duration of the contained clip; the
additive node returns the duration of the base node; and the lerp node
lerps the durations of the start and end nodes.
Change-Id: Ib6edea3fa495885493fa72d44437fea5a8c5a446
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/animation/backend/lerpclipblend.cpp')
-rw-r--r-- | src/animation/backend/lerpclipblend.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/animation/backend/lerpclipblend.cpp b/src/animation/backend/lerpclipblend.cpp index 7e10a5174..7b1efbf50 100644 --- a/src/animation/backend/lerpclipblend.cpp +++ b/src/animation/backend/lerpclipblend.cpp @@ -85,6 +85,17 @@ void LerpClipBlend::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr m_blendFactor = cloneData.blendFactor; } +double LerpClipBlend::duration() const +{ + ClipBlendNode *startNode = clipBlendNodeManager()->lookupNode(m_startClipId); + const double startNodeDuration = startNode ? startNode->duration() : 0.0; + + ClipBlendNode *endNode = clipBlendNodeManager()->lookupNode(m_endClipId); + const double endNodeDuration = endNode ? endNode->duration() : 0.0; + + return blend(startNodeDuration, endNodeDuration); +} + } // Animation } // Qt3DAnimation |