public void DrawConnectionInputPointMark(NodeEvent eventSource, bool justConnecting) { var defaultPointTex = NodeGUIUtility.pointMark; var lastColor = GUI.color; bool shouldDrawEnable = !(eventSource != null && eventSource.eventSourceNode != null && !Model.ConnectionData.CanConnect(eventSource.eventSourceNode.Data, m_data) ); bool shouldDrawWithEnabledColor = shouldDrawEnable && justConnecting && eventSource != null && eventSource.eventSourceNode.Id != this.Id && eventSource.point.IsOutput; foreach (var point in m_data.InputPoints) { if (IsValidInputConnectionPoint(point)) { if (shouldDrawWithEnabledColor) { GUI.color = Model.Settings.GUI.COLOR_CAN_CONNECT; } else { GUI.color = (justConnecting) ? Model.Settings.GUI.COLOR_CAN_NOT_CONNECT : Model.Settings.GUI.COLOR_CONNECTED; } GUI.DrawTexture(point.GetGlobalPointRegion(this), defaultPointTex); GUI.color = lastColor; } } }
public void DrawConnectionOutputPointMark(NodeEvent eventSource, bool justConnecting, Event current) { var defaultPointTex = _assetGraphGuiConfig.ConnectionPoint; var lastColor = GUI.color; bool shouldDrawEnable = !(eventSource != null && eventSource.eventSourceNode != null && !Model.ConnectionData.CanConnect(m_data, eventSource.eventSourceNode.Data) ); bool shouldDrawWithEnabledColor = shouldDrawEnable && justConnecting && eventSource != null && eventSource.eventSourceNode.Id != this.Id && eventSource.point.IsInput; var globalMousePosition = current.mousePosition; foreach (var point in m_data.OutputPoints) { var pointRegion = point.GetGlobalPointRegion(this); if (shouldDrawWithEnabledColor) { GUI.color = _assetGraphGuiConfig.COLOR_CAN_CONNECT; } else { GUI.color = (justConnecting) ? _assetGraphGuiConfig.COLOR_CAN_NOT_CONNECT : _assetGraphGuiConfig.COLOR_CONNECTED; } GUI.DrawTexture( pointRegion, defaultPointTex ); GUI.color = lastColor; // eventPosition is contained by outputPointRect. if (pointRegion.Contains(globalMousePosition)) { if (current.type == EventType.MouseDown) { NodeGUIUtility.NodeEventHandler( new NodeEvent(NodeEvent.EventType.EVENT_CONNECTING_BEGIN, this, current.mousePosition, point)); } } } }