summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@qt.io>2018-06-04 13:53:11 +0200
committerAndy Nichols <andy.nichols@qt.io>2018-06-05 09:58:20 +0000
commit8b74ba56007613cad8be9467d47ed8f183e284f1 (patch)
treebf00712276b4815782fce9774f5a96583996d32c
parentcdffc39d0320840b64b50cbac94fcd928b30e4e4 (diff)
Differentiate goToTime called from actions
goToTime from actions has an extra property regarding the playing state after the new time is set, which is different from e.g., data inputs. Since we called into the same function in all cases, the default pause value was applied when it shouldn't, causing animations to automatically start. Change-Id: I017aa94483f72ab8f8db5a2a1b3232bb2d794827 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r--src/runtime/q3dsscenemanager.cpp15
-rw-r--r--src/runtime/q3dsscenemanager_p.h3
2 files changed, 15 insertions, 3 deletions
diff --git a/src/runtime/q3dsscenemanager.cpp b/src/runtime/q3dsscenemanager.cpp
index c39f720..e970d39 100644
--- a/src/runtime/q3dsscenemanager.cpp
+++ b/src/runtime/q3dsscenemanager.cpp
@@ -7346,7 +7346,18 @@ void Q3DSSceneManager::changeSlideByDirection(Q3DSGraphObject *sceneOrComponent,
slidePlayer->reload();
}
-void Q3DSSceneManager::goToTime(Q3DSGraphObject *sceneOrComponent, float milliseconds, bool pause)
+void Q3DSSceneManager::goToTime(Q3DSGraphObject *sceneOrComponent, float milliseconds)
+{
+ Q3DSSlidePlayer *slidePlayer = m_slidePlayer;
+ if (sceneOrComponent->type() == Q3DSGraphObject::Component) {
+ slidePlayer = static_cast<Q3DSComponentNode *>(sceneOrComponent)->masterSlide()
+ ->attached<Q3DSSlideAttached>()->slidePlayer;
+ }
+
+ slidePlayer->seek(milliseconds);
+}
+
+void Q3DSSceneManager::goToTimeAction(Q3DSGraphObject *sceneOrComponent, float milliseconds, bool pause)
{
Q3DSSlidePlayer *slidePlayer = m_slidePlayer;
if (sceneOrComponent->type() == Q3DSGraphObject::Component) {
@@ -7628,7 +7639,7 @@ void Q3DSSceneManager::runAction(const Q3DSAction &action)
bool pause = false;
if (shouldPause.isValid())
Q3DS::convertToBool(&shouldPause.value, &pause);
- goToTime(action.targetObject, seekTimeMs, pause);
+ goToTimeAction(action.targetObject, seekTimeMs, pause);
}
}
break;
diff --git a/src/runtime/q3dsscenemanager_p.h b/src/runtime/q3dsscenemanager_p.h
index d563be2..4ba4d80 100644
--- a/src/runtime/q3dsscenemanager_p.h
+++ b/src/runtime/q3dsscenemanager_p.h
@@ -734,7 +734,8 @@ public:
void changeSlideByName(Q3DSGraphObject *sceneOrComponent, const QString &name);
void changeSlideByIndex(Q3DSGraphObject *sceneOrComponent, int index);
void changeSlideByDirection(Q3DSGraphObject *sceneOrComponent, bool next, bool wrap);
- void goToTime(Q3DSGraphObject *sceneOrComponent, float milliseconds, bool pause = false);
+ void goToTime(Q3DSGraphObject *sceneOrComponent, float milliseconds);
+ void goToTimeAction(Q3DSGraphObject *sceneOrComponent, float milliseconds, bool pause);
void queueEvent(const Q3DSGraphObject::Event &e);