private static void DeleteNode(NodeEditorInputInfo inputInfo) { inputInfo.SetAsCurrentEnvironment(); if (inputInfo.editorState.focusedNode != null) { inputInfo.editorState.focusedNode.Delete(); inputInfo.inputEvent.Use(); } }
private static void DuplicateNode(NodeEditorInputInfo inputInfo) { inputInfo.SetAsCurrentEnvironment(); NodeEditorState state = inputInfo.editorState; if (state.focusedNode != null) { Node duplicatedNode = Node.Create(state.focusedNode.GetID, NodeEditor.ScreenToCanvasSpace(inputInfo.inputPos), state.connectOutput); state.selectedNode = state.focusedNode = duplicatedNode; state.connectOutput = null; inputInfo.inputEvent.Use(); } }
private static void CreateNodeCallback(object infoObj) { NodeEditorInputInfo callback = infoObj as NodeEditorInputInfo; if (callback == null) { throw new UnityException("Callback Object passed by context is not of type NodeEditorInputInfo!"); } callback.SetAsCurrentEnvironment(); Node.Create(callback.message, NodeEditor.ScreenToCanvasSpace(callback.inputPos), callback.editorState.connectOutput); callback.editorState.connectOutput = null; NodeEditor.RepaintClients(); }