From 2a054a27015a5daff85b44f94fe01a7cf9634620 Mon Sep 17 00:00:00 2001 From: Elyas Benyamina Date: Thu, 18 Apr 2024 17:49:55 +0200 Subject: [PATCH] [Viewer] fix lens distortion viewer status when switching between projects When opening an empty pipeline while the lens distortion viewer was enabled, we ended up in a state where the distortion viewer remained enabled and could not be disabled anymore as its button was greyed out. --- meshroom/ui/qml/Viewer/Viewer2D.qml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/meshroom/ui/qml/Viewer/Viewer2D.qml b/meshroom/ui/qml/Viewer/Viewer2D.qml index 83857cfa..b1912a38 100644 --- a/meshroom/ui/qml/Viewer/Viewer2D.qml +++ b/meshroom/ui/qml/Viewer/Viewer2D.qml @@ -1096,6 +1096,9 @@ FocusScope { } MaterialToolButton { id: displayLensDistortionViewer + + property int numberChanges: null + property bool previousChecked: null property var activeNode: root.aliceVisionPluginAvailable && _reconstruction ? _reconstruction.activeNodes.get('sfmData').node : null property bool isComputed: { if (!activeNode) @@ -1127,6 +1130,22 @@ FocusScope { displayHDR.checked = true } } + + onActiveNodeChanged: { + numberChanges += 1 + } + + onEnabledChanged: { + if (!enabled) { + previousChecked = checked + checked = false + numberChanges = 0 + } + + if (enabled && (numberChanges == 1) && previousChecked) { + checked = true + } + } } MaterialToolButton { id: displayPanoramaViewer