diff options
author | Christian Strømme <christian.stromme@qt.io> | 2018-04-20 15:30:43 +0200 |
---|---|---|
committer | Andy Nichols <andy.nichols@qt.io> | 2018-04-23 07:36:27 +0000 |
commit | 327d52dd96b981829df62043f2525eba987c84e9 (patch) | |
tree | 5c111524fe0e8a0a053931a9157ef97cb379c8f6 | |
parent | 4a067500e839a3558dfd3786e943afa69433a0a1 (diff) |
Force update of the animators running state on restart
When the animators are restarted, e.g., when looping, we can't assume
that the frontend node has its running value updated, so we force update
the value. This fixes the issue where some animators would just randomly
stop.
Change-Id: I448b7ebd75d6794a94c6e3c72bc12cfd71f9e176
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r-- | src/runtime/q3dsslideplayer.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/runtime/q3dsslideplayer.cpp b/src/runtime/q3dsslideplayer.cpp index 33f068a..6e74dce 100644 --- a/src/runtime/q3dsslideplayer.cpp +++ b/src/runtime/q3dsslideplayer.cpp @@ -145,8 +145,11 @@ static void updateAnimators(Q3DSSlide *slide, bool running, bool restart, float if (restart) { // NOTE!!!: This is a bit funky, but it means we can avoid tracking the normalized values in the // frontend node. This of course assumes that the limit in the fuzzy compare doesn't change! - const float nt = qFuzzyCompare(animator->normalizedTime(), 0.0f) ? (0.0f + (1.f / 100000.f)) : 0.0f; - animator->setNormalizedTime(nt); + animator->setNormalizedTime(qFuzzyCompare(animator->normalizedTime(), 0.0f) ? (0.0f + (1.0f / 100000.0f)) : 0.0f); + // NOTE: The running value might not have been updated in the frontend node yet, + // so force update this one as well! + if (animator->isRunning()) + animator->setRunning(false); } animator->clock()->setPlaybackRate(double(rate)); animator->setRunning(running); |