summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2019-10-21 11:34:10 +0200
committerPaul Lemire <paul.lemire@kdab.com>2019-10-25 07:47:14 +0200
commitab6a70325e320ff0ea2c5b4673cc9a122ee0f601 (patch)
tree2d46312a5aad7844a5427cddbe5402304565a147 /src
parent1194641110288b4e58c92cac17c3289ad7cad49d (diff)
Scene3D: halt Qt3D simulation loop while not visible
Change-Id: I09d69fab7aaf3c2fa77da6eb30e505d9cb25c01f Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick3d/imports/scene3d/scene3ditem.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/quick3d/imports/scene3d/scene3ditem.cpp b/src/quick3d/imports/scene3d/scene3ditem.cpp
index 835485385..55e972406 100644
--- a/src/quick3d/imports/scene3d/scene3ditem.cpp
+++ b/src/quick3d/imports/scene3d/scene3ditem.cpp
@@ -137,6 +137,11 @@ namespace Qt3DRender {
\li The Scene3D instance is instantiated prior to any Scene3DView
\li The Scene3D entity property is left unset
\endlist
+
+ \note Åšetting the visibility of the Scene3D element to false will halt the
+ Qt 3D simulation loop. This means that binding the visible property to an
+ expression that depends on property updates driven by the Qt 3D simulation
+ loop (FrameAction) will never reavaluates.
*/
Scene3DItem::Scene3DItem(QQuickItem *parent)
: QQuickItem(parent)
@@ -455,6 +460,12 @@ bool Scene3DItem::needsRender()
// processFrame will block and wait for renderer to have been finished
void Scene3DItem::onBeforeSync()
{
+ // If we are not visible, don't processFrame changes as we would end up
+ // waiting forever for the scene to be rendered which won't happen
+ // if the Scene3D item is not visible
+ if (!isVisible())
+ return;
+
// Has anything in the 3D scene actually changed that requires us to render?
if (!needsRender())
return;