protected void DrawTrackState(Rect trackRect, Rect expandedRect, TrackAsset track) { if (Event.current.type == EventType.Layout) { bool needStateBox = false; //Mute if (track.muted && !TimelineUtility.IsParentMuted(track)) { Rect bgRect = expandedRect; TimelineWindow.instance.OverlayDrawData.Add(OverlayDrawer.CreateColorOverlay( GUIClip.Unclip(bgRect), DirectorStyles.Instance.customSkin.colorTrackDarken)); needStateBox = true; } //Lock if (!needStateBox && track.locked && !TimelineUtility.IsLockedFromGroup(track)) { Rect bgRect = expandedRect; TimelineWindow.instance.OverlayDrawData.Add(OverlayDrawer.CreateTextureOverlay( GUIClip.Unclip(bgRect), Styles.lockBg)); needStateBox = true; } if (needStateBox) { DrawTrackStateBox(trackRect, track); } } }
static void DrawTrackStateBox(Rect trackRect, TrackAsset track) { var styles = DirectorStyles.Instance; bool locked = track.locked && !TimelineUtility.IsLockedFromGroup(track); bool muted = track.muted && !TimelineUtility.IsParentMuted(track); bool allSubTrackMuted = TimelineUtility.IsAllSubTrackMuted(track); GUIContent content = null; if (locked && muted) { content = Styles.s_LockedAndMuted; if (!allSubTrackMuted) { content = Styles.s_LockedAndPartiallyMuted; } } else if (locked) { content = Styles.s_Locked; } else if (muted) { content = Styles.s_Muted; if (!allSubTrackMuted) { content = Styles.s_PartiallyMuted; } } // the track could be locked, but we only show the 'locked portion' on the upper most track // that is causing the lock if (content == null) { return; } Rect textRect = Graphics.CalculateTextBoxSize(trackRect, styles.fontClip, content, WindowConstants.overlayTextPadding); TimelineWindow.instance.OverlayDrawData.Add( OverlayDrawer.CreateTextBoxOverlay( GUIClip.Unclip(textRect), content.text, styles.fontClip, Color.white, styles.customSkin.colorLockTextBG, styles.displayBackground)); }
static void DrawMuteOverlay(DrawData data) { DirectorStyles styles = TimelineWindow.styles; var colorOverlay = OverlayDrawer.CreateColorOverlay(GUIClip.Unclip(data.contentRect), styles.customSkin.colorTrackDarken); colorOverlay.Draw(); Rect textRect = Graphics.CalculateTextBoxSize(data.contentRect, styles.fontClip, k_Muted, WindowConstants.overlayTextPadding); var boxOverlay = OverlayDrawer.CreateTextBoxOverlay( GUIClip.Unclip(textRect), k_Muted.text, styles.fontClip, Color.white, styles.customSkin.colorLockTextBG, styles.displayBackground); boxOverlay.Draw(); }