From ab6a70325e320ff0ea2c5b4673cc9a122ee0f601 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Mon, 21 Oct 2019 11:34:10 +0200 Subject: Scene3D: halt Qt3D simulation loop while not visible Change-Id: I09d69fab7aaf3c2fa77da6eb30e505d9cb25c01f Reviewed-by: Mike Krus --- src/quick3d/imports/scene3d/scene3ditem.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') 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; -- cgit v1.2.3