private void DrawKeyFrame(float key, TimelineWindow.TimelineState state) { float num = state.TimeToPixel((double)key); Rect rect = new Rect(num, this.m_TrackRect.get_yMin() + 3f, 1f, this.m_TrackRect.get_height() - 6f); if (this.m_TrackRect.Overlaps(rect)) { float fixedWidth = DirectorStyles.Instance.keyframe.get_fixedWidth(); float fixedHeight = DirectorStyles.Instance.keyframe.get_fixedHeight(); Rect rect2 = rect; rect2.set_width(fixedWidth); rect2.set_height(fixedHeight); rect2.set_xMin(rect2.get_xMin() - fixedWidth / 2f); rect2.set_yMin(this.m_TrackRect.get_yMin() + (this.m_TrackRect.get_height() - fixedHeight) / 2f); GUI.Label(rect2, GUIContent.none, DirectorStyles.Instance.keyframe); EditorGUI.DrawRect(rect, DirectorStyles.Instance.customSkin.colorInfiniteClipLine); } }
public void DrawCurveEditor(Rect animEditorRect, TimelineWindow.TimelineState state, Vector2 activeRange, bool loop, bool selected) { this.UpdateCurveEditorIfNeeded(state); ZoomableArea arg_29_0 = this.m_CurveEditor; float num = this.CalculateTopMargin(animEditorRect.get_height()); this.m_CurveEditor.set_bottommargin(num); arg_29_0.set_topmargin(num); float num2 = state.TimeToPixel((double)this.m_DataSource.start) - animEditorRect.get_xMin(); this.m_CurveEditor.set_rightmargin(0f); this.m_CurveEditor.set_leftmargin(num2); this.m_CurveEditor.set_rect(new Rect(0f, 0f, animEditorRect.get_width(), animEditorRect.get_height())); this.m_CurveEditor.SetShownHRangeInsideMargins(0f, (state.PixelToTime(animEditorRect.get_xMax()) - this.m_DataSource.start) * this.m_DataSource.timeScale); if (this.m_LastFrameRate != state.frameRate) { this.m_CurveEditor.get_hTicks().SetTickModulosForFrameRate(state.frameRate); this.m_LastFrameRate = state.frameRate; } CurveWrapper[] animationCurves = this.m_CurveEditor.get_animationCurves(); for (int i = 0; i < animationCurves.Length; i++) { CurveWrapper curveWrapper = animationCurves[i]; curveWrapper.get_renderer().SetWrap(0, (!loop) ? 0 : 2); } this.m_CurveEditor.BeginViewGUI(); Color color = GUI.get_color(); GUI.set_color(Color.get_white()); GUI.BeginGroup(animEditorRect); Graphics.DrawLine(new Vector2(num2, 0f), new Vector2(num2, animEditorRect.get_height()), new Color(1f, 1f, 1f, 0.5f)); float num3 = activeRange.x - animEditorRect.get_x(); float num4 = activeRange.y - activeRange.x; if (selected) { Rect rect = new Rect(num3, 0f, num4, animEditorRect.get_height()); ClipCurveEditor.DrawOutline(rect, 2f); } EditorGUI.BeginChangeCheck(); Event current = Event.get_current(); if (current.get_type() == 8 || current.get_type() == 7 || selected) { this.m_CurveEditor.CurveGUI(); } this.m_CurveEditor.EndViewGUI(); if (EditorGUI.EndChangeCheck()) { this.OnCurvesUpdated(); } Color colorInlineCurveOutOfRangeOverlay = DirectorStyles.Instance.customSkin.colorInlineCurveOutOfRangeOverlay; Rect rect2 = new Rect(num2, 0f, num3 - num2, animEditorRect.get_height()); EditorGUI.DrawRect(rect2, colorInlineCurveOutOfRangeOverlay); Rect rect3 = new Rect(num3 + num4, 0f, animEditorRect.get_width() - num3 - num4, animEditorRect.get_height()); EditorGUI.DrawRect(rect3, colorInlineCurveOutOfRangeOverlay); GUI.set_color(color); GUI.EndGroup(); Rect rect4 = animEditorRect; rect4.set_width(ClipCurveEditor.s_GridLabelWidth); float num5 = num2 - ClipCurveEditor.s_GridLabelWidth; if (num5 > 0f) { rect4.set_x(animEditorRect.get_x() + num5); } GUI.BeginGroup(rect4); this.m_CurveEditor.GridGUI(); GUI.EndGroup(); }
public void Draw(Rect rect, TimelineWindow.TimelineState state, double time) { Vector2 min = rect.get_min(); min.y += 4f; min.x = state.TimeToPixel(time); TimeAreaItem.Alignment alignment = this.alignment; if (alignment != TimeAreaItem.Alignment.Center) { if (alignment != TimeAreaItem.Alignment.Left) { if (alignment == TimeAreaItem.Alignment.Right) { this.m_BoundingRect = new Rect(min.x, min.y, this.widgetWidth, this.widgetHeight); } } else { this.m_BoundingRect = new Rect(min.x - this.widgetWidth, min.y, this.widgetWidth, this.widgetHeight); } } else { this.m_BoundingRect = new Rect(min.x - this.widgetWidth / 2f, min.y, this.widgetWidth, this.widgetHeight); } if (Event.get_current().get_type() == 7) { if (this.m_BoundingRect.get_xMax() < state.timeAreaRect.get_xMin()) { return; } if (this.m_BoundingRect.get_xMin() > state.timeAreaRect.get_xMax()) { return; } } float num = state.timeAreaRect.get_yMax() - DirectorStyles.kDurationGuiThickness; Vector3 p = new Vector3(min.x, num, 0f); Vector3 p2 = new Vector3(min.x, num + Mathf.Min(rect.get_height(), state.windowHeight), 0f); if (this.drawLine) { if (this.dottedLine) { Graphics.DrawDottedLine(p, p2, 5f, this.lineColor); } else { Rect rect2 = Rect.MinMaxRect(p.x - 0.5f, p.y, p2.x + 0.5f, p2.y); EditorGUI.DrawRect(rect2, this.lineColor); } } if (this.drawHead) { Color color = GUI.get_color(); GUI.set_color(this.headColor); GUI.Box(this.bounds, this.m_HeaderContent, this.m_Style); GUI.set_color(color); if (this.canMoveHead) { EditorGUIUtility.AddCursorRect(this.bounds, 8); } } if (this.showTooltip) { this.m_Tooltip.text = state.TimeAsString(time, "F2"); Vector2 position = this.bounds.get_position(); position.y = state.timeAreaRect.get_y(); position.y -= this.m_Tooltip.bounds.get_height(); position.x -= Mathf.Abs(this.m_Tooltip.bounds.get_width() - this.bounds.get_width()) / 2f; Rect bounds = this.bounds; bounds.set_position(position); this.m_Tooltip.bounds = bounds; this.m_Tooltip.Draw(); } }
private static bool IsMagnetVisibleInRect(double time, Rect visibleRect, TimelineWindow.TimelineState state) { float num = state.TimeToPixel(time); return(num > visibleRect.get_xMin() && num < visibleRect.get_xMax()); }