mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-21 21:16:29 +02:00
[ui] Add a "pipelineTemplateNames" property
This property simplifies and optimizes the addition of templates in the node menu and their import into the graph, as it prevents us from looping over the entire "pipelineTemplateFiles" dictionary to retrieve the information we need.
This commit is contained in:
parent
c2570ca0fb
commit
2e5f471b7b
2 changed files with 9 additions and 18 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue