[core] Raise compatibility issue if nodes miss invalidating internal attributes

This commit is contained in:
Candice Bentéjac 2022-11-18 18:01:48 +01:00
parent b470078667
commit 7688b94ce5
2 changed files with 15 additions and 1 deletions

View file

@ -1597,6 +1597,19 @@ def nodeFactory(nodeDict, name=None, template=False):
sorted([attr.name for attr in nodeDesc.outputs]) != sorted(outputs.keys())):
compatibilityIssue = CompatibilityIssue.DescriptionConflict
# check whether there are any internal attributes that are invalidating in the node description: if there
# are, then check that these internal attributes are part of nodeDict; if they are not, a compatibility
# issue must be raised to warn the user, as this will automatically change the node's UID
if not template:
invalidatingIntInputs = []
for attr in nodeDesc.internalInputs:
if attr.uid == [0]:
invalidatingIntInputs.append(attr.name)
for attr in invalidatingIntInputs:
if attr not in internalInputs.keys():
compatibilityIssue = CompatibilityIssue.DescriptionConflict
break
# verify that all inputs match their descriptions
for attrName, value in inputs.items():
if not CompatibilityNode.attributeDescFromName(nodeDesc.inputs, attrName, value):

View file

@ -710,7 +710,8 @@ class UIGraph(QObject):
""" Upgrade all upgradable CompatibilityNode instances in the graph. """
with self.groupedGraphModification("Upgrade all Nodes"):
nodes = [n for n in self._graph._compatibilityNodes.values() if n.canUpgrade]
for node in nodes:
sortedNodes = sorted(nodes, key=lambda x: x.name)
for node in sortedNodes:
self.upgradeNode(node)
@Slot()