Skip to content

Commit 385399d

Browse files
committed
[ui] reconstruction: Add new slot to load a template with CopyFiles
To use `_loadWithErrorReport` without breaking it, a new slot that uses `initFromTemplate` with `copyOutputs=True` instead of `copyOutputs=False` (the default value) is added.
1 parent 12cc5c1 commit 385399d

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

meshroom/ui/reconstruction.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,18 +457,31 @@ def _onPluginsReloaded(self, nodeTypes: list):
457457
self._graph.reloadNodePlugins(nodeTypes)
458458
self.parent().showMessage("Plugins reloaded!", "ok")
459459

460-
@Slot()
461-
@Slot(str)
460+
@Slot(result=bool)
461+
@Slot(str, result=bool)
462462
def new(self, pipeline=None):
463463
""" Create a new pipeline. """
464-
p = pipeline if pipeline != None else self._defaultPipeline
464+
p = pipeline if pipeline is not None else self._defaultPipeline
465465
# Lower the input and the dictionary keys to make sure that all input types can be found:
466466
# - correct pipeline name but the case does not match (e.g. panoramaHDR instead of panoramaHdr)
467467
# - lowercase pipeline name given through the "New Pipeline" menu
468468
loweredPipelineTemplates = {k.lower(): v for k, v in meshroom.core.pipelineTemplates.items()}
469469
filepath = loweredPipelineTemplates.get(p.lower(), p)
470470
return self._loadWithErrorReport(self.initFromTemplate, filepath)
471471

472+
def _initFromTemplateWithCopyOutputs(self, filepath):
473+
self.initFromTemplate(filepath, copyOutputs=True)
474+
475+
@Slot(result=bool)
476+
@Slot(str, result=bool)
477+
def newWithCopyOutputs(self, pipeline=None):
478+
""" Create a new pipeline with all the "CopyFiles" nodes included if the provided template has any. """
479+
p = pipeline if pipeline is not None else self._defaultPipeline
480+
loweredPipelineTemplates = {k.lower(): v for k, v in meshroom.core.pipelineTemplates.items()}
481+
filepath = loweredPipelineTemplates.get(p.lower(), p)
482+
return self._loadWithErrorReport(self._initFromTemplateWithCopyOutputs, filepath)
483+
484+
472485
@Slot(str, result=bool)
473486
@Slot(QUrl, result=bool)
474487
def load(self, url):

0 commit comments

Comments
 (0)