From 00857a7a88a5a60d29f50181a9c05c403e70bc30 Mon Sep 17 00:00:00 2001 From: Yann Lanthony Date: Thu, 27 Jun 2019 18:25:40 +0200 Subject: [PATCH] [ui] Reconstruction: rename 'endNode' to 'texturing' + use makeProperty helper --- meshroom/ui/qml/WorkspaceView.qml | 6 +++--- meshroom/ui/reconstruction.py | 23 +++++------------------ 2 files changed, 8 insertions(+), 21 deletions(-) diff --git a/meshroom/ui/qml/WorkspaceView.qml b/meshroom/ui/qml/WorkspaceView.qml index d0f2c12e..1a9dc3d3 100644 --- a/meshroom/ui/qml/WorkspaceView.qml +++ b/meshroom/ui/qml/WorkspaceView.qml @@ -133,8 +133,8 @@ Item { // Load reconstructed model Button { - readonly property var outputAttribute: _reconstruction.endNode ? _reconstruction.endNode.attribute("outputMesh") : null - readonly property bool outputReady: outputAttribute && _reconstruction.endNode.globalStatus === "SUCCESS" + readonly property var outputAttribute: _reconstruction.texturing ? _reconstruction.texturing.attribute("outputMesh") : null + readonly property bool outputReady: outputAttribute && _reconstruction.texturing.globalStatus === "SUCCESS" readonly property int outputMediaIndex: viewer3D.library.find(outputAttribute) text: "Load Model" @@ -142,7 +142,7 @@ Item { anchors.bottomMargin: 10 anchors.horizontalCenter: parent.horizontalCenter visible: outputReady && outputMediaIndex == -1 - onClicked: viewer3D.view(_reconstruction.endNode.attribute("outputMesh")) + onClicked: viewer3D.view(_reconstruction.texturing.attribute("outputMesh")) } } } diff --git a/meshroom/ui/reconstruction.py b/meshroom/ui/reconstruction.py index b16c623a..a11b6784 100755 --- a/meshroom/ui/reconstruction.py +++ b/meshroom/ui/reconstruction.py @@ -164,7 +164,7 @@ class Reconstruction(UIGraph): self._buildingIntrinsics = False self._cameraInit = None self._cameraInits = QObjectListModel(parent=self) - self._endNode = None + self._texturing = None self.intrinsicsBuilt.connect(self.onIntrinsicsAvailable) self.graphChanged.connect(self.onGraphChanged) self._liveSfmManager = LiveSfmManager(self) @@ -212,7 +212,7 @@ class Reconstruction(UIGraph): """ React to the change of the internal graph. """ self._liveSfmManager.reset() self.sfm = None - self.endNode = None + self.texturing = None self.updateCameraInits() if not self._graph: return @@ -493,21 +493,8 @@ class Reconstruction(UIGraph): self._sfm.chunks[0].statusChanged.disconnect(self.updateViewsAndPoses) self._sfm.destroyed.disconnect(self._unsetSfm) self._setSfm(node) - self.setEndNode(self.lastNodeOfType("Texturing", self._sfm, Status.SUCCESS)) - def setEndNode(self, node=None): - if self._endNode == node: - return - if self._endNode: - try: - self._endNode.destroyed.disconnect(self.setEndNode) - except RuntimeError: - # self._endNode might have been destroyed at this point, causing PySide2 to throw a RuntimeError - pass - self._endNode = node - if self._endNode: - self._endNode.destroyed.connect(self.setEndNode) - self.endNodeChanged.emit() + self.texturing = self.lastNodeOfType("Texturing", self._sfm, Status.SUCCESS) @Slot(QObject, result=bool) def isInViews(self, viewpoint): @@ -570,8 +557,8 @@ class Reconstruction(UIGraph): # convenient property for QML binding re-evaluation when sfm report changes sfmReport = Property(bool, lambda self: len(self._poses) > 0, notify=sfmReportChanged) sfmAugmented = Signal(Node, Node) - endNodeChanged = Signal() - endNode = Property(QObject, lambda self: self._endNode, setEndNode, notify=endNodeChanged) + texturingChanged = Signal() + texturing = makeProperty(QObject, "_texturing", notify=texturingChanged) nbCameras = Property(int, reconstructedCamerasCount, notify=sfmReportChanged)