예제 #1
0
        private void OnGUI()
        {
            // Initiation
            NodeEditor.checkInit(true);
            if (NodeEditor.InitiationError)
            {
                GUILayout.Label("Node Editor Initiation failed! Check console for more information!");
                return;
            }
            AssureSetup();

            // Start Overlay GUI for popups (before any other GUI)
            OverlayGUI.StartOverlayGUI("RTNodeEditor");

            // Set root rect (can be any number of arbitrary groups, e.g. a nested UI, but at least one)
            GUI.BeginGroup(new Rect(0, 0, Screen.width, Screen.height));

            // Begin Node Editor GUI and set canvas rect
            NodeEditorGUI.StartNodeGUI(false);
            canvasCache.editorState.canvasRect = new Rect(rect.x, rect.y + editorInterface.toolbarHeight, rect.width, rect.height - editorInterface.toolbarHeight);

            try
            {             // Perform drawing with error-handling
                NodeEditor.DrawCanvas(canvasCache.nodeCanvas, canvasCache.editorState);
            }
            catch (UnityException e)
            {             // On exceptions in drawing flush the canvas to avoid locking the UI
                canvasCache.NewNodeCanvas();
                NodeEditor.ReInit(true);
                Debug.LogError("Unloaded Canvas due to exception in Draw!");
                Debug.LogException(e);
            }

            // Draw Interface
            GUILayout.BeginArea(rect);
            editorInterface.DrawToolbarGUI();
            GUILayout.EndArea();
            editorInterface.DrawModalPanel();

            // End Node Editor GUI
            NodeEditorGUI.EndNodeGUI();

            // End root rect
            GUI.EndGroup();

            // End Overlay GUI and draw popups
            OverlayGUI.EndOverlayGUI();
        }
예제 #2
0
        private void OnGUI()
        {
            // Initiation
            NodeEditor.checkInit(true);
            if (NodeEditor.InitiationError)
            {
                GUILayout.Label("Node Editor Initiation failed! Check console for more information!");
                return;
            }
            AssureSetup();

            // ROOT: Start Overlay GUI for popups
            OverlayGUI.StartOverlayGUI("RTNodeEditor");

            // Set various nested groups
            GUI.BeginGroup(rootRect, GUI.skin.box);

            // Begin Node Editor GUI and set canvas rect
            NodeEditorGUI.StartNodeGUI(false);
            canvasCache.editorState.canvasRect = new Rect(canvasRect.x, canvasRect.y /* + editorInterface.toolbarHeight*/, canvasRect.width, canvasRect.height /* - editorInterface.toolbarHeight*/);

            try
            {             // Perform drawing with error-handling
                NodeEditor.DrawCanvas(canvasCache.nodeCanvas, canvasCache.editorState);
            }
            catch (UnityException e)
            {             // On exceptions in drawing flush the canvas to avoid locking the UI
                canvasCache.NewNodeCanvas();
                NodeEditor.ReInit(true);
                Debug.LogError("Unloaded Canvas due to exception in Draw!");
                Debug.LogException(e);
            }

            //Debug.Log(Event.current.type);
            // Draw Interface
            editorInterface.DrawToolbarGUI(canvasRect);
            editorInterface.DrawModalPanel();

            // End Node Editor GUI
            NodeEditorGUI.EndNodeGUI();

            // End various nested groups
            GUI.EndGroup();

            // END ROOT: End Overlay GUI and draw popups
            OverlayGUI.EndOverlayGUI();
        }
예제 #3
0
        private void OnGUI()
        {
            // Initiation
            NodeEditor.checkInit(true);
            if (NodeEditor.InitiationError)
            {
                GUILayout.Label("Node Editor Initiation failed! Check console for more information!");
                return;
            }
            AssureEditor();
            AssureSetup();

            // ROOT: Start Overlay GUI for popups
            OverlayGUI.StartOverlayGUI("NodeEditorWindow");

            // Begin Node Editor GUI and set canvas rect
            NodeEditorGUI.StartNodeGUI(true);
            canvasCache.editorState.canvasRect = canvasWindowRect;

            //EditorGUI.BeginChangeCheck();
            try
            { // Perform drawing with error-handling
                NodeEditor.DrawCanvas(canvasCache.nodeCanvas, canvasCache.editorState);
            }
            catch (UnityException e)
            { // On exceptions in drawing flush the canvas to avoid locking the UI
                canvasCache.NewNodeCanvas();
                NodeEditor.ReInit(true);
                Debug.LogError("Unloaded Canvas due to an exception during the drawing phase!");
                Debug.LogException(e);
            }
            //if (EditorGUI.EndChangeCheck())
            //{
            //    Debug.Log("修改文件:" + canvasCache.nodeCanvas.saveName);
            //}

            // Draw Interface
            editorInterface.DrawToolbarGUI(new Rect(0, 0, Screen.width, 0));
            editorInterface.DrawModalPanel();

            // End Node Editor GUI
            NodeEditorGUI.EndNodeGUI();

            // END ROOT: End Overlay GUI and draw popups
            OverlayGUI.EndOverlayGUI();
        }