Skip to content

Commit 601fbc5

Browse files
authored
Merge pull request #2428 from alicevision/fix/outputExportAnimatedCamera
[nodes] Fix outputImages if no export in ExportAnimatedCamera
2 parents 7c66aa9 + 7bc07bd commit 601fbc5

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

meshroom/core/node.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -750,18 +750,20 @@ def _buildAttributeCmdVars(cmdVars, name, attr):
750750
# Apply expressions for File attributes
751751
if attr.attributeDesc.isExpression:
752752
defaultValue = ""
753-
try:
754-
defaultValue = attr.defaultValue()
755-
except AttributeError as e:
756-
# If we load an old scene, the lambda associated to the 'value' could try to access other params that could not exist yet
757-
logging.warning('Invalid lambda evaluation for "{nodeName}.{attrName}"'.format(nodeName=self.name, attrName=attr.name))
758-
try:
759-
attr.value = defaultValue.format(**self._cmdVars)
760-
attr._invalidationValue = defaultValue.format(**cmdVarsNoCache)
761-
except KeyError as e:
762-
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)))
763-
except ValueError as e:
764-
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)))
753+
# Do not evaluate expression for disabled attributes (the expression may refer to other attributes that are not defined)
754+
if attr.enabled:
755+
try:
756+
defaultValue = attr.defaultValue()
757+
except AttributeError as e:
758+
# If we load an old scene, the lambda associated to the 'value' could try to access other params that could not exist yet
759+
logging.warning('Invalid lambda evaluation for "{nodeName}.{attrName}"'.format(nodeName=self.name, attrName=attr.name))
760+
try:
761+
attr.value = defaultValue.format(**self._cmdVars)
762+
attr._invalidationValue = defaultValue.format(**cmdVarsNoCache)
763+
except KeyError as e:
764+
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)))
765+
except ValueError as e:
766+
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)))
765767

766768
v = attr.getValueStr(withQuotes=True)
767769

meshroom/nodes/aliceVision/ExportAnimatedCamera.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ class ExportAnimatedCamera(desc.AVCommandLineNode):
120120
value=desc.Node.internalFolder + "undistort/" + "<INTRINSIC_ID>_<FILESTEM>.{undistortedImageTypeValue}",
121121
semantic="image",
122122
group="", # exclude from command line
123+
enabled=lambda node: node.exportUndistortedImages.value,
123124
uid=[],
124125
),
125126
]

tests/test_multiviewPipeline.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_multiviewPipeline():
8181
for node in graph1.nodes:
8282
otherNode = otherGraph.node(node.name)
8383
for key, attr in node.attributes.items():
84-
if attr.isOutput:
84+
if attr.isOutput and attr.enabled:
8585
otherAttr = otherNode.attribute(key)
8686
assert attr.uid() != otherAttr.uid()
8787

@@ -91,7 +91,7 @@ def test_multiviewPipeline():
9191
otherNode = graph2b.node(node.name)
9292
for key, attr in node.attributes.items():
9393
otherAttr = otherNode.attribute(key)
94-
if attr.isOutput:
94+
if attr.isOutput and attr.enabled:
9595
assert attr.uid() == otherAttr.uid()
9696
else:
9797
for uidIndex in attr.desc.uid:
@@ -103,7 +103,7 @@ def test_multiviewPipeline():
103103
otherNode = graph4b.node(node.name)
104104
for key, attr in node.attributes.items():
105105
otherAttr = otherNode.attribute(key)
106-
if attr.isOutput:
106+
if attr.isOutput and attr.enabled:
107107
assert attr.uid() == otherAttr.uid()
108108
else:
109109
for uidIndex in attr.desc.uid:

0 commit comments

Comments
 (0)