Merge pull request #2428 from alicevision/fix/outputExportAnimatedCamera

[nodes] Fix outputImages if no export in ExportAnimatedCamera
This commit is contained in:
Fabien Castan 2024-06-07 19:13:23 +02:00 committed by GitHub
commit 601fbc53f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 18 additions and 15 deletions

View file

@ -750,18 +750,20 @@ class BaseNode(BaseObject):
# Apply expressions for File attributes
if attr.attributeDesc.isExpression:
defaultValue = ""
try:
defaultValue = attr.defaultValue()
except AttributeError as e:
# If we load an old scene, the lambda associated to the 'value' could try to access other params that could not exist yet
logging.warning('Invalid lambda evaluation for "{nodeName}.{attrName}"'.format(nodeName=self.name, attrName=attr.name))
try:
attr.value = defaultValue.format(**self._cmdVars)
attr._invalidationValue = defaultValue.format(**cmdVarsNoCache)
except KeyError as e:
logging.warning('Invalid expression with missing key on "{nodeName}.{attrName}" with value "{defaultValue}".\nError: {err}'.format(nodeName=self.name, attrName=attr.name, defaultValue=defaultValue, err=str(e)))
except ValueError as e:
logging.warning('Invalid expression value on "{nodeName}.{attrName}" with value "{defaultValue}".\nError: {err}'.format(nodeName=self.name, attrName=attr.name, defaultValue=defaultValue, err=str(e)))
# Do not evaluate expression for disabled attributes (the expression may refer to other attributes that are not defined)
if attr.enabled:
try:
defaultValue = attr.defaultValue()
except AttributeError as e:
# If we load an old scene, the lambda associated to the 'value' could try to access other params that could not exist yet
logging.warning('Invalid lambda evaluation for "{nodeName}.{attrName}"'.format(nodeName=self.name, attrName=attr.name))
try:
attr.value = defaultValue.format(**self._cmdVars)
attr._invalidationValue = defaultValue.format(**cmdVarsNoCache)
except KeyError as e:
logging.warning('Invalid expression with missing key on "{nodeName}.{attrName}" with value "{defaultValue}".\nError: {err}'.format(nodeName=self.name, attrName=attr.name, defaultValue=defaultValue, err=str(e)))
except ValueError as e:
logging.warning('Invalid expression value on "{nodeName}.{attrName}" with value "{defaultValue}".\nError: {err}'.format(nodeName=self.name, attrName=attr.name, defaultValue=defaultValue, err=str(e)))
v = attr.getValueStr(withQuotes=True)

View file

@ -120,6 +120,7 @@ Based on the input image filenames, it will recognize the input video sequence t
value=desc.Node.internalFolder + "undistort/" + "<INTRINSIC_ID>_<FILESTEM>.{undistortedImageTypeValue}",
semantic="image",
group="", # exclude from command line
enabled=lambda node: node.exportUndistortedImages.value,
uid=[],
),
]

View file

@ -81,7 +81,7 @@ def test_multiviewPipeline():
for node in graph1.nodes:
otherNode = otherGraph.node(node.name)
for key, attr in node.attributes.items():
if attr.isOutput:
if attr.isOutput and attr.enabled:
otherAttr = otherNode.attribute(key)
assert attr.uid() != otherAttr.uid()
@ -91,7 +91,7 @@ def test_multiviewPipeline():
otherNode = graph2b.node(node.name)
for key, attr in node.attributes.items():
otherAttr = otherNode.attribute(key)
if attr.isOutput:
if attr.isOutput and attr.enabled:
assert attr.uid() == otherAttr.uid()
else:
for uidIndex in attr.desc.uid:
@ -103,7 +103,7 @@ def test_multiviewPipeline():
otherNode = graph4b.node(node.name)
for key, attr in node.attributes.items():
otherAttr = otherNode.attribute(key)
if attr.isOutput:
if attr.isOutput and attr.enabled:
assert attr.uid() == otherAttr.uid()
else:
for uidIndex in attr.desc.uid: