[bin] meshroom_batch: Save graph once it has been all set up and resolved

If the "save" argument has been provided, the graph should be saved
outside of the `GraphModificatioǹ event, once it has been set up entirely
and resolved.

When it is saved within the `GraphModification`, UIDs are not yet
available.

This does not cause any issue for the rest of the execution if the graph
is to be computed locally, since the UIDs will be computed right
after (but the UIDs will still never be written in the project file).
However, when submitting the graph to a renderfarm, the project file is
loaded again. If it does not contain any UID:
 - all the nodes will present the `UidConflict` compatibility issue
 - key errors will be raised when trying to apply the links between nodes
since they contain direct references to UIDs, which cannot be resolved as
they are not present in the project file.
This commit is contained in:
Candice Bentéjac 2023-06-30 18:59:32 +02:00
parent d7e3003aa5
commit 1f75ccaf5f

View file

@ -180,9 +180,9 @@ with multiview.GraphModification(graph):
# setup cache directory
graph.cacheDir = args.cache if args.cache else meshroom.core.defaultCacheFolder
if args.save:
graph.save(args.save, setupProjectFile=not bool(args.cache))
print('File successfully saved: "{}"'.format(args.save))
if args.save:
graph.save(args.save, setupProjectFile=not bool(args.cache))
print('File successfully saved: "{}"'.format(args.save))
if not args.output:
print('No output set, results will be available in the cache folder: "{}"'.format(graph.cacheDir))