[core] Graph: avoid double update while adding/removing an edge

Graph.markNodesDirty() is called in three different places:
- Attribute.requestGraphUpdate()
- Graph.addEdge()
- Graph.removeEdge()

However, addEdge() and removeEdge() are especially decorated to request a graph update so, with the old markNodesDirty() implementation, the update was done twice in a row.
This commit is contained in:
Julien-Haudegond 2020-08-27 17:16:40 +02:00
parent 06b821349f
commit 74fa3022fe
2 changed files with 2 additions and 2 deletions

View file

@ -142,6 +142,7 @@ class Attribute(BaseObject):
def requestGraphUpdate(self):
if self.node.graph:
self.node.graph.markNodesDirty(self.node)
self.node.graph.update()
@property
def isOutput(self):

View file

@ -1059,7 +1059,7 @@ class Graph(BaseObject):
def markNodesDirty(self, fromNode):
"""
Mark all nodes following 'fromNode' as dirty, and request a graph update.
Mark all nodes following 'fromNode' as dirty.
All nodes marked as dirty will get their outputs to be re-evaluated
during the next graph update.
@ -1072,7 +1072,6 @@ class Graph(BaseObject):
nodes, edges = self.nodesFromNode(fromNode)
for node in nodes:
node.dirty = True
self.update()
def stopExecution(self):
""" Request graph execution to be stopped by terminating running chunks"""