diff options
author | Tony Leinonen <tony.leinonen@qt.io> | 2020-09-24 15:02:04 +0300 |
---|---|---|
committer | Tony Leinonen <tony.leinonen@qt.io> | 2020-09-28 13:18:37 +0300 |
commit | 1fc6a3a5aaf1f7d6b258d4fc7fee8a30562ba59f (patch) | |
tree | 2cfdf4fa3d243dcff90b40c9987536efd80b8dcc | |
parent | 188cfb0ad684f21f90ca11cdba1845c4fa97353a (diff) |
Fix incorrect data input behavior
When attempting to change time check if the parent becomes active.
If an object is inside a group or is a child object the parent is
the one which becomes active.
Remove the first activity check. This is already being checked once after.
Checking too early doesnt allow moving objects and changing slide in the
same frame.
Task-number: QT3DS-4166
Change-Id: I5f64828605c11756e61026ffc60a3b73b3a1f197
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r-- | src/runtime/Qt3DSComponentManager.cpp | 5 | ||||
-rw-r--r-- | src/runtime/Qt3DSElementSystem.h | 10 | ||||
-rw-r--r-- | src/runtime/Qt3DSQmlEngine.cpp | 3 |
3 files changed, 15 insertions, 3 deletions
diff --git a/src/runtime/Qt3DSComponentManager.cpp b/src/runtime/Qt3DSComponentManager.cpp index ff301da..5eaf52a 100644 --- a/src/runtime/Qt3DSComponentManager.cpp +++ b/src/runtime/Qt3DSComponentManager.cpp @@ -377,11 +377,14 @@ void CComponentManager::GoToTime(TElement *inComponent, const TTimeUnit inTime) { if (inComponent == NULL) return; - if (!inComponent->GetActive() && !inComponent->AboutToActivate()) { + + if (!inComponent->GetActive() && !inComponent->AboutToActivate() + && !inComponent->IsAnyParentAboutToActivate()) { qCCritical(qt3ds::INVALID_OPERATION) << "Runtime: Attempt to goto time on inactive component!"; return; } + SetupComponentGotoTimeCommand(inComponent, inTime); m_Presentation.GetActivityZone()->GoToTime(*inComponent, inTime); inComponent->SetDirty(); diff --git a/src/runtime/Qt3DSElementSystem.h b/src/runtime/Qt3DSElementSystem.h index eeafb5d..f2430ed 100644 --- a/src/runtime/Qt3DSElementSystem.h +++ b/src/runtime/Qt3DSElementSystem.h @@ -467,6 +467,16 @@ namespace runtime { return IsExplicitActive(); } + bool IsAnyParentAboutToActivate() + { + SElement *parent = GetParent(); + bool isActivating = parent->AboutToActivate(); + if (Depth() > 2 && !isActivating) + isActivating = parent->IsAnyParentAboutToActivate(); + + return isActivating; + } + void SetPickEnabled(bool inValue) { SetFlag(Q3DStudio::ELEMENTFLAG_PICKENABLED, inValue); diff --git a/src/runtime/Qt3DSQmlEngine.cpp b/src/runtime/Qt3DSQmlEngine.cpp index d5808ed..1f481b4 100644 --- a/src/runtime/Qt3DSQmlEngine.cpp +++ b/src/runtime/Qt3DSQmlEngine.cpp @@ -1987,10 +1987,9 @@ bool CQmlEngineImpl::GetSlideInfo(const char *element, int ¤tIndex, int &p void CQmlEngineImpl::GotoTime(const char *component, const Q3DStudio::FLOAT time) { TElement *theTarget = getTarget(component); - if (theTarget && (theTarget->GetActive() || theTarget->AboutToActivate())) { + if (theTarget) { UVariant theArg1; UVariant theArg2; - IPresentation *thePresentation = theTarget->GetBelongedPresentation(); theArg1.m_INT32 = static_cast<INT32>(time * 1000); |