Merge pull request #2145 from alicevision/fix/cameraInitIdx

[ui] Preserve last `CameraInit` index when updating the CameraInits list
This commit is contained in:
Fabien Castan 2023-10-19 10:58:33 +02:00 committed by GitHub
commit c02aa1f229
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -35,6 +35,14 @@ Panel {
title: "Image Gallery"
implicitWidth: (root.defaultCellSize + 2) * 2
Connections {
target: _reconstruction
function onCameraInitChanged() {
nodesCB.currentIndex = root.cameraInitIndex
}
}
QtObject {
id: m
property variant currentCameraInit: _reconstruction && _reconstruction.tempCameraInit ? _reconstruction.tempCameraInit : root.cameraInit

View file

@ -573,7 +573,12 @@ class Reconstruction(UIGraph):
if set(self._cameraInits.objectList()) == set(cameraInits):
return
self._cameraInits.setObjectList(cameraInits)
self.cameraInit = cameraInits[0] if cameraInits else None
if self.cameraInit is None or self.cameraInit not in cameraInits:
self.cameraInit = cameraInits[0] if cameraInits else None
# Manually emit the signal to ensure the active CameraInit index is always up-to-date in the UI
self.cameraInitChanged.emit()
def getCameraInitIndex(self):
if not self._cameraInit: