Skip to content

Commit

Permalink
[ui] GraphEditor: select pipelines imported through the node menu
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cbentejac committed Dec 2, 2022
1 parent 9d88ad9 commit 6a36da6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion meshroom/ui/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def redoImpl(self):
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:
Expand Down
4 changes: 2 additions & 2 deletions meshroom/ui/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ def loadGraph(self, filepath, setupProjectFile=True):
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,
Expand Down
4 changes: 3 additions & 1 deletion meshroom/ui/qml/GraphEditor/GraphEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6a36da6

Please sign in to comment.