diff --git a/meshroom/core/graph.py b/meshroom/core/graph.py index 798b20e7..6a97c07d 100644 --- a/meshroom/core/graph.py +++ b/meshroom/core/graph.py @@ -1812,8 +1812,7 @@ def execute(graph, toNodes=None, forceCompute=False, forceStatus=False): node.endSequence() -def submitGraph(graph, submitter, toNode=None): - toNodes = graph.findNodes([toNode]) if toNode else None +def submitGraph(graph, submitter, toNodes=None): nodesToProcess, edgesToProcess = graph.dfsToProcess(startNodes=toNodes) flowEdges = graph.flowEdges(startNodes=toNodes) edgesToProcess = set(edgesToProcess).intersection(flowEdges) @@ -1843,5 +1842,6 @@ def submit(graphFile, submitter, toNode=None): Submit the given graph via the given submitter. """ graph = loadGraph(graphFile) - submitGraph(graph, submitter, toNode) + toNodes = graph.findNodes([toNode]) if toNode else None + submitGraph(graph, submitter, toNodes) diff --git a/meshroom/ui/graph.py b/meshroom/ui/graph.py index e82ba7c9..dd545477 100644 --- a/meshroom/ui/graph.py +++ b/meshroom/ui/graph.py @@ -179,11 +179,18 @@ class UIGraph(QObject): self._computeThread.join() self.computeStatusChanged.emit() - @Slot() - def submit(self): - """ Submit the whole graph to the default Submitter. """ + @Slot(graph.Node) + def submit(self, node=None): + """ Submit the graph to the default Submitter. + If a node is specified, submit this node and its uncomputed predecessors. + Otherwise, submit the whole graph. + + Notes: + Default submitter is specified using the MESHROOM_DEFAULT_SUBMITTER environment variable. + """ self.save() # graph must be saved before being submitted - graph.submitGraph(self._graph, os.environ.get('MESHROOM_DEFAULT_SUBMITTER', '')) + node = [node] if node else None + graph.submitGraph(self._graph, os.environ.get('MESHROOM_DEFAULT_SUBMITTER', ''), node) def onChunkStatusChanged(self, chunk, status): # update graph computing status diff --git a/meshroom/ui/qml/GraphEditor/GraphEditor.qml b/meshroom/ui/qml/GraphEditor/GraphEditor.qml index 7f0d2c31..07c2317d 100755 --- a/meshroom/ui/qml/GraphEditor/GraphEditor.qml +++ b/meshroom/ui/qml/GraphEditor/GraphEditor.qml @@ -229,6 +229,7 @@ Item { onDoubleClicked: root.nodeDoubleClicked(node) onComputeRequest: uigraph.execute(node) + onSubmitRequest: uigraph.submit(node) onRemoveRequest: uigraph.removeNode(node) Keys.onDeletePressed: uigraph.removeNode(node) diff --git a/meshroom/ui/qml/GraphEditor/Node.qml b/meshroom/ui/qml/GraphEditor/Node.qml index 8d64c781..07b5ec35 100755 --- a/meshroom/ui/qml/GraphEditor/Node.qml +++ b/meshroom/ui/qml/GraphEditor/Node.qml @@ -15,6 +15,7 @@ Item { signal attributePinCreated(var attribute, var pin) signal computeRequest() + signal submitRequest() signal removeRequest() implicitHeight: body.height @@ -40,6 +41,11 @@ Item { enabled: !root.readOnly onTriggered: root.computeRequest() } + MenuItem { + text: "Submit" + enabled: !root.readOnly + onTriggered: root.submitRequest() + } MenuItem { text: "Open Folder" onTriggered: Qt.openUrlExternally(node.internalFolder)