diff options
author | Janne Kangas <janne.kangas@qt.io> | 2020-02-21 13:11:29 +0200 |
---|---|---|
committer | Janne Kangas <janne.kangas@qt.io> | 2020-02-21 14:09:18 +0200 |
commit | 3b710b63edc1f2fdafef7c86b1c998a70f6d9d7a (patch) | |
tree | 14cc37b3994377f84805efdefb720e6353aa98c9 | |
parent | 04557c6b2ae4d3b1b29d72959f8683127989aa4b (diff) |
Do not cache datainput value if presentation is not ready
This fixes the case of client (ineffectively) setting a value before
presentation is ready, and then trying to set same value later again. This
causes discard when the the incoming value is compared to the cached
value.
Task-id: QT3DS-3987
Change-Id: If41e0140a26514e5f5cf0f427d6c3d59090e2d43
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r-- | src/api/studio3d/q3dspresentation.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/api/studio3d/q3dspresentation.cpp b/src/api/studio3d/q3dspresentation.cpp index e6cc423..31243d0 100644 --- a/src/api/studio3d/q3dspresentation.cpp +++ b/src/api/studio3d/q3dspresentation.cpp @@ -1127,6 +1127,13 @@ void Q3DSPresentation::setDataInputValue(const QString &name, const QVariant &va di->d_ptr->m_forced = force; d_ptr->setDataInputDirty(name, true, d_ptr->m_dataInputCallIndex++); + + // Do not pollute datainput value cache if we are not ready to accept attribute changes. + // Datainput will locally hold set value and is marked as dirty, but we do not yet allow + // updating the cached value that holds the value we have actually committed to the engine. + if (!d_ptr->m_viewerApp && !d_ptr->m_commandQueue) + return; + // We batch datainput changes within a frame, so just tell the presentation that one // or more datainputs have changed value. d_ptr->m_dataInputsChanged = true; |