def destructionNodes(self): """ Deletes the current node(s). """ buttleData = ButtleDataSingleton().get() # if the params of the current node deleted are display if buttleData.getCurrentParamNodeName() in buttleData.getCurrentSelectedNodeNames(): buttleData.setCurrentParamNodeName(None) # if the viewer of the current node deleted is display if buttleData.getCurrentViewerNodeName() in buttleData.getCurrentSelectedNodeNames(): buttleData.setCurrentViewerNodeName(None) # if the viewer display a node affected by the destruction # need something from Tuttle # if at least one node in the graph if len(buttleData.getGraphWrapper().getNodeWrappers()) > 0 and len(buttleData.getGraph().getNodes()) > 0: # if a node is selected if buttleData.getCurrentSelectedNodeNames() != []: buttleData.getGraph().deleteNodes([nodeWrapper.getNode() for nodeWrapper in buttleData.getCurrentSelectedNodeWrappers()]) buttleData.clearCurrentSelectedNodeNames() # emit signals buttleData.currentParamNodeChanged.emit() buttleData.currentViewerNodeChanged.emit() buttleData.currentSelectedNodesChanged.emit() # update undo/redo display self.undoRedoChanged()
def cutNode(self): """ Cuts the current node(s). """ # Call the copyNode function to save the data of the selected nodes self.copyNode() buttleData = ButtleDataSingleton().get() # If we are sure that at least one node is selected if buttleData.getCurrentSelectedNodeWrappers() != []: for node in buttleData.getCurrentSelectedNodeWrappers(): # We precise that we want to cut the node and not only copy it buttleData.getCurrentCopiedNodesInfo()[node.getName()].update({"mode": ""}) # And we delete it self.destructionNodes() # And update the view if necessary if buttleData.getCurrentViewerNodeName() in buttleData.getCurrentSelectedNodeNames(): buttleData.setCurrentViewerNodeName(None) if buttleData.getCurrentParamNodeName() in buttleData.getCurrentSelectedNodeNames(): buttleData.setCurrentParamNodeName(None) # Emit the change for the toolbar buttleData.pastePossibilityChanged.emit()
def cutNode(self): """ Cuts the current node(s). """ # Call the copyNode function to save the data of the selected nodes self.copyNode() buttleData = ButtleDataSingleton().get() # If we are sure that at least one node is selected if buttleData.getCurrentSelectedNodeWrappers() != []: for node in buttleData.getCurrentSelectedNodeWrappers(): # We precise that we want to cut the node and not only copy it buttleData.getCurrentCopiedNodesInfo()[node.getName()].update( {"mode": ""}) # And we delete it self.destructionNodes() # And update the view if necessary if buttleData.getCurrentViewerNodeName( ) in buttleData.getCurrentSelectedNodeNames(): buttleData.setCurrentViewerNodeName(None) if buttleData.getCurrentParamNodeName( ) in buttleData.getCurrentSelectedNodeNames(): buttleData.setCurrentParamNodeName(None) # Emit the change for the toolbar buttleData.pastePossibilityChanged.emit()
def destructionNodes(self): """ Deletes the current node(s). """ buttleData = ButtleDataSingleton().get() # if the params of the current node deleted are display if buttleData.getCurrentParamNodeName( ) in buttleData.getCurrentSelectedNodeNames(): buttleData.setCurrentParamNodeName(None) # if the viewer of the current node deleted is display if buttleData.getCurrentViewerNodeName( ) in buttleData.getCurrentSelectedNodeNames(): buttleData.setCurrentViewerNodeName(None) # if the viewer display a node affected by the destruction # need something from Tuttle # if at least one node in the graph if len(buttleData.getGraphWrapper().getNodeWrappers()) > 0 and len( buttleData.getGraph().getNodes()) > 0: # if a node is selected if buttleData.getCurrentSelectedNodeNames() != []: buttleData.getGraph().deleteNodes([ nodeWrapper.getNode() for nodeWrapper in buttleData.getCurrentSelectedNodeWrappers() ]) buttleData.clearCurrentSelectedNodeNames() # emit signals buttleData.currentParamNodeChanged.emit() buttleData.currentViewerNodeChanged.emit() buttleData.currentSelectedNodesChanged.emit() # update undo/redo display self.undoRedoChanged()