public void Draw()
        {
            NodeData node = NodeGUIUtility.GetInstance <NodeData>(data.nodeGUID);

            data.rect.y = node.rect.y + 15f - data.rect.height * 0.5f + 40f * data.index;

            switch (data.pointType)
            {
            case ConnectionPointType.In:
            case ConnectionPointType.Parameter:
                data.rect.x = node.rect.x - data.rect.width + 8f;
                if (GUI.Button(data.rect, NodeGUIResources.dot))
                {
                    NodeBaseEditor.Current.OnClickPoint(this);
                }
                break;

            case ConnectionPointType.Out:
            case ConnectionPointType.Return:
                data.rect.x = node.rect.x + node.rect.width - 8f;
                if (GUI.Button(data.rect, NodeGUIResources.dotOuter))
                {
                    NodeBaseEditor.Current.OnClickPoint(this);
                }
                break;
            }
        }
Example #2
0
        public void OnClickRemoveConnection(Connection connection)
        {
            connections.Remove(connection);
            NodePointData inP  = NodeGUIUtility.GetInstance <NodePointData>(connection.data.inGUID),
                          outP = NodeGUIUtility.GetInstance <NodePointData>(connection.data.outGUID);

            inP.connections.Remove(connection.data.GUID);
            outP.connections.Remove(connection.data.GUID);
            NodeGUIUtility.RemoveInstance(connection.data);
        }
Example #3
0
        public static Connection CreateConnectionInRuntime(NodeConnectionData data)
        {
            Connection    c   = new Connection(data);
            NodePointData inP = NodeGUIUtility.GetInstance <NodePointData>(data.inGUID)
            , outP            = NodeGUIUtility.GetInstance <NodePointData>(data.outGUID);

            inP.connections.Add(data.GUID);
            outP.connections.Add(data.GUID);
            return(c);
        }
Example #4
0
        public void Draw()
        {
            NodePointData inP = NodeGUIUtility.GetInstance <NodePointData>(data.inGUID), outP = NodeGUIUtility.GetInstance <NodePointData>(data.outGUID);

            Handles.DrawBezier(
                inP.rect.center,
                outP.rect.center,
                inP.rect.center + Vector2.left * 50f,
                outP.rect.center - Vector2.left * 50f,
                Color.white,
                null,
                4f
                );

            if (Handles.Button((inP.rect.center + outP.rect.center) * 0.5f, Quaternion.identity, 4, 8, Handles.RectangleHandleCap))
            {
                NodeBaseEditor.Current.OnClickRemoveConnection(this);
            }
        }