public void RefreshCurves() { if (this.m_ClipDataSource != null && this.m_Selection != null) { List <EditorCurveBinding> list = new List <EditorCurveBinding>(); int[] selection = this.m_Selection; for (int i = 0; i < selection.Length; i++) { int num = selection[i]; CurveTreeViewNode curveTreeViewNode = (CurveTreeViewNode)this.m_TreeView.FindItem(num); if (curveTreeViewNode != null && curveTreeViewNode.bindings != null) { list.AddRange(curveTreeViewNode.bindings); } } AnimationClip animationClip = this.m_ClipDataSource.animationClip; List <CurveWrapper> list2 = new List <CurveWrapper>(); int num2 = 0; foreach (EditorCurveBinding current in list) { CurveWrapper curveWrapper = new CurveWrapper(); curveWrapper.id = num2++; curveWrapper.binding = current; curveWrapper.groupId = -1; curveWrapper.color = CurveUtility.GetPropertyColor(current.propertyName); curveWrapper.hidden = false; curveWrapper.readOnly = false; curveWrapper.set_renderer(new NormalCurveRenderer(AnimationUtility.GetEditorCurve(animationClip, current))); curveWrapper.getAxisUiScalarsCallback = new CurveWrapper.GetAxisScalarsCallback(this.GetAxisScalars); CurveWrapper curveWrapper2 = curveWrapper; curveWrapper2.get_renderer().SetCustomRange(0f, animationClip.get_length()); list2.Add(curveWrapper2); } this.m_CurveEditor.set_animationCurves(list2.ToArray()); } }
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(); }