Skip to content

Commit e3d1c32

Browse files
committed
[bin] meshroom_batch: Rename Publish nodes to CopyFiles
1 parent 274b23a commit e3d1c32

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

bin/meshroom_batch

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ general_group.add_argument(
5757
default=os.environ.get('MESHROOM_DEFAULT_PIPELINE', 'photogrammetry'),
5858
help='Template pipeline among those listed or a Meshroom file containing a custom pipeline '
5959
'to run on input images:\n' +
60-
'\n'.join([' - ' + p for p in meshroom.core.pipelineTemplates]) +
61-
'\nRequirements: the graph must contain at least one CameraInit node, and at least '
62-
'one Publish node if --output is set.',
60+
'\n'.join([' - ' + p for p in meshroom.core.pipelineTemplates]) +
61+
'\nRequirements: the graph must contain one CameraInit node, and at least '
62+
'one CopyFiles node if --output is set.',
6363
)
6464

6565
general_group.add_argument(
66-
'-o', '--output', metavar='FOLDER PUBLISH_INSTANCE=FOLDER',
66+
'-o', '--output', metavar='FOLDER COPYFILES_INSTANCE=FOLDER',
6767
type=str, required=False, nargs='*',
6868
help='Output folder where results should be copied to. '
69-
'If the output folder is provided without specifiying the instance of a Publish node, '
70-
'all the Publish nodes in the scene will be set with the same ouput folder value. '
69+
'If the output folder is provided without specifiying the instance of a CopyFiles node, '
70+
'all the CopyFiles nodes in the scene will be set with the same ouput folder value. '
7171
'If not set, results will have to be retrieved directly from the cache folder.')
7272

7373
general_group.add_argument(
@@ -151,10 +151,10 @@ with meshroom.core.graph.GraphModification(graph):
151151
loweredPipelineTemplates = {k.lower(): v for k, v in meshroom.core.pipelineTemplates.items()}
152152
if args.pipeline.lower() in loweredPipelineTemplates:
153153
graph.initFromTemplate(loweredPipelineTemplates[args.pipeline.lower()],
154-
publishOutputs=True if args.output else False)
154+
copyOutputs=True if args.output else False)
155155
else:
156156
# custom pipeline
157-
graph.initFromTemplate(args.pipeline, publishOutputs=True if args.output else False)
157+
graph.initFromTemplate(args.pipeline, copyOutputs=True if args.output else False)
158158

159159
def parseInputs(inputs, uniqueInitNode):
160160
"""Utility method for parsing the input and inputRecursive arguments."""
@@ -218,46 +218,46 @@ with meshroom.core.graph.GraphModification(graph):
218218
graph.setVerbose(args.verbose)
219219

220220
if args.output:
221-
# The output folders for Publish nodes can be set as follows:
221+
# The output folders for CopyFiles nodes can be set as follows:
222222
# - for each node, the output folder is specified following the
223-
# "Publish_name=/output/folder/path" convention.
224-
# - a path is provided without specifying which Publish node should be set with it:
225-
# all the Publish nodes will be set with it.
226-
# - some Publish nodes have their path specified, and another path is provided
227-
# without specifying a node: all Publish nodes with dedicated will have their own
223+
# "CopyFiles_name=/output/folder/path" convention.
224+
# - a path is provided without specifying which CopyFiles node should be set with it:
225+
# all the CopyFiles nodes will be set with it.
226+
# - some CopyFiles nodes have their path specified, and another path is provided
227+
# without specifying a node: all CopyFiles nodes with dedicated will have their own
228228
# output folders set, and those which have not been specified will be set with the
229229
# other path.
230-
# - some Publish nodes have their output folder specified while others do not: all
230+
# - some CopyFiles nodes have their output folder specified while others do not: all
231231
# the nodes with specified folders will use the provided values, and those without
232-
# any will be set with the output folder of the first specified Publish node.
232+
# any will be set with the output folder of the first specified CopyFiles node.
233233
# - several output folders are provided without specifying any node: the last one will
234-
# be used to set all the Publish nodes' output folders.
234+
# be used to set all the CopyFiles nodes' output folders.
235235

236-
# Check that there is at least one Publish node
237-
publishNodes = graph.nodesOfType('Publish')
238-
if len(publishNodes) == 0:
236+
# Check that there is at least one CopyFiles node
237+
copyNodes = graph.nodesOfType('CopyFiles')
238+
if len(copyNodes) == 0:
239239
raise RuntimeError('meshroom_batch requires a pipeline graph with at least ' +
240-
'one Publish node, none found.')
240+
'one CopyFiles node, none found.')
241241

242242
reExtract = re.compile(r'(\w+)=(.*)') # NodeName=value
243-
globalPublishPath = ""
243+
globalCopyPath = ""
244244
for p in args.output:
245245
result = reExtract.match(p)
246246
if not result: # If the argument is only a path, set it for the global path
247-
globalPublishPath = p
247+
globalCopyPath = p
248248
continue
249249

250250
node, value = result.groups()
251-
for i, n in enumerate(publishNodes): # Find the correct Publish node in the list
251+
for i, n in enumerate(copyNodes): # Find the correct CopyPath node in the list
252252
if n.name == node: # If found, set the value, and remove it from the list
253253
n.output.value = value
254-
publishNodes.pop(i)
255-
if globalPublishPath == "": # Fallback in case some nodes would have no path
256-
globalPublishPath = value
254+
copyNodes.pop(i)
255+
if globalCopyPath == "": # Fallback in case some nodes would have no path
256+
globalCopyPath = value
257257
break
258258

259-
for n in publishNodes: # Set the remaining Publish nodes with the global path
260-
n.output.value = globalPublishPath
259+
for n in copyNodes: # Set the remaining CopyPath nodes with the global path
260+
n.output.value = globalCopyPath
261261
else:
262262
print(f'No output set, results will be available in the cache folder: "{graph.cacheDir}"')
263263

0 commit comments

Comments
 (0)