diff --git a/meshroom/ui/app.py b/meshroom/ui/app.py index 3f9df1fa..1ab9a068 100644 --- a/meshroom/ui/app.py +++ b/meshroom/ui/app.py @@ -198,6 +198,9 @@ class MeshroomApp(QApplication): templates.append(variant) return templates + def _pipelineTemplateNames(self): + return [p["name"] for p in self.pipelineTemplateFiles] + @Slot() def reloadTemplateList(self): for f in meshroom.core.pipelineTemplatesFolders: @@ -352,5 +355,6 @@ class MeshroomApp(QApplication): pipelineTemplateFilesChanged = Signal() recentProjectFilesChanged = Signal() pipelineTemplateFiles = Property("QVariantList", _pipelineTemplateFiles, notify=pipelineTemplateFilesChanged) + pipelineTemplateNames = Property("QVariantList", _pipelineTemplateNames, notify=pipelineTemplateFilesChanged) recentProjectFiles = Property("QVariantList", _recentProjectFiles, notify=recentProjectFilesChanged) default8bitViewerEnabled = Property(bool, _default8bitViewerEnabled, constant=True) diff --git a/meshroom/ui/qml/GraphEditor/GraphEditor.qml b/meshroom/ui/qml/GraphEditor/GraphEditor.qml index 28265a86..d2c48a57 100755 --- a/meshroom/ui/qml/GraphEditor/GraphEditor.qml +++ b/meshroom/ui/qml/GraphEditor/GraphEditor.qml @@ -229,18 +229,9 @@ Item { function importPipeline(pipeline) { - var pipelineNames = [] - var pipelinePaths = [] - for (const [_, data] of Object.entries(MeshroomApp.pipelineTemplateFiles)) { - let name = data["name"] - let path = data["path"] - pipelineNames.push(name) - pipelinePaths.push(path) - } - - if (pipelineNames.includes(pipeline)) { - var url = Filepath.stringToUrl(pipelinePaths[pipelineNames.indexOf(pipeline)]) - uigraph.importProject(url, spawnPosition) + if (MeshroomApp.pipelineTemplateNames.includes(pipeline)) { + var url = MeshroomApp.pipelineTemplateFiles[MeshroomApp.pipelineTemplateNames.indexOf(pipeline)]["path"] + uigraph.importProject(Filepath.stringToUrl(url), spawnPosition) return true } return false @@ -259,12 +250,8 @@ Item { categories[category].push(name) } - // Add list of templates to create pipelines - categories["Pipelines"] = []; - for (const [_, data] of Object.entries(MeshroomApp.pipelineTemplateFiles)) { - let pipeline = data["name"]; - categories["Pipelines"].push(pipeline) - } + // Add a "Pipelines" category, filled with the list of templates to create pipelines from the menu + categories["Pipelines"] = MeshroomApp.pipelineTemplateNames; return categories }