[ui] Node: fix slowness due to QML function calls with a lot of nodes

Instead of calling the duplicateList function for each node, at each modification, it is called only when we press the button.
This commit is contained in:
Julien-Haudegond 2020-08-13 11:45:52 +02:00
parent 02b9e34ba4
commit d838e7866a
2 changed files with 8 additions and 5 deletions

View file

@ -868,12 +868,12 @@ class BaseNode(BaseObject):
def updateDuplicates(self, nodesPerUid):
""" Update the list of duplicate nodes (sharing the same uid). """
if not nodesPerUid:
uid = self._uids.get(0)
if not nodesPerUid or not uid:
self._duplicates.clear()
self.duplicatesChanged.emit()
return
uid = self._uids.get(0)
self._duplicates.setObjectList([node for node in nodesPerUid.get(uid) if node != self])
self.duplicatesChanged.emit()