diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2017-01-21 15:53:09 +0000 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2017-01-27 11:17:15 +0000 |
commit | 4a94e68d5975b53f11ab2ab7755f6b944fc8b614 (patch) | |
tree | 6cc7116b0e37d69a54f6f64241240001b7e17add /src/animation/backend/handler.cpp | |
parent | 50181a712f547ec93f8ba026385c99e982535a66 (diff) |
Add a job to load animation clips
Defers the actual work to AnimationClip. Also made all backend nodes
have a common base class to make it easy to track the Handler.
Added a manual test to exercise this and which we can build up
over time as we add API.
Change-Id: I7cdd8da948498544059ba51efe38642dd54ea410
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/animation/backend/handler.cpp')
-rw-r--r-- | src/animation/backend/handler.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/animation/backend/handler.cpp b/src/animation/backend/handler.cpp index bfcb22090..0da9ba4dd 100644 --- a/src/animation/backend/handler.cpp +++ b/src/animation/backend/handler.cpp @@ -36,7 +36,8 @@ #include "handler_p.h" #include <Qt3DAnimation/private/managers_p.h> - +#include <Qt3DAnimation/private/loadanimationclipjob_p.h> +#include <Qt3DAnimation/private/animationlogging_p.h> QT_BEGIN_NAMESPACE @@ -48,17 +49,40 @@ Handler::Handler() , m_clipAnimatorManager(new ClipAnimatorManager) , m_blendedClipAnimatorManager(new BlendedClipAnimatorManager) , m_conductedClipAnimatorManager(new ConductedClipAnimatorManager) + , m_loadAnimationClipJob(new LoadAnimationClipJob) { + m_loadAnimationClipJob->setHandler(this); } Handler::~Handler() { } +void Handler::setDirty(DirtyFlag flag, Qt3DCore::QNodeId nodeId) +{ + switch (flag) { + case AnimationClipDirty: { + const auto handle = m_animationClipManager->lookupHandle(nodeId); + m_dirtyAnimationClips.push_back(handle); + break; + } + } +} + QVector<Qt3DCore::QAspectJobPtr> Handler::jobsToExecute(qint64 time) { Q_UNUSED(time); QVector<Qt3DCore::QAspectJobPtr> jobs; + + // If there are any dirty animation clips that need loading, + // queue up a job for them + if (!m_dirtyAnimationClips.isEmpty()) { + qCDebug(HandlerLogic) << "Added LoadAnimationClipJob"; + m_loadAnimationClipJob->addDirtyAnimationClips(m_dirtyAnimationClips); + jobs.push_back(m_loadAnimationClipJob); + m_dirtyAnimationClips.clear(); + } + return jobs; } |