From 6a36da61cf04590d51f301d8e9c34d321efdc6e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Fri, 2 Dec 2022 18:19:56 +0100 Subject: [PATCH] [ui] GraphEditor: select pipelines imported through the node menu Add all the nodes from a pipeline imported through the node menu to the node selection. This involves changing the return value of ImportProjectCommand from a boolean to a list of imported nodes. --- meshroom/ui/commands.py | 2 +- meshroom/ui/graph.py | 4 ++-- meshroom/ui/qml/GraphEditor/GraphEditor.qml | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/meshroom/ui/commands.py b/meshroom/ui/commands.py index 20882613..bbfb3063 100755 --- a/meshroom/ui/commands.py +++ b/meshroom/ui/commands.py @@ -245,7 +245,7 @@ class ImportProjectCommand(GraphCommand): else: self.graph.node(node.name).position = Position(node.x, node.y + lowestY + self.yOffset) - return status + return importedNodes def undoImpl(self): for nodeName in self.importedNames: diff --git a/meshroom/ui/graph.py b/meshroom/ui/graph.py index e9769bd4..7ace78d0 100644 --- a/meshroom/ui/graph.py +++ b/meshroom/ui/graph.py @@ -353,8 +353,8 @@ class UIGraph(QObject): self.setGraph(g) return status - @Slot(QUrl, result=bool) - @Slot(QUrl, QPoint, result=bool) + @Slot(QUrl, result="QVariantList") + @Slot(QUrl, QPoint, result="QVariantList") def importProject(self, filepath, position=None): if isinstance(filepath, (QUrl)): # depending how the QUrl has been initialized, diff --git a/meshroom/ui/qml/GraphEditor/GraphEditor.qml b/meshroom/ui/qml/GraphEditor/GraphEditor.qml index 0d801606..3262c622 100755 --- a/meshroom/ui/qml/GraphEditor/GraphEditor.qml +++ b/meshroom/ui/qml/GraphEditor/GraphEditor.qml @@ -234,7 +234,9 @@ Item { { if (MeshroomApp.pipelineTemplateNames.includes(pipeline)) { var url = MeshroomApp.pipelineTemplateFiles[MeshroomApp.pipelineTemplateNames.indexOf(pipeline)]["path"] - uigraph.importProject(Filepath.stringToUrl(url), spawnPosition) + var nodes = uigraph.importProject(Filepath.stringToUrl(url), spawnPosition) + uigraph.selectedNode = nodes[0] + uigraph.selectNodes(nodes) return true } return false