mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-19 09:37:14 +02:00
[core] Propagate Attribute.valueChanged to the owning Node through a Slot
Connecting the valueChanged signal to a lambda causes performance issues with a large number of attributes when using the Pyside backend. Connecting that signal to an intermediate Slot part of the Attribute class improves performance dramatically. Note: This has no comparable impact on the standalone backend.
This commit is contained in:
parent
910736b3d7
commit
37a813e08a
1 changed files with 10 additions and 1 deletions
|
@ -31,7 +31,12 @@ def attributeFactory(description, value, isOutput, node, root=None, parent=None)
|
||||||
else:
|
else:
|
||||||
attr.resetToDefaultValue()
|
attr.resetToDefaultValue()
|
||||||
|
|
||||||
attr.valueChanged.connect(lambda attr=attr: node._onAttributeChanged(attr))
|
# Only connect slot that reacts to value change once initial value has been set.
|
||||||
|
# NOTE: This should be handled by the Node class, but we're currently limited by our core
|
||||||
|
# signal implementation that does not support emitting parameters.
|
||||||
|
# And using a lambda here to send the attribute as a parameter causes
|
||||||
|
# performance issues when using the pyside backend.
|
||||||
|
attr.valueChanged.connect(attr._onValueChanged)
|
||||||
|
|
||||||
return attr
|
return attr
|
||||||
|
|
||||||
|
@ -213,6 +218,10 @@ class Attribute(BaseObject):
|
||||||
self.valueChanged.emit()
|
self.valueChanged.emit()
|
||||||
self.validValueChanged.emit()
|
self.validValueChanged.emit()
|
||||||
|
|
||||||
|
@Slot()
|
||||||
|
def _onValueChanged(self):
|
||||||
|
self.node._onAttributeChanged(self)
|
||||||
|
|
||||||
def _set_label(self, label):
|
def _set_label(self, label):
|
||||||
if self._label == label:
|
if self._label == label:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue