From 55d30ee1e38ce271ccdf8a4542fdc4a28f19482a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Wed, 7 Jun 2023 11:28:49 +0200 Subject: [PATCH] [core] Add the node's type in the UID computation This prevents getting the same UID for two nodes which are of different types but have an identical list of attributes. --- meshroom/core/node.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/meshroom/core/node.py b/meshroom/core/node.py index 7e5999f606..b611d16ae9 100644 --- a/meshroom/core/node.py +++ b/meshroom/core/node.py @@ -685,11 +685,15 @@ def toDict(self): pass def _computeUids(self): - """ Compute node uids by combining associated attributes' uids. """ + """ Compute node UIDs by combining associated attributes' UIDs. """ + # Get all the attributes associated to a given UID index, specified in node descriptions with "uid=[index]" + # 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 + # 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.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) self._uids[uidIndex] = hashValue(uidAttributes) def _buildCmdVars(self):