From 1fc6a3a5aaf1f7d6b258d4fc7fee8a30562ba59f Mon Sep 17 00:00:00 2001 From: Tony Leinonen Date: Thu, 24 Sep 2020 15:02:04 +0300 Subject: Fix incorrect data input behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ää --- src/runtime/Qt3DSComponentManager.cpp | 5 ++++- src/runtime/Qt3DSElementSystem.h | 10 ++++++++++ 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(time * 1000); -- cgit v1.2.3