예제 #1
0
        private void DrawSideWindow()
        {
            GUILayout.Label(new GUIContent("Node Editor (" + mainNodeCanvas.name + ")", "Opened Canvas path: " + openedCanvasPath), NodeEditorGUI.nodeLabelBold);

            if (GUILayout.Button(new GUIContent("Save Canvas", "Saves the Canvas to a Canvas Save File in the Assets Folder")))
            {
                string path = EditorUtility.SaveFilePanelInProject("Save Node Canvas", "Node Canvas", "asset", "", NodeEditor.editorPath + "Resources/Saves/");
                if (!string.IsNullOrEmpty(path))
                {
                    SaveNodeCanvas(path);
                }
            }

            if (GUILayout.Button(new GUIContent("Load Canvas", "Loads the Canvas from a Canvas Save File in the Assets Folder")))
            {
                string path = EditorUtility.OpenFilePanel("Load Node Canvas", NodeEditor.editorPath + "Resources/Saves/", "asset");
                if (!path.Contains(Application.dataPath))
                {
                    if (!string.IsNullOrEmpty(path))
                    {
                        ShowNotification(new GUIContent("You should select an asset inside your project folder!"));
                    }
                }
                else
                {
                    path = path.Replace(Application.dataPath, "Assets");
                    LoadNodeCanvas(path);
                }
            }

            if (GUILayout.Button(new GUIContent("New Canvas", "Loads an empty Canvas")))
            {
                NewNodeCanvas();
            }

            if (GUILayout.Button(new GUIContent("Recalculate All", "Initiates complete recalculate. Usually does not need to be triggered manually.")))
            {
                NodeEditor.RecalculateAll(mainNodeCanvas);
            }

            if (GUILayout.Button("Force Re-Init"))
            {
                NodeEditor.ReInit(true);
            }

            if (NodeEditor.isTransitioning(mainNodeCanvas) && GUILayout.Button("Stop Transitioning"))
            {
                NodeEditor.StopTransitioning(mainNodeCanvas);
            }

            NodeEditorGUI.knobSize = EditorGUILayout.IntSlider(new GUIContent("Handle Size", "The size of the Node Input/Output handles"), NodeEditorGUI.knobSize, 12, 20);
            mainEditorState.zoom   = EditorGUILayout.Slider(new GUIContent("Zoom", "Use the Mousewheel. Seriously."), mainEditorState.zoom, 0.6f, 2);

            if (mainEditorState.selectedNode != null && Event.current.type != EventType.Ignore)
            {
                mainEditorState.selectedNode.DrawNodePropertyEditor();
            }
        }