Skip to content

Commit c9f05d7

Browse files
[ui] GroupAttribute: The attribute structure check is now done recursivively to check nested GroupAttributes
1 parent bcabb5b commit c9f05d7

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

meshroom/core/attribute.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,10 +881,21 @@ def _get_value(self):
881881
if not linkedParam:
882882
return self._value
883883

884+
def linkAttributesValues(srcAttr, dstAttr):
885+
886+
for i, attrDesc in enumerate(dstAttr.desc._groupDesc):
887+
linkedAttrDesc = srcAttr.desc._groupDesc[i]
888+
889+
subSrcAttr = srcAttr._value.get(linkedAttrDesc.name)
890+
subDstAttr = dstAttr._value.get(attrDesc.name)
891+
892+
if isinstance(linkedAttrDesc, desc.GroupAttribute) and isinstance(attrDesc, desc.GroupAttribute):
893+
linkAttributesValues(subSrcAttr, subDstAttr)
894+
else:
895+
subDstAttr.value = subSrcAttr.value
896+
884897
# If linked, the driver attributes values are copied to the current attribute
885-
for i, attrDesc in enumerate(self.desc._groupDesc):
886-
linkedAttrDesc = linkedParam.desc._groupDesc[i]
887-
self._value.get(attrDesc.name).value = linkedParam._value.get(linkedAttrDesc.name).value
898+
linkAttributesValues(linkedParam, self)
888899

889900
return self._value
890901

@@ -1036,7 +1047,9 @@ def _haveSameStructure(self, otherAttribute: "Attribute") -> bool:
10361047
return False
10371048

10381049
for i, attr in enumerate(self._value):
1039-
if attr.baseType != otherAttribute._value[i].baseType:
1050+
if isinstance(attr, GroupAttribute):
1051+
return attr._haveSameStructure(otherAttribute._value[i])
1052+
elif attr.baseType != otherAttribute._value[i].baseType:
10401053
return False
10411054

10421055
return True

0 commit comments

Comments
 (0)