[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 // Exposed properties
property var sortedViewIds: [] property var sortedViewIds: []
property var viewer: null property var viewer: null
readonly property alias sync3DSelected: m.sync3DSelected
function updateReconstructionView() { function updateReconstructionView() {
if (_reconstruction && m.frame >= 0 && m.frame < sortedViewIds.length) { if (_reconstruction && m.frame >= 0 && m.frame < sortedViewIds.length) {

View file

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

View file

@ -112,7 +112,8 @@ import Utils 1.0
'locatorScale': Qt.binding(function() { return Viewer3DSettings.cameraScale }), 'locatorScale': Qt.binding(function() { return Viewer3DSettings.cameraScale }),
'cameraPickingEnabled': Qt.binding(function() { return root.enabled }), 'cameraPickingEnabled': Qt.binding(function() { return root.enabled }),
'resectionId': Qt.binding(function() { return Viewer3DSettings.resectionId }), '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() { obj.statusChanged.connect(function() {

View file

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

View file

@ -51,6 +51,7 @@ Item {
property bool displayOrigin: false property bool displayOrigin: false
// Camera // Camera
property bool syncViewpointCamera: false 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 bool viewpointImageOverlay: true
property real viewpointImageOverlayOpacity: 0.5 property real viewpointImageOverlayOpacity: 0.5
readonly property bool showViewpointImageOverlay: syncViewpointCamera && viewpointImageOverlay readonly property bool showViewpointImageOverlay: syncViewpointCamera && viewpointImageOverlay

View file

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