public override void Draw(Rect headerRect, Rect contentRect, WindowState state) { DetectTrackChanged(); UpdateDrawData(state); UpdateInfiniteClipEditor(state.GetWindow()); var trackHeaderRect = headerRect; var trackContentRect = contentRect; float inlineCurveHeight = contentRect.height - GetTrackContentHeight(state); bool hasInlineCurve = inlineCurveHeight > 0.0f; if (hasInlineCurve) { trackHeaderRect.height -= inlineCurveHeight; trackContentRect.height -= inlineCurveHeight; } if (Event.current.type == EventType.Repaint) { m_TreeViewRect = trackContentRect; } if (s_ArmForRecordContentOn == null) { s_ArmForRecordContentOn = new GUIContent(DirectorStyles.GetBackgroundImage(DirectorStyles.Instance.autoKey, StyleState.active)); } if (s_ArmForRecordContentOff == null) { s_ArmForRecordContentOff = new GUIContent(DirectorStyles.GetBackgroundImage(DirectorStyles.Instance.autoKey)); } if (s_ArmForRecordDisabled == null) { s_ArmForRecordDisabled = new GUIContent(DirectorStyles.GetBackgroundImage(DirectorStyles.Instance.autoKey), Styles.kArmForRecordDisabled); } track.SetCollapsed(!isExpanded); RebuildGUICacheIfNecessary(); // Prevents from drawing outside of bounds, but does not effect layout or markers bool isOwnerDrawSucceed = false; Vector2 visibleTime = state.timeAreaShownRange; if (drawer != null) { isOwnerDrawSucceed = drawer.DrawTrack(trackContentRect, track, visibleTime, state); } if (!isOwnerDrawSucceed) { using (new GUIViewportScope(trackContentRect)) DrawBackground(trackContentRect, track, visibleTime, state); if (m_InfiniteTrackDrawer != null) { m_InfiniteTrackDrawer.DrawTrack(trackContentRect, track, visibleTime, state); } // draw after user customization so overlay text shows up using (new GUIViewportScope(trackContentRect)) m_ItemsDrawer.Draw(trackContentRect, state); } DrawTrackHeader(trackHeaderRect, state); if (hasInlineCurve) { var curvesHeaderRect = headerRect; curvesHeaderRect.yMin = trackHeaderRect.yMax; var curvesContentRect = contentRect; curvesContentRect.yMin = trackContentRect.yMax; DrawInlineCurves(curvesHeaderRect, curvesContentRect, state); } DrawTrackColorKind(headerRect); DrawTrackState(contentRect, contentRect, track); }
static void DrawClipBackground(Rect clipCenterSection, ClipBlends blends, bool selected) { var clipStyle = selected ? DirectorStyles.Instance.timelineClipSelected : DirectorStyles.Instance.timelineClip; var texture = DirectorStyles.GetBackgroundImage(clipStyle); var lineColor = DirectorStyles.Instance.customSkin.colorClipBlendLines; // Center body GUI.Label(clipCenterSection, GUIContent.none, clipStyle); // Blend/Mix In if (blends.inKind != BlendKind.None) { var mixInRect = blends.inRect; if (blends.inKind == BlendKind.Ease) { ClipRenderer.RenderTexture(mixInRect, texture, Styles.blendMixInBckg, Color.black); if (!selected) { Graphics.DrawLineAA(2.5f, new Vector3(mixInRect.xMin, mixInRect.yMax - 1f, 0), new Vector3(mixInRect.xMax, mixInRect.yMin + 1f, 0), lineColor); } } else { var blendInColor = selected ? Color.black : DirectorStyles.Instance.customSkin.colorClipBlendYin; ClipRenderer.RenderTexture(mixInRect, texture, Styles.blendEaseInBckg, blendInColor); if (!selected) { Graphics.DrawLineAA(2.0f, new Vector3(mixInRect.xMin, mixInRect.yMin + 1f, 0), new Vector3(mixInRect.xMax, mixInRect.yMax - 1f, 0), lineColor); } } Graphics.DrawLineAA(2.0f, mixInRect.max, new Vector2(mixInRect.xMax, mixInRect.yMin), lineColor); } // Blend/Mix Out if (blends.outKind != BlendKind.None) { var mixOutRect = blends.outRect; if (blends.outKind == BlendKind.Ease) { ClipRenderer.RenderTexture(mixOutRect, texture, Styles.blendMixOutBckg, Color.black); if (!selected) { Graphics.DrawLineAA(2.5f, new Vector3(mixOutRect.xMin, mixOutRect.yMin + 1f, 0), new Vector3(mixOutRect.xMax, mixOutRect.yMax - 1f, 0), lineColor); } } else { var blendOutColor = selected ? Color.black : DirectorStyles.Instance.customSkin.colorClipBlendYang; ClipRenderer.RenderTexture(mixOutRect, texture, Styles.blendEaseOutBckg, blendOutColor); if (!selected) { Graphics.DrawLineAA(2.0f, new Vector3(mixOutRect.xMin, mixOutRect.yMin + 1f, 0), new Vector3(mixOutRect.xMax, mixOutRect.yMax - 1f, 0), lineColor); } } Graphics.DrawLineAA(2.0f, mixOutRect.min, new Vector2(mixOutRect.xMin, mixOutRect.yMax), lineColor); } }