mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-29 18:27:23 +02:00
[ui] Sync Viewer3D according to updateSelectedViewpoint
This commit is contained in:
parent
ca4f7f13e5
commit
5afb9cb2c8
2 changed files with 28 additions and 1 deletions
|
@ -29,6 +29,9 @@ FloatingPane {
|
||||||
_reconstruction.selectedViewId = sortedViewIds[m.frame];
|
_reconstruction.selectedViewId = sortedViewIds[m.frame];
|
||||||
} else {
|
} else {
|
||||||
_reconstruction.pickedViewId = sortedViewIds[m.frame];
|
_reconstruction.pickedViewId = sortedViewIds[m.frame];
|
||||||
|
if (m.sync3DSelected) {
|
||||||
|
_reconstruction.updateSelectedViewpoint(_reconstruction.pickedViewId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,6 +44,7 @@ FloatingPane {
|
||||||
|
|
||||||
property int frame: 0
|
property int frame: 0
|
||||||
property bool syncSelected: true
|
property bool syncSelected: true
|
||||||
|
property bool sync3DSelected: false
|
||||||
property bool playing: false
|
property bool playing: false
|
||||||
property bool repeat: false
|
property bool repeat: false
|
||||||
property real fps: 24
|
property real fps: 24
|
||||||
|
@ -271,6 +275,19 @@ FloatingPane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MaterialToolButton {
|
||||||
|
id: sync3DButton
|
||||||
|
|
||||||
|
checkable: true
|
||||||
|
checked: false
|
||||||
|
text: MaterialIcons.sync_alt
|
||||||
|
ToolTip.text: "Sync 3D Viewer and Sequence Player"
|
||||||
|
|
||||||
|
onCheckedChanged: {
|
||||||
|
m.sync3DSelected = checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextMetrics {
|
TextMetrics {
|
||||||
|
|
|
@ -1115,6 +1115,7 @@ class Reconstruction(UIGraph):
|
||||||
# Reconstruction has ownership of Viewpoint object - destroy it when not needed anymore
|
# Reconstruction has ownership of Viewpoint object - destroy it when not needed anymore
|
||||||
self._selectedViewpoint.deleteLater()
|
self._selectedViewpoint.deleteLater()
|
||||||
self._selectedViewpoint = ViewpointWrapper(viewpointAttribute, self) if viewpointAttribute else None
|
self._selectedViewpoint = ViewpointWrapper(viewpointAttribute, self) if viewpointAttribute else None
|
||||||
|
self.selectedViewpointChanged.emit()
|
||||||
|
|
||||||
def setPickedViewId(self, viewId):
|
def setPickedViewId(self, viewId):
|
||||||
if viewId == self._pickedViewId:
|
if viewId == self._pickedViewId:
|
||||||
|
@ -1122,6 +1123,14 @@ class Reconstruction(UIGraph):
|
||||||
self._pickedViewId = viewId
|
self._pickedViewId = viewId
|
||||||
self.pickedViewIdChanged.emit()
|
self.pickedViewIdChanged.emit()
|
||||||
|
|
||||||
|
@Slot(str)
|
||||||
|
def updateSelectedViewpoint(self, viewId):
|
||||||
|
""" Update the currently set viewpoint if the provided view ID corresponds to one. """
|
||||||
|
vp = None
|
||||||
|
if self.viewpoints:
|
||||||
|
vp = next((v for v in self.viewpoints if str(v.viewId.value) == viewId), None)
|
||||||
|
self._setSelectedViewpoint(vp)
|
||||||
|
|
||||||
def reconstructedCamerasCount(self):
|
def reconstructedCamerasCount(self):
|
||||||
""" Get the number of reconstructed cameras in the current context. """
|
""" Get the number of reconstructed cameras in the current context. """
|
||||||
viewpoints = self.getViewpoints()
|
viewpoints = self.getViewpoints()
|
||||||
|
@ -1166,7 +1175,8 @@ class Reconstruction(UIGraph):
|
||||||
|
|
||||||
selectedViewIdChanged = Signal()
|
selectedViewIdChanged = Signal()
|
||||||
selectedViewId = Property(str, lambda self: self._selectedViewId, setSelectedViewId, notify=selectedViewIdChanged)
|
selectedViewId = Property(str, lambda self: self._selectedViewId, setSelectedViewId, notify=selectedViewIdChanged)
|
||||||
selectedViewpoint = Property(ViewpointWrapper, lambda self: self._selectedViewpoint, notify=selectedViewIdChanged)
|
selectedViewpointChanged = Signal()
|
||||||
|
selectedViewpoint = Property(ViewpointWrapper, lambda self: self._selectedViewpoint, notify=selectedViewpointChanged)
|
||||||
pickedViewIdChanged = Signal()
|
pickedViewIdChanged = Signal()
|
||||||
pickedViewId = Property(str, lambda self: self._pickedViewId, setPickedViewId, notify=pickedViewIdChanged)
|
pickedViewId = Property(str, lambda self: self._pickedViewId, setPickedViewId, notify=pickedViewIdChanged)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue