I do notice, however, an undesireable behaviour with copy/paste… If I select a tool and do ctrl+C, ctrl+V, the orignal and the new tool are both selected and overlap. This could make them difficult to use. If the old tool was deselected, or if the new tool was offset so as to not overlap, this would be better.
As for the copy and paste, when I copy and paste, the new nodes come centered around the mouse cursor, so they never overlap with the original ones. But the original nodes remain selected. So I will remove the selection before pasting in order to leave only the pasted ones selected… Thanks for the suggestion!
Fixed the crash on pasting an InputTexmap, it could have affected the Undo buffer too.
Fixed the pasting to reset the selection first. Also it was missing Undo record, now it creates one that says “Pasted N Nodes From Clipboard”.
I had to add proper handling for restoring the texture map if it is found in the scene (usually it is because we are cloning, but the same applies to loading a file or loading the undo buffer, so sometimes it might not be there).
Here is what the new emitted code for an InputTexmap copy&paste looks like:
[code](–MAGMAFLOW2–
global MagmaFlowEditor_EditBLOPHistory = #()
node2 = magmaNode.createNode “InputTexmap”
magmaNode.setNumNodeInputs node2 0
magmaNode.setNumNodeOutputs node2 1
magmaNode.setNodeProperty node2 “resultType” “Color”
try(theMaps = getClassInstances Dent
for m in theMaps where m.name == “Map #4” do magmaNode.setNodeProperty node2 “texmap” m)catch()
magmaNode.setNodeProperty node2 “channels” “”
magmaNode.DeclareExtensionProperty node2 “Position”
magmaNode.SetNodeProperty node2 “Position” [760,270]
magmaNode.DeclareExtensionProperty node2 “Selected”
magmaNode.SetNodeProperty node2 “Selected” true
)[/code]
So if it fails to find a texture of the same class and with the same name, the InputTexmap will end up without a map in the flow, but it won’t crash.