public void DoDraggedEdge() { if (EdgeGUI.s_DragSourceSlot != null) { EventType typeForControl = Event.current.GetTypeForControl(0); if (typeForControl != EventType.MouseDrag) { if (typeForControl == EventType.Repaint) { Rect position = EdgeGUI.s_DragSourceSlot.m_Position; Vector2 end = Event.current.mousePosition; if (EdgeGUI.s_DropTarget != null) { Rect position2 = EdgeGUI.s_DropTarget.m_Position; end = GUIClip.Clip(new Vector2(position2.x, position2.y + 9f)); } EdgeGUI.DrawEdge(GUIClip.Clip(new Vector2(position.xMax, position.y + 9f)), end, (Texture2D)Styles.selectedConnectionTexture.image, Color.white, this.edgeStyle); } } else { EdgeGUI.s_DropTarget = null; this.dontDrawEdge = null; Event.current.Use(); } } }
public static Vector2 WorldToGUIPoint(Vector3 world) { world = Handles.matrix.MultiplyPoint(world); Camera current = Camera.current; if (current != null) { Vector2 position = current.WorldToScreenPoint(world); position.y = Screen.height - position.y; return(GUIClip.Clip(EditorGUIUtility.PixelsToPoints(position))); } return(new Vector2(world.x, world.y)); }
public static Vector2 WorldToGUIPoint(Vector3 world) { world = Handles.matrix.MultiplyPoint(world); Camera current = Camera.current; if (current) { Vector2 absolutePos = current.WorldToScreenPoint(world); absolutePos.y = (float)Screen.height - absolutePos.y; return(GUIClip.Clip(absolutePos)); } return(new Vector2(world.x, world.y)); }
void UserOverlaysGUI() { if (Event.current.type != EventType.Repaint) { return; } if (m_OverlayQueue.Count == 0) { return; } // the rect containing the time area plus the time ruler var screenRect = new Rect( state.sequencerHeaderWidth, WindowConstants.timeAreaYPosition, position.width - state.sequencerHeaderWidth - (treeView != null && treeView.showingVerticalScrollBar ? WindowConstants.sliderWidth : 0), position.height - WindowConstants.timeAreaYPosition - horizontalScrollbarHeight); var trackOffset = trackRect.y - screenRect.y; var startTime = state.PixelToTime(screenRect.xMin); var endTime = state.PixelToTime(screenRect.xMax); using (new GUIViewportScope(screenRect)) { foreach (var entry in m_OverlayQueue) { var uiState = MarkerUIStates.None; if (entry.isCollapsed) { uiState |= MarkerUIStates.Collapsed; } if (entry.isSelected) { uiState |= MarkerUIStates.Selected; } var region = new MarkerOverlayRegion(GUIClip.Clip(entry.rect), screenRect, startTime, endTime, trackOffset); try { entry.editor.DrawOverlay(entry.marker, uiState, region); } catch (Exception e) { Debug.LogException(e); } } } m_OverlayQueue.Clear(); }
public static Vector2 WorldToGUIPoint(Vector3 world) { world = Handles.matrix.MultiplyPoint(world); Camera current = Camera.current; if (current) { Vector2 vector = current.WorldToScreenPoint(world); vector.y = (float)Screen.height - vector.y; vector = EditorGUIUtility.PixelsToPoints(vector); return(GUIClip.Clip(vector)); } return(new Vector2(world.x, world.y)); }
// Convert world space point to a 2D GUI position. public static Vector2 WorldToGUIPoint(Vector3 world) { world = Handles.matrix.MultiplyPoint(world); Camera cam = Camera.current; if (cam) { Vector2 pos = cam.WorldToScreenPoint(world); pos.y = Screen.height - pos.y; pos = EditorGUIUtility.PixelsToPoints(pos); return(GUIClip.Clip(pos)); } return(new Vector2(world.x, world.y)); }
// Convert world space point to a 2D GUI position. // Use this version in critical loops. internal static Vector3 WorldToGUIPointWithDepth(Vector3 world, Camera camera, Matrix4x4 matrixHandles, float screenHeight) { world = matrixHandles.MultiplyPoint(world); if (camera) { Vector3 pos = camera.WorldToScreenPoint(world); pos.y = screenHeight - pos.y; Vector2 points = EditorGUIUtility.PixelsToPoints(pos); points = GUIClip.Clip(points); return(new Vector3(points.x, points.y, pos.z)); } return(world); }
// Convert world space point to a 2D GUI position. public static Vector3 WorldToGUIPointWithDepth(Vector3 world) { world = Handles.matrix.MultiplyPoint(world); Camera cam = Camera.current; if (cam) { Vector3 pos = cam.WorldToScreenPoint(world); pos.y = Screen.height - pos.y; Vector2 points = EditorGUIUtility.PixelsToPoints(pos); points = GUIClip.Clip(points); return(new Vector3(points.x, points.y, pos.z)); } return(world); }
void DrawOverlay(OverlayData overlayData) { Rect overlayRect = GUIClip.Clip(overlayData.rect); if (overlayData.types == OverlayDataTypes.BackgroundColor) { EditorGUI.DrawRect(overlayRect, overlayData.color); } else if (overlayData.types == OverlayDataTypes.BackgroundTexture) { Graphics.DrawTextureRepeated(overlayRect, overlayData.texture); } else if (overlayData.types == OverlayDataTypes.TextBox) { using (new GUIColorOverride(overlayData.backgroundTextStyle.normal.textColor)) GUI.Box(overlayRect, GUIContent.none, overlayData.backgroundTextStyle); Graphics.ShadowLabel(overlayRect, GUIContent.Temp(overlayData.text), overlayData.textStyle, overlayData.textStyle.normal.textColor, Color.black); } }
public void Draw() { Rect overlayRect = GUIClip.Clip(m_Rect); switch (m_Type) { case OverlayType.BackgroundColor: EditorGUI.DrawRect(overlayRect, m_Color); break; case OverlayType.BackgroundTexture: Graphics.DrawTextureRepeated(overlayRect, m_Texture); break; case OverlayType.TextBox: { using (new GUIColorOverride(m_BackgroundTextStyle.normal.textColor)) GUI.Box(overlayRect, GUIContent.none, m_BackgroundTextStyle); Graphics.ShadowLabel(overlayRect, GUIContent.Temp(m_Text), m_TextStyle, m_TextStyle.normal.textColor, Color.black); break; } } }
public Vector2 ScreenToGUIPoint(Vector2 screenPoint) { screenPoint.y = m_ScreenHeight - screenPoint.y; return(GUIClip.Clip(EditorGUIUtility.PixelsToPoints(screenPoint))); }
private static void GetEdgeEndPoints(Edge e, out Vector2 start, out Vector2 end) { start = GUIClip.Clip(new Vector2(e.fromSlot.m_Position.xMax, e.fromSlot.m_Position.y + 9f)); end = GUIClip.Clip(new Vector2(e.toSlot.m_Position.x, e.toSlot.m_Position.y + 9f)); }
public Vector2 ScreenToGUIPoint(Vector2 point) { point.y = screen - point.y; return(GUIClip.Clip(EditorGUIUtility.PixelsToPoints(point))); }