From cc6f75f2d49d74d9902f71254abba2e51c56c833 Mon Sep 17 00:00:00 2001 From: Fabien Castan Date: Sun, 16 Jun 2024 19:05:03 +0200 Subject: [PATCH] [core] update UID computation to take into account the particular case of dynamic output attributes For dynamic output attributes, the UID does not depend on the attribute value. In particular, when loading a project file, the UIDs are updated first, and the node status and the dynamic output values are not yet loaded, so we should not read the attribute value. --- meshroom/core/node.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/meshroom/core/node.py b/meshroom/core/node.py index 4d0cb069..fddb76b9 100644 --- a/meshroom/core/node.py +++ b/meshroom/core/node.py @@ -705,7 +705,18 @@ class BaseNode(BaseObject): # For now, the only index that is used is "0", so there will be a single iteration of the loop below for uidIndex, associatedAttributes in self.attributesPerUid.items(): # UID is computed by hashing the sorted list of tuple (name, value) of all attributes impacting this UID - uidAttributes = [(a.getName(), a.uid(uidIndex)) for a in associatedAttributes if a.enabled and a.value != a.uidIgnoreValue] + uidAttributes = [] + for a in associatedAttributes: + if not a.enabled: + continue # disabled params do not contribute to the uid + dynamicOutputAttr = a.isLink and a.getLinkParam(recursive=True).desc.isDynamicValue + # For dynamic output attributes, the UID does not depend on the attribute value. + # In particular, when loading a project file, the UIDs are updated first, + # and the node status and the dynamic output values are not yet loaded, + # so we should not read the attribute value. + if not dynamicOutputAttr and a.value == a.uidIgnoreValue: + continue # for non-dynamic attributes, check if the value should be ignored + uidAttributes.append((a.getName(), a.uid(uidIndex))) uidAttributes.sort() # Adding the node type prevents ending up with two identical UIDs for different node types that have the exact same list of attributes uidAttributes.append(self.nodeType)