Skip to content

Commit

Permalink
[core] Graph: account for specialized GroupAttribute in nodeCopy
Browse files Browse the repository at this point in the history
GroupAttribute subclasses can override their `value` property to return the value
of a child attribute.
The `nodeCopy` method needs to evaluate the group's actual value.
Therefore, make sure to access the GroupAttribute's internal value and not an overriden
one.
  • Loading branch information
yann-lty committed Jan 29, 2025
1 parent 58c13aa commit 70546c7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions meshroom/core/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,13 +599,19 @@ def copyNode(self, srcNode, withEdges=False):
# edges are declared in input with an expression linking
# to another param (which could be an output)
continue
value = attr.value
if isinstance(attr, GroupAttribute):
# GroupAttribute subclasses can override their `value` property to return the value
# of a child attribute. Here, we need to evaluate the group's value, hence
# the use of GroupAttribute's `value` getter.
value = GroupAttribute.value.fget(attr)
# find top-level links
if Attribute.isLinkExpression(attr.value):
skippedEdges[attr] = attr.value
if Attribute.isLinkExpression(value):
skippedEdges[attr] = value
attr.resetToDefaultValue()
# find links in ListAttribute children
elif isinstance(attr, (ListAttribute, GroupAttribute)):
for child in attr.value:
for child in value:
if Attribute.isLinkExpression(child.value):
skippedEdges[child] = child.value
child.resetToDefaultValue()
Expand Down

0 comments on commit 70546c7

Please sign in to comment.