コード例 #1
0
        private static void DuplicateNode(NodeEditorInputInfo inputInfo)
        {
            inputInfo.SetAsCurrentEnvironment();
            NodeEditorState state = inputInfo.editorState;

            if (state.focusedNode != null && NodeEditor.curNodeCanvas.CanAddNode(state.focusedNode.GetID))
            {             // Create new node of same type
                Node duplicatedNode = Node.CreateCopy(state.focusedNode, NodeEditor.ScreenToCanvasSpace(inputInfo.inputPos), state.connectKnob, false);
                state.selectedNode = state.focusedNode = duplicatedNode;
                state.connectKnob  = null;
                inputInfo.inputEvent.Use();
            }
        }