CanConnect() public static method

public static CanConnect ( NodeData from, NodeData to ) : bool
from NodeData
to NodeData
return bool
示例#1
0
        public void DrawConnectionInputPointMark(NodeEvent eventSource, bool justConnecting)
        {
            if (scaleFactor != SCALE_MAX)
            {
                return;
            }

            var  defaultPointTex  = NodeGUIUtility.inputPointMarkTex;
            bool shouldDrawEnable =
                !(eventSource != null && eventSource.eventSourceNode != null &&
                  !ConnectionData.CanConnect(eventSource.eventSourceNode.Data, m_data)
                  );

            if (shouldDrawEnable && justConnecting && eventSource != null)
            {
                if (eventSource.eventSourceNode.Id != this.Id)
                {
                    var connectionPoint = eventSource.point;
                    if (connectionPoint.IsOutput)
                    {
                        defaultPointTex = NodeGUIUtility.enablePointMarkTex;
                    }
                }
            }

            foreach (var point in m_data.InputPoints)
            {
                if (IsValidInputConnectionPoint(point))
                {
                    GUI.DrawTexture(point.GetGlobalPointRegion(this), defaultPointTex);
                }
            }
        }
示例#2
0
        public void DrawConnectionOutputPointMark(NodeEvent eventSource, bool justConnecting, Event current)
        {
            if (scaleFactor != SCALE_MAX)
            {
                return;
            }

            var  defaultPointTex  = NodeGUIUtility.outputPointMarkConnectedTex;
            bool shouldDrawEnable =
                !(eventSource != null && eventSource.eventSourceNode != null &&
                  !ConnectionData.CanConnect(m_data, eventSource.eventSourceNode.Data)
                  );

            if (shouldDrawEnable && justConnecting && eventSource != null)
            {
                if (eventSource.eventSourceNode.Id != this.Id)
                {
                    var connectionPoint = eventSource.point;
                    if (connectionPoint.IsInput)
                    {
                        defaultPointTex = NodeGUIUtility.enablePointMarkTex;
                    }
                }
            }

            var globalMousePosition = current.mousePosition;

            foreach (var point in m_data.OutputPoints)
            {
                var pointRegion = point.GetGlobalPointRegion(this);

                GUI.DrawTexture(
                    pointRegion,
                    defaultPointTex
                    );

                // eventPosition is contained by outputPointRect.
                if (pointRegion.Contains(globalMousePosition))
                {
                    if (current.type == EventType.MouseDown)
                    {
                        NodeGUIUtility.NodeEventHandler(
                            new NodeEvent(NodeEvent.EventType.EVENT_NODE_CONNECT_STARTED, this, current.mousePosition, point));
                    }
                }
            }
        }