[commands] add GraphModification on RemoveNode.undo

Avoid multiple graph updates on node/edges creation
This commit is contained in:
Yann Lanthony 2017-11-28 22:37:48 +01:00
parent 1a6febb02e
commit 06303c5773

View file

@ -4,7 +4,7 @@ from contextlib import contextmanager
from PySide2.QtWidgets import QUndoCommand, QUndoStack
from PySide2.QtCore import Property, Signal
from meshroom.core.graph import Node, ListAttribute, Graph
from meshroom.core.graph import Node, ListAttribute, Graph, GraphModification
class UndoCommand(QUndoCommand):
@ -112,6 +112,7 @@ class RemoveNodeCommand(GraphCommand):
return True
def undoImpl(self):
with GraphModification(self.graph):
node = self.graph.addNode(Node(nodeDesc=self.nodeDict["nodeType"],
**self.nodeDict["attributes"]
), self.nodeName)