[core] Handle attribute valueChanged callback at the Node level

Move the attributeChanged callback logic within Node, as this
is a Node level mecanism (callbacks being declared on the node desc).

This commit also moves the attribute valueChanged signal outside of
the Attribute's constructor.
This seems to be the root cause to undesired side-effects breaking Qt's evaluation
system, data model access and consequently Meshroom's UI.
This commit is contained in:
Yann Lanthony 2024-10-25 19:12:21 +02:00
parent e73e8f2fd7
commit 7fdb5cc734
2 changed files with 35 additions and 15 deletions

View file

@ -25,11 +25,14 @@ def attributeFactory(description, value, isOutput, node, root=None, parent=None)
root: (optional) parent Attribute (must be ListAttribute or GroupAttribute)
parent (BaseObject): (optional) the parent BaseObject if any
"""
attr = description.instanceType(node, description, isOutput, root, parent)
attr: Attribute = description.instanceType(node, description, isOutput, root, parent)
if value is not None:
attr._set_value(value, emitSignals=False)
else:
attr.resetToDefaultValue(emitSignals=False)
attr.valueChanged.connect(lambda attr=attr: node._onAttributeChanged(attr))
return attr
@ -67,7 +70,6 @@ class Attribute(BaseObject):
self._value = None
self.initValue()
self.valueChanged.connect(self.onChanged)
@property
def node(self):