Add "label" as an internal attribute

Setting the "label" internal attribute allows to give a custom
label to replace the node's default label.
This commit is contained in:
Candice Bentéjac 2022-08-02 12:36:11 +02:00
parent 9bc9e2c129
commit 330382ab0c
4 changed files with 31 additions and 1 deletions

View file

@ -168,6 +168,10 @@ class Attribute(BaseObject):
# TODO: only update the graph if this attribute participates to a UID
if self.isInput:
self.requestGraphUpdate()
# TODO: only call update of the node if the attribute is internal
# Internal attributes are set as inputs
self.requestNodeUpdate()
self.valueChanged.emit()
def upgradeValue(self, exportedValue):
@ -181,6 +185,12 @@ class Attribute(BaseObject):
self.node.graph.markNodesDirty(self.node)
self.node.graph.update()
def requestNodeUpdate(self):
# Update specific node information that do not affect the rest of the graph
# (like internal attributes)
if self.node:
self.node.updateInternalAttributes()
@property
def isOutput(self):
return self._isOutput