Example #1
0
        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();
        }
Example #2
0
        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();
            }
        }
Example #3
0
        private static void HandleFocussing(NodeEditorInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.editorState;

            state.focusedNode = NodeEditor.NodeAtPosition(NodeEditor.ScreenToCanvasSpace(inputInfo.inputPos), out state.focusedNodeKnob);

            if (unfocusControlsForState == state && Event.current.type == EventType.Repaint)
            {
                GUIUtility.hotControl      = 0;
                GUIUtility.keyboardControl = 0;
                unfocusControlsForState    = null;
            }
        }