// Called once during initialization of m_State private void InitializeDopeSheet() { m_DopeSheet = new DopeSheetEditor(m_OwnerWindow); m_DopeSheet.SetTickMarkerRanges(); m_DopeSheet.hSlider = true; m_DopeSheet.shownArea = new Rect(1, 1, 1, 1); // The rect here is only for initialization and will be overriden at layout m_DopeSheet.rect = new Rect(0, 0, contentWidth, 100); m_DopeSheet.hTicks.SetTickModulosForFrameRate(m_State.frameRate); }
private void DopeSheetOnGUI(Rect position) { Rect noVerticalSliderRect = new Rect(position.xMin, position.yMin, position.width - kSliderThickness, position.height); if (Event.current.type == EventType.Repaint) { m_DopeSheet.rect = noVerticalSliderRect; m_DopeSheet.SetTickMarkerRanges(); m_DopeSheet.RecalculateBounds(); } if (m_State.showCurveEditor) { return; } Rect noSlidersRect = new Rect(position.xMin, position.yMin, position.width - kSliderThickness, position.height - kSliderThickness); m_DopeSheet.BeginViewGUI(); GUI.Label(position, GUIContent.none, AnimationWindowStyles.dopeSheetBackground); if (!m_State.disabled) { m_DopeSheet.TimeRuler(noSlidersRect, m_State.frameRate, false, true, kDisabledRulerAlpha, m_State.timeFormat); // grid } m_DopeSheet.OnGUI(noSlidersRect, m_State.hierarchyState.scrollPos * -1); m_DopeSheet.EndViewGUI(); Rect verticalScrollBarPosition = new Rect(noVerticalSliderRect.xMax, noVerticalSliderRect.yMin, kSliderThickness, noSlidersRect.height); float visibleHeight = m_Hierarchy.GetTotalRect().height; float contentHeight = Mathf.Max(visibleHeight, m_Hierarchy.GetContentSize().y); m_State.hierarchyState.scrollPos.y = GUI.VerticalScrollbar(verticalScrollBarPosition, m_State.hierarchyState.scrollPos.y, visibleHeight, 0f, contentHeight); if (m_DopeSheet.spritePreviewLoading == true) { Repaint(); } }