public void DrawConnectionInputPointMark(NodeEvent eventSource, bool justConnecting) { var defaultPointTex = NodeGUIUtility.pointMark; var lastColor = GUI.color; bool shouldDrawEnable = eventSource == null || eventSource.eventSourceNode != null; bool shouldDrawWithEnabledColor = shouldDrawEnable && justConnecting && eventSource != null && eventSource.eventSourceNode.Id != this.Id && eventSource.point.IsOutput; foreach (var point in m_data.InputPoints) { if (shouldDrawWithEnabledColor && Controller.GetConnectType(eventSource.point, point) != null) { GUI.color = NGEditorSettings.GUI.COLOR_CAN_CONNECT; } else { GUI.color = (justConnecting) ? NGEditorSettings.GUI.COLOR_CAN_NOT_CONNECT : NGEditorSettings.GUI.COLOR_CONNECTED; } var rect = ConnectionPointDataUtility.GetGlobalPointRegion(point.IsInput, point.Region, this); GUI.DrawTexture(rect, defaultPointTex); GUI.color = lastColor; } }
public void DrawConnectionOutputPointMark(NodeEvent eventSource, bool justConnecting, Event current) { var defaultPointTex = NodeGUIUtility.pointMark; var lastColor = GUI.color; bool shouldDrawEnable = eventSource == null || eventSource.eventSourceNode != null; 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 = ConnectionPointDataUtility.GetGlobalPointRegion(point.IsInput, point.Region, this); //var pointRegion = point.GetGlobalPointRegion(this); if (shouldDrawWithEnabledColor && Controller.GetConnectType(eventSource.point, point) != null) { GUI.color = NGEditorSettings.GUI.COLOR_CAN_CONNECT; } else { GUI.color = (justConnecting) ? NGEditorSettings.GUI.COLOR_CAN_NOT_CONNECT : NGEditorSettings.GUI.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)); } } } }