private static void HandleCheckFocus(NodeInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.EdState;

            state.FocusNode = inputInfo.Graph.CheckFocus(inputInfo.InputPos);
            state.FocusKnob = inputInfo.Graph.CheckFocusKnob(inputInfo.InputPos);
            state.MousePos  = inputInfo.InputPos;
        }
        private static void SelectedPanelMouseDrag(NodeInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.EdState;

            if (inputInfo.InputEvent.modifiers == EventModifiers.Alt)
            {
                state.selectedPanelNodesEndPos = inputInfo.InputPos;
            }
        }
Esempio n. 3
0
        public static void Load(string path)
        {
#if UNITY_EDITOR
            var graph = AssetDatabase.LoadAssetAtPath <NodeGraph>(path);
            curNodeEditorState = graph.curNodeState;
            curNodeGraph       = graph;
            CurNodeInputInfo   = new NodeInputInfo("Two", curNodeGraph);
#endif
        }
        private static void HandleKnobMouseDrag(NodeInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.EdState;

            if (inputInfo.InputPos.x < 0 || inputInfo.InputPos.y < 0 || state.SelectedKnob == null)
            {
                return;
            }
        }
        private static void SelectedPanelMouseDragCheck(NodeInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.EdState;

            if (inputInfo.InputEvent.modifiers != EventModifiers.Alt)
            {
                state.IsSelectedPanelNodes = false;
            }
        }
        private static void HandleWindowPineUp(NodeInputInfo inputInfo)
        {
            if (inputInfo.InputPos.x < 0 || inputInfo.InputPos.y < 0)
            {
                return;
            }
            NodeEditorState state = inputInfo.EdState;

            state.IsPineSetting = false;
        }
        private static void HandleKnobMouseDown(NodeInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.EdState;

            if (inputInfo.InputEvent.button == 0 && state.FocusKnob != null)
            {
                state.SelectedKnob  = state.FocusKnob;
                state.IsLinkSetting = true;
            }
        }
        private static void SelectedPanelMouseDown(NodeInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.EdState;

            if (inputInfo.InputEvent.modifiers == EventModifiers.Alt)
            {
                state.IsSelectedPanelNodes = true;
                state.SelectedNodes.Clear();
                state.selectedPanelNodesStartPos = inputInfo.InputPos;
            }
        }
Esempio n. 9
0
        public static void CreateNew()
        {
#if UNITY_EDITOR
            string path = EditorUtility.SaveFilePanel("Save graph", Application.dataPath + "/EffectL/Output",
                                                      "defeault", "asset");
            path = Regex.Replace(path, @"^.+/Assets", "Assets");
            var graph = ScriptableObject.CreateInstance <NodeGraph>();
            AssetDatabase.CreateAsset(graph, path);
            graph.Name         = Regex.Match(path, @"/.+?\.", RegexOptions.RightToLeft).Value.TrimStart('/').TrimEnd('.');
            graph.Type         = "Map";
            curNodeGraph       = graph;
            curNodeEditorState = graph.curNodeState;
            CurNodeInputInfo   = new NodeInputInfo("One", curNodeGraph);
            EditorPrefs.SetString("LastMap", path);
#endif
        }
Esempio n. 10
0
        public static void Load()
        {
#if UNITY_EDITOR
            string path = EditorUtility.OpenFilePanel("Open graph", EditorDataMgr.RootPath, "asset");
            path = Regex.Replace(path, @"^.+/Assets", "Assets");
            var graph = AssetDatabase.LoadAssetAtPath <NodeGraph>(path);
            if (graph == null)
            {
                return;
            }
            curNodeEditorState = graph.curNodeState;
            curNodeGraph       = graph;
            CurNodeInputInfo   = new NodeInputInfo("Two", curNodeGraph);
            EditorPrefs.SetString("LastGraph", path);
#endif
        }
Esempio n. 11
0
        private static void HandleNodePanelDrag(NodeInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.EdState;

            if (inputInfo.InputPos.x < 0 || inputInfo.InputPos.y < 0 || state.SelectedNode == null)
            {
                return;
            }
            if (state.IsPineSetting)
            {
                Vector2 panChangeDragOffset = state.DragOffset;
                state.DragOffset    = inputInfo.InputPos - state.DragStart;
                panChangeDragOffset = (state.DragOffset - panChangeDragOffset);
                state.SelectedNode.rect.position += panChangeDragOffset / state.GraphZoom;
            }
        }
Esempio n. 12
0
        private static void SelectedPanelMouseUp(NodeInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.EdState;

            if (inputInfo.InputEvent.modifiers == EventModifiers.Alt)
            {
                state.selectedPanelNodesEndPos = inputInfo.InputPos;
                state.IsSelectedPanelNodes     = false;
                // Rect rect=new Rect(state.selectedPanelNodesStartPos);
                for (int i = 0; i < NodeEditor.curNodeGraph.nodes.Count; i++)
                {
                    //if( state.CurGraph.nodes[i].rect)
                    state.SelectedNodes.Add(NodeEditor.curNodeGraph.nodes[i]);
                }
            }
        }
Esempio n. 13
0
        private static void HandleWindowPineDrag(NodeInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.EdState;

            if (inputInfo.InputPos.x < 0 || inputInfo.InputPos.y < 0 || state.SelectedNode != null || state.SelectedKnob != null)
            {
                return;
            }
            if (state.IsPineSetting)
            {
                Vector2 panChangeDragOffset = state.DragOffset;
                state.DragOffset    = inputInfo.InputPos - state.DragStart;
                panChangeDragOffset = (state.DragOffset - panChangeDragOffset);
                state.PanOffset    += (panChangeDragOffset * inputInfo.EdState.GraphZoom);
            }
        }
Esempio n. 14
0
        private static void HandleSettingMouseDown(NodeInputInfo inputInfo)
        {
            var state = inputInfo.EdState;

            if (inputInfo.InputEvent.button != 1)
            {
                return;
            }
            if (state.SelectedNode != null && state.FocusNode == state.SelectedNode)
            {
                inputInfo.Graph.DrawSelectedNodeMenu();
            }
            else
            {
                inputInfo.Graph.NodeGenericMenu();
            }
        }
Esempio n. 15
0
 internal static void DynamicInvoke(NodeInputInfo inputInfo)
 {
     if (_eventHandles == null)
     {
         return;
     }
     if (inputInfo.CheckEvent())
     {
         foreach (var keyValuePair in _eventHandles)
         {
             if (keyValuePair.Key.eventType == inputInfo.InputEvent.type)
             {
                 keyValuePair.Value.DynamicInvoke(inputInfo);
             }
         }
     }
 }
Esempio n. 16
0
        public static void CreateNew()
        {
#if UNITY_EDITOR
            string path = EditorUtility.SaveFilePanel("Save graph", EditorDataMgr.RootPath,
                                                      "defeault", "asset");
            path = Regex.Replace(path, @"^.+/Assets", "Assets");
            var graph = ScriptableObject.CreateInstance <NodeGraph>();
            AssetDatabase.CreateAsset(graph, path);
            graph.Name   = Regex.Match(path, @"/.+?\.", RegexOptions.RightToLeft).Value.TrimStart('/').TrimEnd('.');
            graph.Type   = "Logic";
            curNodeGraph = graph;
            graph.AddNode("Start", new Vector2(50f, 50f));
            graph.AddNode("Update", new Vector2(50f, 150f));
            curNodeEditorState = graph.curNodeState;
            CurNodeInputInfo   = new NodeInputInfo("One", curNodeGraph);
            EditorPrefs.SetString("LastGraph", path);
#endif
        }
Esempio n. 17
0
        private static void HandleKnobMouseUp(NodeInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.EdState;

            state.IsLinkSetting = false;
            if (state.SelectedKnob == null || inputInfo.InputPos.x < 0 || inputInfo.InputPos.y < 0 || state.SelectedKnob == state.FocusKnob)
            {
                return;
            }
            if (state.FocusKnob != null)
            {
                state.SelectedKnob.Linking(state.FocusKnob);
            }
            else
            {
                state.SelectedKnob = null;
            }
        }
Esempio n. 18
0
        private static void HandleNodePanelDown(NodeInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.EdState;

            if (inputInfo.InputEvent.button == 0 && state.FocusNode != null)
            {
                state.SelectedNode     = state.FocusNode;
                Selection.activeObject = state.FocusNode;
                if (!state.IsPineSetting)
                {
                    state.IsPineSetting = true;
                    state.DragStart     = inputInfo.InputPos;
                    state.DragOffset    = Vector2.zero;
                }
                else
                {
                    state.DragStart  = inputInfo.InputPos;
                    state.DragOffset = Vector2.zero;
                }
            }
        }
Esempio n. 19
0
        private static void HandleWindowScroll(NodeInputInfo inputInfo)
        {
            if (inputInfo.InputPos.x < 0 || inputInfo.InputPos.y < 0)
            {
                return;
            }
            NodeEditorState state = inputInfo.EdState;
            float           Scale = 0.01f * inputInfo.InputEvent.delta.y;

            state.GraphZoom += Scale;
            if (state.GraphZoom <= 0.2f)
            {
                state.GraphZoom = 0.2f;
            }
            else if (state.GraphZoom >= 1.2f)
            {
                state.GraphZoom = 1.2f;
            }
            state.ZoomPos   = state.CurGraphRect.size / 2;
            state.PanAdjust = EffectUtility.PanelScale(ref state.CurGraphRect, state.ZoomPos, state.GraphZoom);
        }
Esempio n. 20
0
        private static void HandleWindowPineDown(NodeInputInfo inputInfo)
        {
            NodeEditorState state = inputInfo.EdState;

            if (state.FocusNode != null && state.FocusKnob != null || inputInfo.InputEvent.button != 0)
            {
                return;
            }
            else
            {
                state.SelectedNode = null;
            }
            if (!state.IsPineSetting)
            {
                state.IsPineSetting = true;
                state.DragStart     = inputInfo.InputPos;
                state.DragOffset    = Vector2.zero;
            }
            else
            {
                state.DragStart  = inputInfo.InputPos;
                state.DragOffset = Vector2.zero;
            }
        }