Create Init functions for nodes, submitters and pipelines

This commit is contained in:
Vincent Demoulin 2024-07-05 09:04:09 +02:00 committed by Fabien Castan
parent b173de5a73
commit a6be4e4938
5 changed files with 34 additions and 24 deletions

View file

@ -14,6 +14,7 @@ from meshroom import multiview
from meshroom.core.desc import InitNode
import logging
meshroom.core.initPlugins()
parser = argparse.ArgumentParser(description='Launch the full photogrammetry or Panorama HDR pipeline.')
parser.add_argument('-i', '--input', metavar='NODEINSTANCE:"SFM/FOLDERS/IMAGES;..."', type=str, nargs='*',

View file

@ -31,6 +31,8 @@ parser.add_argument('-i', '--iteration', type=int,
args = parser.parse_args()
meshroom.core.initNodes()
graph = meshroom.core.graph.loadGraph(args.graphFile)
if args.cache:
graph.cacheDir = args.cache

View file

@ -22,4 +22,7 @@ parser.add_argument("--submitLabel",
args = parser.parse_args()
meshroom.core.initNodes()
meshroom.core.initSubmitters()
meshroom.core.graph.submit(args.meshroomFile, args.submitter, toNode=args.toNode, submitLabel=args.submitLabel)

View file

@ -330,30 +330,32 @@ def loadPipelineTemplates(folder):
if file.endswith(".mg") and file not in pipelineTemplates:
pipelineTemplates[os.path.splitext(file)[0]] = os.path.join(folder, file)
meshroomFolder = os.path.dirname(os.path.dirname(__file__))
additionalNodesPath = os.environ.get("MESHROOM_NODES_PATH", "").split(os.pathsep)
# filter empty strings
additionalNodesPath = [i for i in additionalNodesPath if i]
# Load plugins:
# - Nodes
nodesFolders = [os.path.join(meshroomFolder, 'nodes')] + additionalNodesPath
for f in nodesFolders:
def initNodes():
meshroomFolder = os.path.dirname(os.path.dirname(__file__))
additionalNodesPath = os.environ.get("MESHROOM_NODES_PATH", "").split(os.pathsep)
# filter empty strings
additionalNodesPath = [i for i in additionalNodesPath if i]
nodesFolders = [os.path.join(meshroomFolder, 'nodes')] + additionalNodesPath
for f in nodesFolders:
loadAllNodes(folder=f)
# - Submitters
subs = loadSubmitters(os.environ.get("MESHROOM_SUBMITTERS_PATH", meshroomFolder), 'submitters')
for sub in subs:
def initSubmitters():
meshroomFolder = os.path.dirname(os.path.dirname(__file__))
subs = loadSubmitters(os.environ.get("MESHROOM_SUBMITTERS_PATH", meshroomFolder), 'submitters')
for sub in subs:
registerSubmitter(sub())
# Load pipeline templates: check in the default folder and any folder the user might have
# added to the environment variable
additionalPipelinesPath = os.environ.get("MESHROOM_PIPELINE_TEMPLATES_PATH", "").split(os.pathsep)
additionalPipelinesPath = [i for i in additionalPipelinesPath if i]
pipelineTemplatesFolders = [os.path.join(meshroomFolder, 'pipelines')] + additionalPipelinesPath
for f in pipelineTemplatesFolders:
def initPipelines():
meshroomFolder = os.path.dirname(os.path.dirname(__file__))
# Load pipeline templates: check in the default folder and any folder the user might have
# added to the environment variable
additionalPipelinesPath = os.environ.get("MESHROOM_PIPELINE_TEMPLATES_PATH", "").split(os.pathsep)
additionalPipelinesPath = [i for i in additionalPipelinesPath if i]
pipelineTemplatesFolders = [os.path.join(meshroomFolder, 'pipelines')] + additionalPipelinesPath
for f in pipelineTemplatesFolders:
loadPipelineTemplates(f)
def initPlugins():
initNodes()
initSubmitters()
initPipelines()

View file

@ -124,6 +124,8 @@ class MeshroomApp(QApplication):
# - clean cache directory and make sure it exists on disk
ThumbnailCache.initialize()
meshroom.core.initPlugins()
# QML engine setup
qmlDir = os.path.join(pwd, "qml")
url = os.path.join(qmlDir, "main.qml")