summaryrefslogtreecommitdiffstats
path: root/src/runtime/q3dsanimationmanager.cpp
diff options
context:
space:
mode:
authorAdam Treat <adam.treat@qt.io>2018-02-28 11:24:15 -0500
committerAdam Treat <adam.treat@qt.io>2018-03-12 15:54:25 +0000
commit74decc131495b4525bdec181474e59e2febc62ec (patch)
tree68a667a49eff44c177b4f6205e1098ba006dce22 /src/runtime/q3dsanimationmanager.cpp
parent4a73e6f29e0a01476ffde5ed5682c70c5e466927 (diff)
Update node visibility based on starttime/endtime
Honor all items starttimes on initializing a slide to be shown Honor the starttime/endtime for components and refactor/consolidate code Refactors SlidePlayer so that the setSlideTime method can replace the updateSlideVisibility method. Consolidates the two methods for taking care to mark a slide and its children as visible/hidden. In addition, the patch honors the starttime/endtime properities for components. In order to do this it was necessary to change the SliderPlayer time API (seek, position, duration) to use milliseconds instead of a normalized range from 0 - 1. I've also fixed bugs with positionChanged signal so that it consistently emits only after the animation engine has registered the change and only when the position has actually changed. This required a small change to SlideExplorerWidget as well. Fixes slideplayer test to take into account changes to (seek, position, duration) indicated above and fixes a bug in the slideChanged signal that was not being captured before. Finally, I've added tests for component starttime/endtime visibility. Task-number: QT3DS-123 Change-Id: Iebc8c0a6365d6551aec70f76aacffd7c00cd8ac4 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/runtime/q3dsanimationmanager.cpp')
-rw-r--r--src/runtime/q3dsanimationmanager.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/runtime/q3dsanimationmanager.cpp b/src/runtime/q3dsanimationmanager.cpp
index 1324864..d61a608 100644
--- a/src/runtime/q3dsanimationmanager.cpp
+++ b/src/runtime/q3dsanimationmanager.cpp
@@ -483,7 +483,18 @@ void Q3DSAnimationManager::updateAnimationHelper(const AnimationTrackListMap<T *
class DummyCallback : public Qt3DAnimation::QAnimationCallback
{
public:
- void valueChanged(const QVariant &value) override { Q_UNUSED(value); }
+ DummyCallback(Q3DSSlide *slide, Q3DSSlidePlayer* slidePlayer)
+ : m_slide(slide), m_slidePlayer(slidePlayer) {}
+
+ void valueChanged(const QVariant &value) override {
+ Q_ASSERT(m_slide);
+ Q_ASSERT(m_slidePlayer);
+ m_slidePlayer->setSlideTime(m_slide, value.toFloat() * 1000.0f);
+ }
+
+private:
+ Q3DSSlide *m_slide;
+ Q3DSSlidePlayer *m_slidePlayer;
};
void Q3DSAnimationManager::clearAnimations(Q3DSSlide *slide)
@@ -564,7 +575,7 @@ void Q3DSAnimationManager::clearAnimations(Q3DSSlide *slide)
}
// Dummy animator for keeping track of the time line for the current slide
-static void buildClipAnimator(Q3DSSlide *slide)
+void Q3DSAnimationManager::buildClipAnimator(Q3DSSlide *slide)
{
using namespace Qt3DAnimation;
@@ -586,7 +597,7 @@ static void buildClipAnimator(Q3DSSlide *slide)
QChannelMapper *mapper = new QChannelMapper;
QCallbackMapping *mapping = new QCallbackMapping;
mapping->setChannelName(channelName);
- mapping->setCallback(QMetaType::Float, new DummyCallback, 0);
+ mapping->setCallback(QMetaType::Float, new DummyCallback(slide, m_slidePlayer));
mapper->addMapping(mapping);
animator->setChannelMapper(mapper);
// TODO: We could just use this to get the time values directly...