[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.
This commit is contained in:
Elyas Benyamina 2024-04-18 17:49:55 +02:00 committed by Candice Bentéjac
parent aee13b5202
commit 2a054a2701

View file

@ -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