Ejemplo n.º 1
0
        protected virtual void OnGUI()
        {
            Event     e = Event.current;
            Matrix4x4 m = GUI.matrix;

            if (graph == null)
            {
                return;
            }
            ValidateGraphEditor();
            Controls();

            DrawGrid(position, zoom, panOffset);
            DrawConnections();
            DrawDraggedConnection();
            DrawNodes();
            DrawSelectionBox();
            DrawTooltip();
            graphEditor.OnGUI();

            // Run and reset onLateGUI
            if (onLateGUI != null)
            {
                onLateGUI();
                onLateGUI = null;
            }

            GUI.matrix = m;
        }
Ejemplo n.º 2
0
        private void OnGUI()
        {
            Event     e = Event.current;
            Matrix4x4 m = GUI.matrix;

            if (graph == null)
            {
                return;
            }
            graphEditor          = NodeGraphEditor.GetEditor(graph);
            graphEditor.position = position;

            Controls();

            DrawGrid(position, zoom, panOffset);
            DrawConnections();
            DrawDraggedConnection();
            try
            {
                DrawNodes();
            } catch {}
            DrawSelectionBox();
            DrawTooltip();
            graphEditor.OnGUI();

            GUI.matrix = m;
        }
Ejemplo n.º 3
0
        /// <summary> Ends the GUI Group temporarily to draw any additional elements in the NodeGraphEditor. </summary>
        private void DrawGraphOnGUI()
        {
            GUI.EndGroup();
            Rect rect = new Rect(new Vector2(leftPadding, topPadding), new Vector2(Screen.width, Screen.height));

            GUI.BeginGroup(rect);
            graphEditor.OnGUI();
            GUI.EndGroup();
            GUI.BeginGroup(new Rect(0.0f, topPadding - (topPadding * zoom), Screen.width, Screen.height));
        }
        private void OnGUI()
        {
            Event     e = Event.current;
            Matrix4x4 m = GUI.matrix;

            if (graph == null)
            {
                return;
            }
            graphEditor = NodeGraphEditor.GetEditor(graph);
            if (graphEditor == null)
            {
                return;
            }
            graphEditor.position = position;

            Controls();

            DrawGrid(position, zoom, panOffset);
            DrawConnections();
            DrawDraggedConnection();
            DrawNodes();
            DrawSelectionBox();
            DrawTooltip();
            graphEditor.OnGUI();

            if (currentActivity == NodeActivity.AddingNode)
            {
                BeginWindows();
                contextWindowRect = new Rect(contextMenuMousePos, Vector2.one * 400);
                // All GUI.Window or GUILayout.Window must come inside here
                contextWindowRect = GUILayout.Window(1, contextWindowRect, DrawWindow, "Add node");
                EndWindows();
            }

            // Run and reset onLateGUI
            if (onLateGUI != null)
            {
                onLateGUI();
                onLateGUI = null;
            }

            GUI.matrix = m;
        }