summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@qt.io>2019-02-27 13:17:46 +0100
committerChristian Strømme <christian.stromme@qt.io>2019-03-04 11:47:02 +0000
commit925778cd50450839a3939ffe5884f8fc77c94995 (patch)
tree222ab8d668a65115cbbe3aceadfdc16d20ac6306
parent228b1c7ce76a134e4d2e67809ef8b86f371a15ef (diff)
Defer calling updateGlobals() when changing visibility on a layers
We need to know the state of the camera before calling updateGlobals() on a layer, as all other nodes will have the effective visibility update accordingly. Fixes: QT3DS-3080 Change-Id: Ie1b5e77a03d07c66d80c3a30b391452c41de70dc Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/runtime/q3dsscenemanager.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/runtime/q3dsscenemanager.cpp b/src/runtime/q3dsscenemanager.cpp
index ab6f3d2..856fc8f 100644
--- a/src/runtime/q3dsscenemanager.cpp
+++ b/src/runtime/q3dsscenemanager.cpp
@@ -8401,6 +8401,8 @@ void Q3DSSceneManager::setPendingVisibilities()
{
const bool noAnimations = currentSlide() && (currentSlide()->animations().isEmpty()
&& (currentSlide()->parent() ? static_cast<Q3DSSlide *>(currentSlide()->parent())->animations().isEmpty() : true));
+
+ QVector<Q3DSLayerNode *> layerNodes;
for (auto it = m_pendingObjectVisibility.constBegin(); it != m_pendingObjectVisibility.constEnd(); ++it) {
if (it.key()->isNode() && it.key()->type() != Q3DSGraphObject::Layer && it.key()->type() != Q3DSGraphObject::Camera) {
Q3DSNode *node = static_cast<Q3DSNode *>(it.key());
@@ -8423,7 +8425,8 @@ void Q3DSSceneManager::setPendingVisibilities()
const bool enabled = it.value() && layer3DS->flags().testFlag(Q3DSNode::Active);
data->visibilityTag = enabled ? Q3DSGraphObjectAttached::Visible
: Q3DSGraphObjectAttached::Hidden;
- updateGlobals(layer3DS, UpdateGlobalsRecursively | UpdateGlobalsSkipTransform);
+ // defer updateGlobals for layers until we know the status of the camera.
+ layerNodes.push_back(static_cast<Q3DSLayerNode *>(it.key()));
if (data->compositorEntity) // may not exist if this is still buildLayer()
data->compositorEntity->setEnabled(enabled);
}
@@ -8453,6 +8456,9 @@ void Q3DSSceneManager::setPendingVisibilities()
it.key()->notifyPropertyChanges({{QString()}}, 0);
}
+ for (const auto layer : qAsConst(layerNodes))
+ updateGlobals(layer, UpdateGlobalsRecursively | UpdateGlobalsSkipTransform);
+
m_pendingObjectVisibility.clear();
}