def __onNodeRemoved(self, node): node.getComponent().detach() if not UndoRedoManager.getInstance().isUndoingOrRedoing(): command = graph_commands.RemoveNodeCommand(self.graphView, self.guideRig, node) UndoRedoManager.getInstance().addCommand(command)
def __onSelectionMoved(self, nodes, delta): for node in nodes: node.pushGraphPosToComponent() if not UndoRedoManager.getInstance().isUndoingOrRedoing(): command = graph_commands.NodesMoveCommand(self.graphView, nodes, delta) UndoRedoManager.getInstance().addCommand(command)
def __onNodeRemoved(self, node): if type(node).__name__ != 'KBackdrop': node.getComponent().detach() if not UndoRedoManager.getInstance().isUndoingOrRedoing(): command = graph_commands.RemoveNodeCommand(self.graphView, self.guideRig, node) UndoRedoManager.getInstance().addCommand(command)
def _invokeSetter(self, value = None): if self._updatingWidget: return interactionInProgress = self.__interactionInProgress if not interactionInProgress: self.beginInteraction() self._firingSetter = True # some value changes, such as resizing arrays, requires that the widget be re-built. # in those cases, we should provide the value to the setter. # if value is None: # For now this is disabled, because we always want to set an RTVal on the attribute. # (getWidgetValue should now always return an RTVal) value = self.getWidgetValue() command = ValueChangeCommand(self._attribute, self, value) UndoRedoManager.getInstance().addCommand(command, invokeRedoOnAdd=True) self._firingSetter = False if not interactionInProgress: self.endInteraction()
def _invokeSetter(self, value=None): if self._updatingWidget: return interactionInProgress = self.__interactionInProgress if not interactionInProgress: self.beginInteraction() self._firingSetter = True # some value changes, such as resizing arrays, requires that the widget be re-built. # in those cases, we should provide the value to the setter. # if value is None: # For now this is disabled, because we always want to set an RTVal on the attribute. # (getWidgetValue should now always return an RTVal) value = self.getWidgetValue() command = ValueChangeCommand(self._attribute, self, value) UndoRedoManager.getInstance().addCommand(command, invokeRedoOnAdd=True) self._firingSetter = False if not interactionInProgress: self.endInteraction()
def __onBeginConnectionManipulation(self): UndoRedoManager.getInstance().openBracket('Connect Ports')
def beginInteraction(self): UndoRedoManager.getInstance().openBracket(self._attribute.getName() + " changed") self.__interactionInProgress = True
def endInteraction(self): self.__interactionInProgress = False UndoRedoManager.getInstance().closeBracket()
def __onBeginDeleteSelection(self): UndoRedoManager.getInstance().openBracket('Delete Nodes')
def __onEndDeleteSelection(self): UndoRedoManager.getInstance().closeBracket()
def __onSelectionChanged(self, deselectedNodes, selectedNodes): if not UndoRedoManager.getInstance().isUndoingOrRedoing(): command = graph_commands.SelectionChangeCommand(self.graphView, deselectedNodes, selectedNodes) UndoRedoManager.getInstance().addCommand(command)
def __onSelectionMoved(self, nodes, delta): if not UndoRedoManager.getInstance().isUndoingOrRedoing(): command = graph_commands.NodesMoveCommand(self.graphView, nodes, delta) UndoRedoManager.getInstance().addCommand(command)
def __onEndConnectionManipulationSignal(self): UndoRedoManager.getInstance().closeBracket()
def __onConnectionRemoved(self, connection): if not UndoRedoManager.getInstance().isUndoingOrRedoing(): command = graph_commands.ConnectionRemovedCommand(self.graphView, self.guideRig, connection) UndoRedoManager.getInstance().addCommand(command)
def __onNodeAdded(self, node): if not UndoRedoManager.getInstance().isUndoingOrRedoing(): command = graph_commands.AddNodeCommand(self.graphView, self.guideRig, node) UndoRedoManager.getInstance().addCommand(command)
def redo(self): UndoRedoManager.getInstance().redo()
def undo(self): UndoRedoManager.getInstance().undo()