From 6f40494310dab964600375f04391f21b4eccdb44 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 15 Jun 2017 15:17:04 +0200 Subject: Add support for animation callbacks Let QChannelMapping optionally specify a callback, which then gets invoked either directly on a worker thread or the gui thread. Change-Id: I871776f47cc921ceb254f9dc1a7b89ae5c5618d8 Reviewed-by: Sean Harmer --- src/animation/backend/clipanimator.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/animation/backend/clipanimator.cpp') diff --git a/src/animation/backend/clipanimator.cpp b/src/animation/backend/clipanimator.cpp index 65fd0f57f..ea31698d0 100644 --- a/src/animation/backend/clipanimator.cpp +++ b/src/animation/backend/clipanimator.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -129,6 +130,21 @@ void ClipAnimator::sendPropertyChanges(const QVector notifyObservers(change); } +void ClipAnimator::sendCallbacks(const QVector &callbacks) +{ + for (const AnimationCallbackAndValue &callback : callbacks) { + if (callback.flags.testFlag(QAnimationCallback::OnThreadPool)) { + callback.callback->valueChanged(callback.value); + } else { + auto e = QAnimationCallbackTriggerPtr::create(peerId()); + e->setCallback(callback.callback); + e->setValue(callback.value); + e->setDeliveryFlags(Qt3DCore::QSceneChange::Nodes); + notifyObservers(e); + } + } +} + } // namespace Animation } // namespace Qt3DAnimation -- cgit v1.2.3