[ui] Sync camera gizmo in Viewer3D enabled

This commit is contained in:
Aurore LAFAURIE 2024-04-04 18:19:15 +02:00 committed by Candice Bentéjac
parent 361f777118
commit 369143eca1
6 changed files with 19 additions and 2 deletions

View file

@ -22,6 +22,7 @@ FloatingPane {
// Exposed properties
property var sortedViewIds: []
property var viewer: null
readonly property alias sync3DSelected: m.sync3DSelected
function updateReconstructionView() {
if (_reconstruction && m.frame >= 0 && m.frame < sortedViewIds.length) {

View file

@ -28,6 +28,8 @@ FocusScope {
property bool enable8bitViewer: enable8bitViewerAction.checked
property bool enableSequencePlayer: enableSequencePlayerAction.checked
readonly property alias sync3DSelected: sequencePlayer.sync3DSelected
QtObject {
id: m
property variant viewpointMetadata: {

View file

@ -112,7 +112,8 @@ import Utils 1.0
'locatorScale': Qt.binding(function() { return Viewer3DSettings.cameraScale }),
'cameraPickingEnabled': Qt.binding(function() { return root.enabled }),
'resectionId': Qt.binding(function() { return Viewer3DSettings.resectionId }),
'displayResections': Qt.binding(function() { return Viewer3DSettings.displayResectionIds })
'displayResections': Qt.binding(function() { return Viewer3DSettings.displayResectionIds }),
'syncPickedViewId': Qt.binding(function() { return Viewer3DSettings.syncWithPickedViewId })
});
obj.statusChanged.connect(function() {

View file

@ -12,6 +12,8 @@ SfmDataEntity {
id: root
property bool cameraPickingEnabled: true
property bool syncPickedViewId: false
// filter out non-reconstructed cameras
skipHidden: true
@ -22,6 +24,9 @@ SfmDataEntity {
function onSelectedViewIdChanged() {
root.cameraSelected(_reconstruction.selectedViewId)
}
function onSelectedViewpointChanged() {
root.cameraSelected(_reconstruction.pickedViewId)
}
}
function spawnCameraSelectors() {
@ -96,7 +101,7 @@ SfmDataEntity {
},
PhongMaterial{
id: mat
ambient: _reconstruction && viewId === _reconstruction.selectedViewId ? activePalette.highlight : customColor // "#CCC"
ambient: _reconstruction && (viewId === _reconstruction.selectedViewId || (viewId === _reconstruction.pickedViewId && syncPickedViewId)) ? activePalette.highlight : customColor // "#CCC"
diffuse: cameraPicker.containsMouse ? Qt.lighter(activePalette.highlight, 1.2) : ambient
},
ObjectPicker {

View file

@ -51,6 +51,7 @@ Item {
property bool displayOrigin: false
// Camera
property bool syncViewpointCamera: false
property bool syncWithPickedViewId: false // Sync active camera with picked view ID from sequence player if the setting is enabled
property bool viewpointImageOverlay: true
property real viewpointImageOverlayOpacity: 0.5
readonly property bool showViewpointImageOverlay: syncViewpointCamera && viewpointImageOverlay

View file

@ -226,6 +226,13 @@ Item {
drop.urls.forEach(function(url){ load3DMedia(url); });
}
}
Connections {
target: viewer2D
function onSync3DSelectedChanged() {
Viewer3DSettings.syncWithPickedViewId = viewer2D.sync3DSelected
}
}
// Load reconstructed model
Button {