[bin] meshroom: option to choose HDRI pipeline

This commit is contained in:
Fabien Castan 2019-11-04 00:30:22 +01:00
parent a85730aa45
commit 07f564d6e0
4 changed files with 108 additions and 28 deletions

View file

@ -65,7 +65,7 @@ class MeshroomApp(QApplication):
help='Import images or folder with images to reconstruct.')
parser.add_argument('-I', '--importRecursive', metavar='FOLDERS', type=str, nargs='*',
help='Import images to reconstruct from specified folder and sub-folders.')
parser.add_argument('-p', '--pipeline', metavar='MESHROOM_FILE', type=str, required=False,
parser.add_argument('-p', '--pipeline', metavar='MESHROOM_FILE/photogrammetry/hdri', type=str, default=os.environ.get("MESHROOM_DEFAULT_PIPELINE", "photogrammetry"),
help='Override the default Meshroom pipeline with this external graph.')
args = parser.parse_args(args[1:])
@ -101,7 +101,7 @@ class MeshroomApp(QApplication):
self.engine.rootContext().setContextProperty("_nodeTypes", sorted(nodesDesc.keys()))
# instantiate Reconstruction object
r = Reconstruction(parent=self)
r = Reconstruction(defaultPipeline=args.pipeline, parent=self)
self.engine.rootContext().setContextProperty("_reconstruction", r)
# those helpers should be available from QML Utils module as singletons, but:
@ -119,15 +119,6 @@ class MeshroomApp(QApplication):
# request any potential computation to stop on exit
self.aboutToQuit.connect(r.stopChildThreads)
if args.pipeline:
# the pipeline from the command line has the priority
r.setDefaultPipeline(args.pipeline)
else:
# consider the environment variable
defaultPipeline = os.environ.get("MESHROOM_DEFAULT_PIPELINE", "")
if defaultPipeline:
r.setDefaultPipeline(args.pipeline)
if args.project and not os.path.isfile(args.project):
raise RuntimeError(
"Meshroom Command Line Error: 'PROJECT' argument should be a Meshroom project file (.mg).\n"
@ -135,6 +126,8 @@ class MeshroomApp(QApplication):
if args.project:
r.load(args.project)
else:
r.new()
# import is a python keyword, so we have to access the attribute by a string
if getattr(args, "import", None):