From 38ded4ffeaea725215a693eb0da1aacbc386cde7 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 29 Jun 2020 16:24:07 +0300 Subject: [PATCH] QmlDesigner: Turn the 3D edit light on initially for lightless scenes Change-Id: Ib840adec751604f08b5135b3e3088b7ce663685a Fixes: QDS-2316 Reviewed-by: Mahmoud Badri --- .../qml/qmlpuppet/mockfiles/EditView3D.qml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml index 643b377e8b3..efbfcd56421 100644 --- a/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml +++ b/share/qtcreator/qml/qmlpuppet/mockfiles/EditView3D.qml @@ -107,10 +107,22 @@ Item { if (createEditView()) { if (activeScene) { var toolStates = _generalHelper.getToolStates(sceneId); - if (Object.keys(toolStates).length > 0) + if (Object.keys(toolStates).length > 0) { updateToolStates(toolStates, true); - else + } else { + // Don't inherit the edit light state from the previous scene, but rather + // turn the edit light on for scenes that do not have any scene + // lights, and turn it off for scenes that have. + var hasSceneLight = false; + for (var i = 0; i < lightIconGizmos.length; ++i) { + if (lightIconGizmos[i].scene === activeScene) { + hasSceneLight = true; + break; + } + } + showEditLight = !hasSceneLight; storeCurrentToolStates(); + } } else { // When active scene is deleted, this function gets called by object deletion // handlers without going through setActiveScene, so make sure sceneId is cleared.