mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-19 03:56:26 +02:00
Add node to graph with Ctrl+V if valid node content is in the clipboard
Attempt to paste the clipboard's content in the graph when Ctrl+V is pressed. If the clipboard contains a valid node description, add the corresponding node to the graph. Otherwise, do nothing.
This commit is contained in:
parent
751bad96c6
commit
ddda62a652
5 changed files with 80 additions and 0 deletions
|
@ -195,6 +195,26 @@ class DuplicateNodesCommand(GraphCommand):
|
|||
self.graph.removeNode(duplicate)
|
||||
|
||||
|
||||
class PasteNodeCommand(GraphCommand):
|
||||
"""
|
||||
Handle node pasting in a Graph.
|
||||
"""
|
||||
def __init__(self, graph, nodeType, parent=None, **kwargs):
|
||||
super(PasteNodeCommand, self).__init__(graph, parent)
|
||||
self.nodeType = nodeType
|
||||
self.nodeName = None
|
||||
self.kwargs = kwargs
|
||||
|
||||
def redoImpl(self):
|
||||
node = self.graph.pasteNode(self.nodeType, **self.kwargs)
|
||||
self.nodeName = node.name
|
||||
self.setText("Paste Node {}".format(self.nodeName))
|
||||
return node
|
||||
|
||||
def undoImpl(self):
|
||||
self.graph.removeNode(self.nodeName)
|
||||
|
||||
|
||||
class SetAttributeCommand(GraphCommand):
|
||||
def __init__(self, graph, attribute, value, parent=None):
|
||||
super(SetAttributeCommand, self).__init__(graph, parent)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue