diff options
author | Christian Strømme <christian.stromme@qt.io> | 2018-05-14 12:17:40 +0200 |
---|---|---|
committer | Christian Stromme <christian.stromme@qt.io> | 2018-05-15 14:49:55 +0000 |
commit | f92bae2ef0e33b722317467e888e80d16bd6a92a (patch) | |
tree | 288999e2f22641621b1d04899214baace7ed9200 /src/runtime/q3dsanimationmanager.cpp | |
parent | a6778041640d1aa86e0a994353407e143c26f605 (diff) |
Always use the slideplayer associated with the slide to update the time
Components manage their own objects, so they need to know when the time
changes.
Change-Id: I4f5a6f8daa9b33fe71b74e4c18657c042d1513d7
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/runtime/q3dsanimationmanager.cpp')
-rw-r--r-- | src/runtime/q3dsanimationmanager.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/runtime/q3dsanimationmanager.cpp b/src/runtime/q3dsanimationmanager.cpp index 474a54d..79234f3 100644 --- a/src/runtime/q3dsanimationmanager.cpp +++ b/src/runtime/q3dsanimationmanager.cpp @@ -509,23 +509,22 @@ void Q3DSAnimationManager::updateAnimationHelper(const AnimationTrackListMap<T * class DummyCallback : public Qt3DAnimation::QAnimationCallback { public: - DummyCallback(Q3DSSlide *slide, Q3DSSlidePlayer* slidePlayer) - : m_slide(slide), m_slidePlayer(slidePlayer) {} + DummyCallback(Q3DSSlide *slide) + : m_slide(slide) {} void valueChanged(const QVariant &value) override { Q_ASSERT(m_slide); - Q_ASSERT(m_slidePlayer); + Q3DSSlidePlayer *slidePlayer = m_slide->attached<Q3DSSlideAttached>()->slidePlayer; // TODO: See QT3DS-1302 - if (m_slidePlayer != m_slide->attached<Q3DSSlideAttached>()->slidePlayer) + if (!slidePlayer) return; - m_slidePlayer->setSlideTime(m_slide, value.toFloat() * 1000.0f); + slidePlayer->setSlideTime(m_slide, value.toFloat() * 1000.0f); } private: Q3DSSlide *m_slide; - Q3DSSlidePlayer *m_slidePlayer; }; void Q3DSAnimationManager::clearAnimations(Q3DSSlide *slide) @@ -613,7 +612,7 @@ void Q3DSAnimationManager::buildClipAnimator(Q3DSSlide *slide) QChannelMapper *mapper = new QChannelMapper; QCallbackMapping *mapping = new QCallbackMapping; mapping->setChannelName(channelName); - mapping->setCallback(QMetaType::Float, new DummyCallback(slide, m_slidePlayer)); + mapping->setCallback(QMetaType::Float, new DummyCallback(slide)); mapper->addMapping(mapping); animator->setChannelMapper(mapper); // TODO: We could just use this to get the time values directly... |