summaryrefslogtreecommitdiffstats
path: root/src/animation/frontend/qclipanimator.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-06-15 15:17:04 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-06-23 10:05:22 +0000
commit6f40494310dab964600375f04391f21b4eccdb44 (patch)
treea2dc6542a70672c3bf901a36723cff35089b6b11 /src/animation/frontend/qclipanimator.cpp
parent11f092ce7c555814baeffc204f7fadc0f36fdcbb (diff)
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 <sean.harmer@kdab.com>
Diffstat (limited to 'src/animation/frontend/qclipanimator.cpp')
-rw-r--r--src/animation/frontend/qclipanimator.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/animation/frontend/qclipanimator.cpp b/src/animation/frontend/qclipanimator.cpp
index eb6c80aee..da6534d16 100644
--- a/src/animation/frontend/qclipanimator.cpp
+++ b/src/animation/frontend/qclipanimator.cpp
@@ -41,6 +41,7 @@
#include "qclipanimator_p.h"
#include <Qt3DAnimation/qabstractanimationclip.h>
#include <Qt3DAnimation/qchannelmapper.h>
+#include <Qt3DAnimation/private/qanimationcallbacktrigger_p.h>
QT_BEGIN_NAMESPACE
@@ -165,6 +166,16 @@ Qt3DCore::QNodeCreatedChangeBasePtr QClipAnimator::createNodeCreationChange() co
return creationChange;
}
+/*! \internal */
+void QClipAnimator::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
+{
+ if (change->type() == Qt3DCore::CallbackTriggered) {
+ QAnimationCallbackTriggerPtr callbackTrigger = qSharedPointerCast<Qt3DAnimation::QAnimationCallbackTrigger>(change);
+ if (callbackTrigger->callback())
+ callbackTrigger->callback()->valueChanged(callbackTrigger->value());
+ }
+}
+
} // namespace Qt3DAnimation
QT_END_NAMESPACE