summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Leinonen <tony.leinonen@qt.io>2021-03-16 13:57:14 +0200
committerTony Leinonen <tony.leinonen@qt.io>2021-03-19 14:42:31 +0000
commite9da995ae5de6ca37e624adcba23808cd7a0ff57 (patch)
tree0da3fe36a444544f08db2b7174c8c49730c322cd
parent6f304112998fd27a938469087c8459ba093fc9dc (diff)
Calculate newTime when commands are being processed
newTime was calculated too early and the object did not have time to switch slides and have correct information. Calculating newTime at a later stage when the object has had time to switch slides. Task-number: QT3DS-4221 Change-Id: If04a29278c6d97e550ecb7f2e5975d02abcd01d4 Reviewed-by: Antti Määttä <antti.maatta@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/runtime/Qt3DSComponentManager.cpp12
-rw-r--r--src/runtime/Qt3DSQmlEngine.cpp10
2 files changed, 12 insertions, 10 deletions
diff --git a/src/runtime/Qt3DSComponentManager.cpp b/src/runtime/Qt3DSComponentManager.cpp
index 38eeeac..03c7b2c 100644
--- a/src/runtime/Qt3DSComponentManager.cpp
+++ b/src/runtime/Qt3DSComponentManager.cpp
@@ -388,9 +388,17 @@ void CComponentManager::GoToTime(TElement *inComponent, const TTimeUnit inTime)
return;
}
- SetupComponentGotoTimeCommand(inComponent, inTime);
- m_Presentation.GetActivityZone()->GoToTime(*inComponent, inTime);
+ TTimeUnit endTime = 0;
+ TComponent *component = static_cast<TComponent *>(inComponent);
+ endTime = component->GetTimePolicy().GetLoopingDuration();
+
+ // Normalize the value to dataInput range
+ qreal newTime = qreal(endTime) * (qreal(inTime) / 1000.0);
+
+ SetupComponentGotoTimeCommand(inComponent, newTime);
+ m_Presentation.GetActivityZone()->GoToTime(*inComponent, newTime);
inComponent->SetDirty();
+
}
//==============================================================================
diff --git a/src/runtime/Qt3DSQmlEngine.cpp b/src/runtime/Qt3DSQmlEngine.cpp
index 2c44b7d..0988880 100644
--- a/src/runtime/Qt3DSQmlEngine.cpp
+++ b/src/runtime/Qt3DSQmlEngine.cpp
@@ -794,15 +794,9 @@ void CQmlEngineImpl::SetDataInputValue(
case ATTRIBUTETYPE_DATAINPUT_TIMELINE: {
// Quietly ignore other than number type data inputs when adjusting timeline
if (diDef.type == qt3ds::runtime::DataInOutTypeRangedNumber) {
- TTimeUnit endTime = 0;
- TElement *element = getTarget(ctrlElem.elementPath.constData());
- TComponent *component = static_cast<TComponent *>(element);
- endTime = component->GetTimePolicy().GetLoopingDuration();
-
- // Normalize the value to dataInput range
- qreal newTime = qreal(endTime) * (qreal(value.toFloat() - diDef.min)
+ qreal newTime = (qreal(value.toFloat() - diDef.min)
/ qreal(diDef.max - diDef.min));
- GotoTime(ctrlElem.elementPath.constData(), float(newTime / 1000.0));
+ GotoTime(ctrlElem.elementPath.constData(), float(newTime));
}
break;
}