mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-24 03:57:28 +02:00
[attribute] refactor attribute/desc to customize command line arguments formatting
This commit is contained in:
parent
59bdd51b74
commit
064d76de3d
3 changed files with 74 additions and 54 deletions
|
@ -453,18 +453,19 @@ class BaseNode(BaseObject):
|
|||
for uidIndex, value in self._uids.items():
|
||||
self._cmdVars['uid{}'.format(uidIndex)] = value
|
||||
|
||||
def populate(cmdVars, group, name, value):
|
||||
cmdVars[name] = '--{name} {value}'.format(name=name, value=value)
|
||||
cmdVars[name + 'Value'] = str(v)
|
||||
if v:
|
||||
cmdVars[group] = cmdVars.get(group, '') + ' ' + cmdVars[name]
|
||||
|
||||
# Evaluate input params
|
||||
for name, attr in self._attributes.objects.items():
|
||||
for _, attr in self._attributes.objects.items():
|
||||
if attr.isOutput:
|
||||
continue # skip outputs
|
||||
v = attr.getValueStr()
|
||||
|
||||
self._cmdVars[name] = '--{name} {value}'.format(name=name, value=v)
|
||||
self._cmdVars[name + 'Value'] = str(v)
|
||||
|
||||
if v:
|
||||
self._cmdVars[attr.attributeDesc.group] = self._cmdVars.get(attr.attributeDesc.group, '') + \
|
||||
' ' + self._cmdVars[name]
|
||||
group_name_values = attr.format()
|
||||
for group, name, v in group_name_values:
|
||||
populate(self._cmdVars, group, name, v)
|
||||
|
||||
# For updating output attributes invalidation values
|
||||
cmdVarsNoCache = self._cmdVars.copy()
|
||||
|
@ -476,14 +477,9 @@ class BaseNode(BaseObject):
|
|||
continue # skip inputs
|
||||
attr.value = attr.attributeDesc.value.format(**self._cmdVars)
|
||||
attr._invalidationValue = attr.attributeDesc.value.format(**cmdVarsNoCache)
|
||||
v = attr.getValueStr()
|
||||
|
||||
self._cmdVars[name] = '--{name} {value}'.format(name=name, value=v)
|
||||
self._cmdVars[name + 'Value'] = str(v)
|
||||
|
||||
if v:
|
||||
self._cmdVars[attr.attributeDesc.group] = self._cmdVars.get(attr.attributeDesc.group, '') + \
|
||||
' ' + self._cmdVars[name]
|
||||
group_name_values = attr.format()
|
||||
for group, name, v in group_name_values:
|
||||
populate(self._cmdVars, group, name, v)
|
||||
|
||||
@property
|
||||
def isParallelized(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue