/// <summary> Draw a connection as we are dragging it </summary> public void DrawDraggedConnection() { if (IsDraggingPort) { Color col = NodeEditorPreferences.GetTypeColor(draggedOutput.ValueType); if (!_portConnectionPoints.ContainsKey(draggedOutput)) { return; } col.a = 0.6f; Vector2 from = _portConnectionPoints[draggedOutput].center; Vector2 to = Vector2.zero; for (int i = 0; i < draggedOutputReroutes.Count; i++) { to = draggedOutputReroutes[i]; DrawConnection(from, to, col); from = to; } to = draggedOutputTarget != null ? portConnectionPoints[draggedOutputTarget].center : WindowToGridPosition(Event.current.mousePosition); DrawConnection(from, to, col); Color bgcol = Color.black; Color frcol = col; bgcol.a = 0.6f; frcol.a = 0.6f; // Loop through reroute points again and draw the points for (int i = 0; i < draggedOutputReroutes.Count; i++) { // Draw reroute point at position Rect rect = new Rect(draggedOutputReroutes[i], new Vector2(16, 16)); rect.position = new Vector2(rect.position.x - 8, rect.position.y - 8); rect = GridToWindowRect(rect); NodeEditorGUILayout.DrawPortHandle(rect, bgcol, frcol); } } }
public virtual Color GetTypeColor(Type type) { return(NodeEditorPreferences.GetTypeColor(type)); }