private void OnGUI()
    {
        DrawGrid(20, 0.2f, Color.gray);
        DrawGrid(100, 0.4f, Color.gray);

        ProcessEvents(Event.current);

        if (GraphToEdit == null)
        {
            Reset();
            return;
        }

        if (GraphToEdit != null)
        {
            if (RegisteredFunctionDictionary == null)
            {
                Reset();
            }
        }

        RenderGraph();
        // draw editors for selected node

        if (GraphToEdit != null && GraphToEdit.IsPinSelected())
        {
            EditorNode OwnerNode = GraphToEdit.GetSelectedNode();
            Vector2    PinPos    = OwnerNode.GetPinRect(GraphToEdit.GetSelectedElementID().PinID).center;
            EditorGraphDrawUtils.Line(PinPos, Event.current.mousePosition, Color.magenta);
        }
    }
Example #2
0
    public void RenderLink(EditorGraph Graph)
    {
        EditorNode FromNode = Graph.GetNodeFromID(NodeID_From);
        EditorNode ToNode   = Graph.GetNodeFromID(NodeID_To);

        if (FromNode == null || ToNode == null)
        {
            return;
        }

        Rect FromRect = FromNode.GetPinRect(PinID_From);
        Rect ToRect   = ToNode.GetPinRect(PinID_To);

        EditorGraphDrawUtils.Line(FromRect.center, ToRect.center, Color.black);
    }