summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers
diff options
context:
space:
mode:
Diffstat (limited to 'Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers')
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/AnimationTrackDrawer.cs86
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/AnimationTrackDrawer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/ClipDrawer.cs678
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/ClipDrawer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/InfiniteTrackDrawer.cs86
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/InfiniteTrackDrawer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers.meta8
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ClipsLayer.cs57
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ClipsLayer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ItemsLayer.cs134
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ItemsLayer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/MarkersLayer.cs80
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/MarkersLayer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackDrawer.cs51
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackDrawer.cs.meta11
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackItemsDrawer.cs42
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackItemsDrawer.cs.meta11
17 files changed, 1310 insertions, 0 deletions
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/AnimationTrackDrawer.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/AnimationTrackDrawer.cs
new file mode 100644
index 0000000..0e9ef89
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/AnimationTrackDrawer.cs
@@ -0,0 +1,86 @@
+using System;
+using System.ComponentModel;
+using System.Linq;
+using JetBrains.Annotations;
+using UnityEngine;
+using UnityEditor;
+using UnityEngine.Timeline;
+
+namespace UnityEditor.Timeline
+{
+ [CustomTrackDrawer(typeof(AnimationTrack)), UsedImplicitly]
+ class AnimationTrackDrawer : TrackDrawer
+ {
+ internal static class Styles
+ {
+ public static readonly GUIContent AnimationButtonOnTooltip = EditorGUIUtility.TrTextContent("", "Avatar Mask enabled\nClick to disable");
+ public static readonly GUIContent AnimationButtonOffTooltip = EditorGUIUtility.TrTextContent("", "Avatar Mask disabled\nClick to enable");
+ }
+
+ public override bool DrawTrackHeaderButton(Rect rect, TrackAsset track, WindowState state)
+ {
+ var animTrack = track as AnimationTrack;
+ bool hasAvatarMask = animTrack != null && animTrack.avatarMask != null;
+ if (hasAvatarMask)
+ {
+ var style = animTrack.applyAvatarMask
+ ? DirectorStyles.Instance.avatarMaskOn
+ : DirectorStyles.Instance.avatarMaskOff;
+ var tooltip = animTrack.applyAvatarMask
+ ? Styles.AnimationButtonOnTooltip
+ : Styles.AnimationButtonOffTooltip;
+ if (GUI.Button(rect, tooltip, style))
+ {
+ animTrack.applyAvatarMask = !animTrack.applyAvatarMask;
+ if (state != null)
+ state.rebuildGraph = true;
+ }
+ }
+ return hasAvatarMask;
+ }
+
+ public override void DrawRecordingBackground(Rect trackRect, TrackAsset trackAsset, Vector2 visibleTime, WindowState state)
+ {
+ base.DrawRecordingBackground(trackRect, trackAsset, visibleTime, state);
+ DrawBorderOfAddedRecordingClip(trackRect, trackAsset, visibleTime, (WindowState)state);
+ }
+
+ static void DrawBorderOfAddedRecordingClip(Rect trackRect, TrackAsset trackAsset, Vector2 visibleTime, WindowState state)
+ {
+ if (!state.IsArmedForRecord(trackAsset))
+ return;
+
+ AnimationTrack animTrack = trackAsset as AnimationTrack;
+ if (animTrack == null || !animTrack.inClipMode)
+ return;
+
+ // make sure there is no clip but we can add one
+ TimelineClip clip = null;
+ if (trackAsset.FindRecordingClipAtTime(state.editSequence.time, out clip) || clip != null)
+ return;
+
+ float yMax = trackRect.yMax;
+ float yMin = trackRect.yMin;
+
+ double startGap = 0;
+ double endGap = 0;
+
+ trackAsset.GetGapAtTime(state.editSequence.time, out startGap, out endGap);
+ if (double.IsInfinity(endGap))
+ endGap = visibleTime.y;
+
+ if (startGap > visibleTime.y || endGap < visibleTime.x)
+ return;
+
+
+ startGap = Math.Max(startGap, visibleTime.x);
+ endGap = Math.Min(endGap, visibleTime.y);
+
+ float xMin = state.TimeToPixel(startGap);
+ float xMax = state.TimeToPixel(endGap);
+
+ var r = Rect.MinMaxRect(xMin, yMin, xMax, yMax);
+ ClipDrawer.DrawClipSelectionBorder(r, ClipBorder.Recording(), ClipBlends.kNone);
+ }
+ }
+}
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/AnimationTrackDrawer.cs.meta b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/AnimationTrackDrawer.cs.meta
new file mode 100644
index 0000000..20fed76
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/AnimationTrackDrawer.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: cb281723220c9964094e6c52e0ece792
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/ClipDrawer.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/ClipDrawer.cs
new file mode 100644
index 0000000..266e465
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/ClipDrawer.cs
@@ -0,0 +1,678 @@
+using System;
+using UnityEngine.Timeline;
+using UnityEngine;
+using System.Linq;
+using System.Collections.Generic;
+
+namespace UnityEditor.Timeline
+{
+ enum BlendKind
+ {
+ None,
+ Ease,
+ Mix
+ }
+
+ enum BlendAngle
+ {
+ Descending,
+ Ascending
+ }
+
+ struct IconData
+ {
+ public enum Side { Left = -1, Right = 1 }
+
+ public Texture2D icon;
+ public Color tint;
+
+ public float width { get { return 16; } }
+ public float height { get { return 16; } }
+
+ public IconData(Texture2D icon)
+ {
+ this.icon = icon;
+ tint = Color.white;
+ }
+ }
+
+ class ClipBorder
+ {
+ public readonly Color color;
+ public readonly float thickness;
+
+ ClipBorder(Color color, float thickness)
+ {
+ this.color = color;
+ this.thickness = thickness;
+ }
+
+ const float k_ClipSelectionBorder = 1.0f;
+ const float k_ClipRecordingBorder = 2.0f;
+
+ public static ClipBorder Recording()
+ {
+ return new ClipBorder(DirectorStyles.Instance.customSkin.colorRecordingClipOutline, k_ClipRecordingBorder);
+ }
+
+ public static ClipBorder Selection()
+ {
+ return new ClipBorder(Color.white, k_ClipSelectionBorder);
+ }
+
+ public static ClipBorder Default()
+ {
+ return new ClipBorder(DirectorStyles.Instance.customSkin.clipBorderColor, k_ClipSelectionBorder);
+ }
+ }
+
+ struct ClipBlends
+ {
+ public readonly BlendKind inKind;
+ public readonly Rect inRect;
+
+ public readonly BlendKind outKind;
+ public readonly Rect outRect;
+
+ public ClipBlends(BlendKind inKind, Rect inRect, BlendKind outKind, Rect outRect)
+ {
+ this.inKind = inKind;
+ this.inRect = inRect;
+ this.outKind = outKind;
+ this.outRect = outRect;
+ }
+
+ public static readonly ClipBlends kNone = new ClipBlends(BlendKind.None, Rect.zero, BlendKind.None, Rect.zero);
+ }
+
+ struct ClipDrawData
+ {
+ public TimelineClip clip; // clip being drawn
+ public Rect targetRect; // rectangle to draw to
+ public Rect unclippedRect; // the clip's unclipped rect
+ public Rect clippedRect; // the clip's clipped rect to the visible time area
+ public Rect clipCenterSection; // clip center section
+ public string title; // clip title
+ public bool selected; // is the clip selected
+ public bool inlineCurvesSelected; // is the inline curve of the clip selected
+ public double localVisibleStartTime;
+ public double localVisibleEndTime;
+ public IconData[] leftIcons;
+ public IconData[] rightIcons;
+ public TimelineClip previousClip;
+ public bool previousClipSelected;
+ public bool supportsLooping;
+ public int minLoopIndex;
+ public List<Rect> loopRects;
+ public ClipBlends clipBlends;
+ public ClipDrawOptions ClipDrawOptions;
+ public ClipEditor clipEditor;
+ }
+
+ static class ClipDrawer
+ {
+ public static class Styles
+ {
+ public static readonly Texture2D iconWarn = EditorGUIUtility.LoadIconRequired("console.warnicon.inactive.sml");
+ public static readonly string HoldText = LocalizationDatabase.GetLocalizedString("HOLD");
+ public static readonly Texture2D s_IconNoRecord = EditorGUIUtility.LoadIcon("console.erroricon.sml");
+ public static readonly GUIContent s_ClipNotRecorable = EditorGUIUtility.TrTextContent("", "This clip is not recordable");
+ public static readonly GUIContent s_ClipNoRecordInBlend = EditorGUIUtility.TrTextContent("", "Recording in blends in prohibited");
+ }
+
+ const float k_ClipSwatchLineThickness = 4.0f;
+ const float k_MinClipWidth = 7.0f;
+ const float k_ClipInOutMinWidth = 15.0f;
+ const float k_ClipLoopsMinWidth = 20.0f;
+ const float k_ClipLabelPadding = 6.0f;
+ const float k_ClipLabelMinWidth = 10.0f;
+ const float k_IconsPadding = 1.0f;
+ const float k_ClipInlineWidth = 1.0f;
+
+ static readonly GUIContent s_TitleContent = new GUIContent();
+ static readonly IconData[] k_ClipErrorIcons = { new IconData {icon = Styles.iconWarn, tint = DirectorStyles.kClipErrorColor} };
+ static readonly Dictionary<int, string> s_LoopStringCache = new Dictionary<int, string>(100);
+
+ // caches the loopstring to avoid allocation from string concats
+ static string GetLoopString(int loopIndex)
+ {
+ string loopString = null;
+ if (!s_LoopStringCache.TryGetValue(loopIndex, out loopString))
+ {
+ loopString = "L" + loopIndex;
+ s_LoopStringCache[loopIndex] = loopString;
+ }
+ return loopString;
+ }
+
+ static void DrawLoops(ClipDrawData drawData)
+ {
+ if (drawData.loopRects == null || drawData.loopRects.Count == 0)
+ return;
+
+ var oldColor = GUI.color;
+
+ int loopIndex = drawData.minLoopIndex;
+ for (int l = 0; l < drawData.loopRects.Count; l++)
+ {
+ Rect theRect = drawData.loopRects[l];
+ theRect.x -= drawData.unclippedRect.x;
+ theRect.x += 1;
+ theRect.width -= 2.0f;
+ theRect.y = 5.0f;
+ theRect.height -= 4.0f;
+ theRect.xMin -= 4f;
+
+ if (theRect.width >= 5f)
+ {
+ using (new GUIViewportScope(drawData.clipCenterSection))
+ {
+ GUI.color = new Color(0.0f, 0.0f, 0.0f, 0.2f);
+ GUI.Label(theRect, GUIContent.none, DirectorStyles.Instance.displayBackground);
+
+ if (theRect.width > 36.0f)
+ {
+ var style = DirectorStyles.Instance.fontClipLoop;
+ GUI.color = new Color(0.0f, 0.0f, 0.0f, 0.3f);
+ var loopContent = new GUIContent(drawData.supportsLooping ? GetLoopString(loopIndex) : Styles.HoldText);
+ GUI.Label(theRect, loopContent, style);
+ }
+ }
+ }
+
+ loopIndex++;
+
+ if (!drawData.supportsLooping)
+ break;
+ }
+
+ GUI.color = oldColor;
+ }
+
+ static void DrawClipBorder(ClipDrawData drawData)
+ {
+ var animTrack = drawData.clip.parentTrack as AnimationTrack;
+ var selectionBorder = ClipBorder.Selection();
+
+ if (TimelineWindow.instance.state.recording && animTrack == null && drawData.clip.parentTrack.IsRecordingToClip(drawData.clip))
+ {
+ DrawClipSelectionBorder(drawData.clipCenterSection, selectionBorder, drawData.clipBlends);
+ return;
+ }
+
+ DrawClipDefaultBorder(drawData.clipCenterSection, ClipBorder.Default(), drawData.clipBlends);
+
+ if (drawData.selected)
+ DrawClipSelectionBorder(drawData.clipCenterSection, selectionBorder, drawData.clipBlends);
+
+ if (drawData.previousClip != null && drawData.previousClipSelected)
+ DrawClipBlendSelectionBorder(drawData.clipCenterSection, selectionBorder, drawData.clipBlends);
+ }
+
+ public static void DrawClipSelectionBorder(Rect clipRect, ClipBorder border, ClipBlends blends)
+ {
+ var thickness = border.thickness;
+ var color = border.color;
+ var min = clipRect.min;
+ var max = clipRect.max;
+
+ //Left line
+ if (blends.inKind == BlendKind.None)
+ EditorGUI.DrawRect(new Rect(min.x, min.y, thickness, max.y - min.y), color);
+ else
+ DrawBlendLine(blends.inRect, blends.inKind == BlendKind.Mix ? BlendAngle.Descending : BlendAngle.Ascending, thickness, color);
+
+ //Right line
+ if (blends.outKind == BlendKind.None)
+ EditorGUI.DrawRect(new Rect(max.x - thickness, min.y, thickness, max.y - min.y), color);
+ else
+ DrawBlendLine(blends.outRect, BlendAngle.Descending, thickness, color);
+
+ //Top line
+ var xTop1 = blends.inKind == BlendKind.Mix ? blends.inRect.xMin : min.x;
+ var xTop2 = max.x;
+ EditorGUI.DrawRect(new Rect(xTop1, min.y, xTop2 - xTop1, thickness), color);
+
+ //Bottom line
+ var xBottom1 = blends.inKind == BlendKind.Ease ? blends.inRect.xMin : min.x;
+ var xBottom2 = blends.outKind == BlendKind.None ? max.x : blends.outRect.xMax;
+ EditorGUI.DrawRect(new Rect(xBottom1, max.y - thickness, xBottom2 - xBottom1, thickness), color);
+ }
+
+ static Vector3[] s_BlendLines = new Vector3[4];
+ static void DrawBlendLine(Rect rect, BlendAngle blendAngle, float width, Color color)
+ {
+ var halfWidth = width / 2.0f;
+ Vector2 p0, p1;
+ var inverse = 1.0f;
+ if (blendAngle == BlendAngle.Descending)
+ {
+ p0 = rect.min;
+ p1 = rect.max;
+ }
+ else
+ {
+ p0 = new Vector2(rect.xMax, rect.yMin);
+ p1 = new Vector2(rect.xMin, rect.yMax);
+ inverse = -1.0f;
+ }
+ s_BlendLines[0] = new Vector3(p0.x - halfWidth, p0.y + halfWidth * inverse);
+ s_BlendLines[1] = new Vector3(p1.x - halfWidth, p1.y + halfWidth * inverse);
+ s_BlendLines[2] = new Vector3(p1.x + halfWidth, p1.y - halfWidth * inverse);
+ s_BlendLines[3] = new Vector3(p0.x + halfWidth, p0.y - halfWidth * inverse);
+ Graphics.DrawPolygonAA(color, s_BlendLines);
+ }
+
+ static void DrawClipBlendSelectionBorder(Rect clipRect, ClipBorder border, ClipBlends blends)
+ {
+ var color = border.color;
+ var thickness = border.thickness;
+ if (blends.inKind == BlendKind.Mix)
+ {
+ DrawBlendLine(blends.inRect, BlendAngle.Descending, thickness, color);
+ var xBottom1 = blends.inRect.xMin;
+ var xBottom2 = blends.inRect.xMax;
+ EditorGUI.DrawRect(new Rect(xBottom1, clipRect.max.y - thickness, xBottom2 - xBottom1, thickness), color);
+ }
+ }
+
+ static void DrawClipDefaultBorder(Rect clipRect, ClipBorder border, ClipBlends blends)
+ {
+ var color = border.color;
+ var thickness = border.thickness;
+
+ // Draw vertical lines at the edges of the clip
+ EditorGUI.DrawRect(new Rect(clipRect.xMin, clipRect.y, thickness, clipRect.height), color); //left
+ //only draw the right one when no out mix blend
+ if (blends.outKind != BlendKind.Mix)
+ EditorGUI.DrawRect(new Rect(clipRect.xMax - thickness, clipRect.y, thickness, clipRect.height), color); //right
+ //draw a vertical line for the previous clip
+ if (blends.inKind == BlendKind.Mix)
+ EditorGUI.DrawRect(new Rect(blends.inRect.xMin, blends.inRect.y, thickness, blends.inRect.height), color); //left
+
+ //Draw blend line
+ if (blends.inKind == BlendKind.Mix)
+ DrawBlendLine(blends.inRect, BlendAngle.Descending, thickness, color);
+ }
+
+ static void DrawClipTimescale(Rect targetRect, Rect clippedRect, double timeScale)
+ {
+ if (timeScale != 1.0)
+ {
+ const float xOffset = 4.0f;
+ const float yOffset = 6.0f;
+ var segmentLength = timeScale > 1.0f ? 5.0f : 15.0f;
+
+ // clamp to the visible region to reduce the line count (case 1213189), but adject the start segment to match the visuals of drawing targetRect
+ var startX = clippedRect.min.x - ((clippedRect.min.x - targetRect.min.x) % (segmentLength*2));
+ var endX = clippedRect.max.x;
+
+ var start = new Vector3(startX + xOffset, targetRect.min.y + yOffset, 0.0f);
+ var end = new Vector3(endX - xOffset, targetRect.min.y + yOffset, 0.0f);
+
+ Graphics.DrawDottedLine(start, end, segmentLength, DirectorStyles.Instance.customSkin.colorClipFont);
+ Graphics.DrawDottedLine(start + new Vector3(0.0f, 1.0f, 0.0f), end + new Vector3(0.0f, 1.0f, 0.0f), segmentLength, DirectorStyles.Instance.customSkin.colorClipFont);
+ }
+ }
+
+ static void DrawClipInOut(Rect targetRect, TimelineClip clip)
+ {
+ var assetDuration = TimelineHelpers.GetClipAssetEndTime(clip);
+
+ bool drawClipOut = assetDuration<double.MaxValue &&
+ assetDuration - clip.end> TimeUtility.kTimeEpsilon;
+
+ bool drawClipIn = clip.clipIn > 0.0;
+
+ if (!drawClipIn && !drawClipOut)
+ return;
+
+ var rect = targetRect;
+
+ if (drawClipOut)
+ {
+ var icon = DirectorStyles.Instance.clipOut;
+ var iconRect = new Rect(rect.xMax - icon.fixedWidth - 2.0f,
+ rect.yMin + (rect.height - icon.fixedHeight) * 0.5f,
+ icon.fixedWidth, icon.fixedHeight);
+
+ GUI.Label(iconRect, GUIContent.none, icon);
+ }
+
+ if (drawClipIn)
+ {
+ var icon = DirectorStyles.Instance.clipIn;
+ var iconRect = new Rect(2.0f + rect.xMin,
+ rect.yMin + (rect.height - icon.fixedHeight) * 0.5f,
+ icon.fixedWidth, icon.fixedHeight);
+
+ GUI.Label(iconRect, GUIContent.none, icon);
+ }
+ }
+
+ static void DrawClipLabel(ClipDrawData data, Rect availableRect, Color color)
+ {
+ var errorText = data.ClipDrawOptions.errorText;
+ var hasError = !string.IsNullOrEmpty(errorText);
+ var textColor = hasError ? DirectorStyles.kClipErrorColor : color;
+ var tooltip = hasError ? errorText : data.ClipDrawOptions.tooltip;
+
+ if (hasError)
+ DrawClipLabel(data.title, availableRect, textColor, k_ClipErrorIcons, null, tooltip);
+ else
+ DrawClipLabel(data.title, availableRect, textColor, data.leftIcons, data.rightIcons, tooltip);
+ }
+
+ static void DrawClipLabel(string title, Rect availableRect, Color color, string errorText = "")
+ {
+ var hasError = !string.IsNullOrEmpty(errorText);
+ var textColor = hasError ? DirectorStyles.kClipErrorColor : color;
+
+ if (hasError)
+ DrawClipLabel(title, availableRect, textColor, k_ClipErrorIcons, null, errorText);
+ else
+ DrawClipLabel(title, availableRect, textColor, null, null, errorText);
+ }
+
+ static void DrawClipLabel(string title, Rect availableRect, Color textColor, IconData[] leftIcons, IconData[] rightIcons, string tooltipMessage = "")
+ {
+ s_TitleContent.text = title;
+ var neededTextWidth = DirectorStyles.Instance.fontClip.CalcSize(s_TitleContent).x;
+ var neededIconWidthLeft = 0.0f;
+ var neededIconWidthRight = 0.0f;
+
+ if (leftIcons != null)
+ for (int i = 0, n = leftIcons.Length; i < n; ++i)
+ neededIconWidthLeft += leftIcons[i].width + k_IconsPadding;
+
+ if (rightIcons != null)
+ for (int i = 0, n = rightIcons.Length; i < n; ++i)
+ neededIconWidthRight += rightIcons[i].width + k_IconsPadding;
+
+ var neededIconWidth = Mathf.Max(neededIconWidthLeft, neededIconWidthRight);
+
+ // Atomic operation: We either show all icons or no icons at all
+ var showIcons = neededTextWidth / 2.0f + neededIconWidth < availableRect.width / 2.0f;
+
+ if (showIcons)
+ {
+ if (leftIcons != null)
+ DrawClipIcons(leftIcons, IconData.Side.Left, neededTextWidth, availableRect);
+
+ if (rightIcons != null)
+ DrawClipIcons(rightIcons, IconData.Side.Right, neededTextWidth, availableRect);
+ }
+
+ if (neededTextWidth > availableRect.width)
+ s_TitleContent.text = DirectorStyles.Elipsify(title, availableRect.width, neededTextWidth);
+
+ s_TitleContent.tooltip = tooltipMessage;
+ DrawClipName(availableRect, s_TitleContent, textColor);
+ }
+
+ static void DrawClipIcons(IconData[] icons, IconData.Side side, float labelWidth, Rect availableRect)
+ {
+ var halfText = labelWidth / 2.0f;
+ var offset = halfText + k_IconsPadding;
+
+ foreach (var iconData in icons)
+ {
+ offset += iconData.width / 2.0f + k_IconsPadding;
+
+ var iconRect =
+ new Rect(0.0f, 0.0f, iconData.width, iconData.height)
+ {
+ center = new Vector2(availableRect.center.x + offset * (int)side, availableRect.center.y)
+ };
+
+ DrawIcon(iconRect, iconData.tint, iconData.icon);
+
+ offset += iconData.width / 2.0f;
+ }
+ }
+
+ static void DrawClipName(Rect rect, GUIContent content, Color textColor)
+ {
+ Graphics.ShadowLabel(rect, content, DirectorStyles.Instance.fontClip, textColor, Color.black);
+ }
+
+ static void DrawIcon(Rect imageRect, Color color, Texture2D icon)
+ {
+ GUI.DrawTexture(imageRect, icon, ScaleMode.ScaleAndCrop, true, 0, color, 0, 0);
+ }
+
+ static void DrawClipBackground(Rect clipCenterSection, bool selected)
+ {
+ if (Event.current.type != EventType.Repaint)
+ return;
+
+ var color = selected ? DirectorStyles.Instance.customSkin.clipSelectedBckg : DirectorStyles.Instance.customSkin.clipBckg;
+ EditorGUI.DrawRect(clipCenterSection, color);
+ }
+
+ static Vector3[] s_BlendVertices = new Vector3[3];
+ static void DrawClipBlends(ClipBlends blends, Color inColor, Color outColor, Color backgroundColor)
+ {
+ switch (blends.inKind)
+ {
+ case BlendKind.Ease:
+ // 2
+ // / |
+ // / |
+ // 0---1
+ EditorGUI.DrawRect(blends.inRect, backgroundColor);
+ s_BlendVertices[0] = new Vector3(blends.inRect.xMin, blends.inRect.yMax);
+ s_BlendVertices[1] = new Vector3(blends.inRect.xMax, blends.inRect.yMax);
+ s_BlendVertices[2] = new Vector3(blends.inRect.xMax, blends.inRect.yMin);
+ Graphics.DrawPolygonAA(inColor, s_BlendVertices);
+ break;
+ case BlendKind.Mix:
+ // 0---2
+ // \ |
+ // \ |
+ // 1
+ s_BlendVertices[0] = new Vector3(blends.inRect.xMin, blends.inRect.yMin);
+ s_BlendVertices[1] = new Vector3(blends.inRect.xMax, blends.inRect.yMax);
+ s_BlendVertices[2] = new Vector3(blends.inRect.xMax, blends.inRect.yMin);
+ Graphics.DrawPolygonAA(inColor, s_BlendVertices);
+ break;
+ }
+
+ if (blends.outKind != BlendKind.None)
+ {
+ if (blends.outKind == BlendKind.Ease)
+ EditorGUI.DrawRect(blends.outRect, backgroundColor);
+ // 0
+ // | \
+ // | \
+ // 1---2
+ s_BlendVertices[0] = new Vector3(blends.outRect.xMin, blends.outRect.yMin);
+ s_BlendVertices[1] = new Vector3(blends.outRect.xMin, blends.outRect.yMax);
+ s_BlendVertices[2] = new Vector3(blends.outRect.xMax, blends.outRect.yMax);
+ Graphics.DrawPolygonAA(outColor, s_BlendVertices);
+ }
+ }
+
+ static void DrawClipSwatch(Rect targetRect, Color swatchColor)
+ {
+ // Draw Colored Line at the bottom.
+ var colorRect = targetRect;
+ colorRect.yMin = colorRect.yMax - k_ClipSwatchLineThickness;
+ EditorGUI.DrawRect(colorRect, swatchColor);
+ }
+
+ public static void DrawSimpleClip(TimelineClip clip, Rect targetRect, ClipBorder border, Color overlay, ClipDrawOptions drawOptions)
+ {
+ GUI.BeginClip(targetRect);
+ var clipRect = new Rect(0.0f, 0.0f, targetRect.width, targetRect.height);
+
+ var orgColor = GUI.color;
+ GUI.color = overlay;
+
+ DrawClipBackground(clipRect, false);
+ GUI.color = orgColor;
+
+ if (clipRect.width <= k_MinClipWidth)
+ {
+ clipRect.width = k_MinClipWidth;
+ }
+
+ DrawClipSwatch(targetRect, drawOptions.highlightColor * overlay);
+
+ if (targetRect.width >= k_ClipInOutMinWidth)
+ DrawClipInOut(clipRect, clip);
+
+ var textRect = clipRect;
+
+ textRect.xMin += k_ClipLabelPadding;
+ textRect.xMax -= k_ClipLabelPadding;
+
+ if (textRect.width > k_ClipLabelMinWidth)
+ DrawClipLabel(clip.displayName, textRect, Color.white, drawOptions.errorText);
+
+ if (border != null)
+ DrawClipSelectionBorder(clipRect, border, ClipBlends.kNone);
+
+ GUI.EndClip();
+ }
+
+ public static void DrawDefaultClip(ClipDrawData drawData)
+ {
+ var customSkin = DirectorStyles.Instance.customSkin;
+ var blendInColor = drawData.selected ? customSkin.clipBlendInSelected : customSkin.clipBlendIn;
+ var blendOutColor = drawData.selected ? customSkin.clipBlendOutSelected : customSkin.clipBlendOut;
+ var easeBackgroundColor = customSkin.clipEaseBckgColor;
+
+ DrawClipBlends(drawData.clipBlends, blendInColor, blendOutColor, easeBackgroundColor);
+ DrawClipBackground(drawData.clipCenterSection, drawData.selected);
+
+ if (drawData.targetRect.width > k_MinClipWidth)
+ {
+ DrawClipEditorBackground(drawData);
+ }
+ else
+ {
+ drawData.targetRect.width = k_MinClipWidth;
+ drawData.clipCenterSection.width = k_MinClipWidth;
+ }
+
+ DrawClipTimescale(drawData.targetRect, drawData.clippedRect, drawData.clip.timeScale);
+
+ if (drawData.targetRect.width >= k_ClipInOutMinWidth)
+ DrawClipInOut(drawData.targetRect, drawData.clip);
+
+ var labelRect = drawData.clipCenterSection;
+
+ if (drawData.targetRect.width >= k_ClipLoopsMinWidth)
+ {
+ bool selected = drawData.selected || drawData.inlineCurvesSelected;
+
+ if (selected)
+ {
+ if (drawData.loopRects != null && drawData.loopRects.Any())
+ {
+ DrawLoops(drawData);
+
+ var l = drawData.loopRects[0];
+ labelRect.xMax = Math.Min(labelRect.xMax, l.x - drawData.unclippedRect.x);
+ }
+ }
+ }
+
+ labelRect.xMin += k_ClipLabelPadding;
+ labelRect.xMax -= k_ClipLabelPadding;
+
+ if (labelRect.width > k_ClipLabelMinWidth)
+ {
+ DrawClipLabel(drawData, labelRect, Color.white);
+ }
+
+ DrawClipSwatch(drawData.targetRect, drawData.ClipDrawOptions.highlightColor);
+ DrawClipBorder(drawData);
+ }
+
+ static void DrawClipEditorBackground(ClipDrawData drawData)
+ {
+ var isRepaint = (Event.current.type == EventType.Repaint);
+ if (isRepaint && drawData.clipEditor != null)
+ {
+ var customBodyRect = drawData.clippedRect;
+ customBodyRect.yMin += k_ClipInlineWidth;
+ customBodyRect.yMax -= k_ClipSwatchLineThickness;
+ var region = new ClipBackgroundRegion(customBodyRect, drawData.localVisibleStartTime, drawData.localVisibleEndTime);
+ try
+ {
+ drawData.clipEditor.DrawBackground(drawData.clip, region);
+ }
+ catch (Exception e)
+ {
+ Debug.LogException(e);
+ }
+ }
+ }
+
+ public static void DrawAnimationRecordBorder(ClipDrawData drawData)
+ {
+ if (!drawData.clip.parentTrack.IsRecordingToClip(drawData.clip))
+ return;
+
+ var time = new DiscreteTime(TimelineWindow.instance.state.editSequence.time);
+ var start = new DiscreteTime(drawData.clip.start + drawData.clip.mixInDuration);
+ var end = new DiscreteTime(drawData.clip.end - drawData.clip.mixOutDuration);
+
+ if (time < start || time >= end)
+ return;
+
+ DrawClipSelectionBorder(drawData.clipCenterSection, ClipBorder.Recording(), ClipBlends.kNone);
+ }
+
+ public static void DrawRecordProhibited(ClipDrawData drawData)
+ {
+ DrawRecordInvalidClip(drawData);
+ DrawRecordOnBlend(drawData);
+ }
+
+ public static void DrawRecordOnBlend(ClipDrawData drawData)
+ {
+ double time = TimelineWindow.instance.state.editSequence.time;
+ if (time >= drawData.clip.start && time < drawData.clip.start + drawData.clip.mixInDuration)
+ {
+ Rect r = Rect.MinMaxRect(drawData.clippedRect.xMin, drawData.clippedRect.yMin, drawData.clipCenterSection.xMin, drawData.clippedRect.yMax);
+ DrawInvalidRecordIcon(r, Styles.s_ClipNoRecordInBlend);
+ }
+
+ if (time <= drawData.clip.end && time > drawData.clip.end - drawData.clip.mixOutDuration)
+ {
+ Rect r = Rect.MinMaxRect(drawData.clipCenterSection.xMax, drawData.clippedRect.yMin, drawData.clippedRect.xMax, drawData.clippedRect.yMax);
+ DrawInvalidRecordIcon(r, Styles.s_ClipNoRecordInBlend);
+ }
+ }
+
+ public static void DrawRecordInvalidClip(ClipDrawData drawData)
+ {
+ if (drawData.clip.recordable)
+ return;
+
+ double time = TimelineWindow.instance.state.editSequence.time;
+ if (time < drawData.clip.start + drawData.clip.mixInDuration || time > drawData.clip.end - drawData.clip.mixOutDuration)
+ return;
+
+ DrawInvalidRecordIcon(drawData.clipCenterSection, Styles.s_ClipNotRecorable);
+ }
+
+ public static void DrawInvalidRecordIcon(Rect rect, GUIContent helpText)
+ {
+ EditorGUI.DrawRect(rect, new Color(0, 0, 0, 0.30f));
+
+ var icon = Styles.s_IconNoRecord;
+ if (rect.width < icon.width || rect.height < icon.height)
+ return;
+
+ float x = rect.x + (rect.width - icon.width) * 0.5f;
+ float y = rect.y + (rect.height - icon.height) * 0.5f;
+ Rect r = new Rect(x, y, icon.width, icon.height);
+ GUI.Label(r, helpText);
+ GUI.DrawTexture(r, icon, ScaleMode.ScaleAndCrop, true, 0, Color.white, 0, 0);
+ }
+ }
+}
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/ClipDrawer.cs.meta b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/ClipDrawer.cs.meta
new file mode 100644
index 0000000..e1493e6
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/ClipDrawer.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 63118a0c9ee42ac46b7f30e793177a76
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/InfiniteTrackDrawer.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/InfiniteTrackDrawer.cs
new file mode 100644
index 0000000..b2c5d7f
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/InfiniteTrackDrawer.cs
@@ -0,0 +1,86 @@
+using UnityEngine;
+using UnityEngine.Timeline;
+
+namespace UnityEditor.Timeline
+{
+ class InfiniteTrackDrawer : TrackDrawer
+ {
+ readonly IPropertyKeyDataSource m_DataSource;
+ Rect m_TrackRect;
+
+ public InfiniteTrackDrawer(IPropertyKeyDataSource dataSource)
+ {
+ m_DataSource = dataSource;
+ }
+
+ public bool CanDraw(TrackAsset track, WindowState state)
+ {
+ var keys = m_DataSource.GetKeys();
+ var isTrackEmpty = track.clips.Length == 0;
+
+ return keys != null || (state.IsArmedForRecord(track) && isTrackEmpty);
+ }
+
+ static void DrawRecordBackground(Rect trackRect)
+ {
+ var styles = DirectorStyles.Instance;
+
+ EditorGUI.DrawRect(trackRect, styles.customSkin.colorInfiniteTrackBackgroundRecording);
+
+ Graphics.ShadowLabel(trackRect,
+ DirectorStyles.Elipsify(DirectorStyles.recordingLabel.text, trackRect, styles.fontClip),
+ styles.fontClip, Color.white, Color.black);
+ }
+
+ public override bool DrawTrack(Rect trackRect, TrackAsset trackAsset, Vector2 visibleTime, WindowState state)
+ {
+ m_TrackRect = trackRect;
+
+ if (!CanDraw(trackAsset, state))
+ return true;
+
+ if (state.recording && state.IsArmedForRecord(trackAsset))
+ DrawRecordBackground(trackRect);
+
+ GUI.Box(trackRect, GUIContent.none, DirectorStyles.Instance.infiniteTrack);
+
+ var shadowRect = trackRect;
+ shadowRect.yMin = shadowRect.yMax;
+ shadowRect.height = 15.0f;
+ if (Event.current.type == EventType.Repaint)
+ DirectorStyles.Instance.bottomShadow.Draw(shadowRect, false, false, false, false);
+
+ var keys = m_DataSource.GetKeys();
+ if (keys != null && keys.Length > 0)
+ {
+ foreach (var k in keys)
+ DrawKeyFrame(k, state);
+ }
+
+ return true;
+ }
+
+ void DrawKeyFrame(float key, WindowState state)
+ {
+ var x = state.TimeToPixel(key);
+ var bounds = new Rect(x, m_TrackRect.yMin + 3.0f, 1.0f, m_TrackRect.height - 6.0f);
+
+ if (!m_TrackRect.Overlaps(bounds))
+ return;
+
+ var iconWidth = DirectorStyles.Instance.keyframe.fixedWidth;
+ var iconHeight = DirectorStyles.Instance.keyframe.fixedHeight;
+
+ var keyframeRect = bounds;
+ keyframeRect.width = iconWidth;
+ keyframeRect.height = iconHeight;
+ keyframeRect.xMin -= iconWidth / 2.0f;
+ keyframeRect.yMin = m_TrackRect.yMin + ((m_TrackRect.height - iconHeight) / 2.0f);
+
+ // case 890650 : Make sure to use GUI.Label and not GUI.Box since the number of key frames can vary while dragging keys in the inline curves causing hotControls to be desynchronized
+ GUI.Label(keyframeRect, GUIContent.none, DirectorStyles.Instance.keyframe);
+
+ EditorGUI.DrawRect(bounds, DirectorStyles.Instance.customSkin.colorInfiniteClipLine);
+ }
+ }
+}
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/InfiniteTrackDrawer.cs.meta b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/InfiniteTrackDrawer.cs.meta
new file mode 100644
index 0000000..fd7c0b5
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/InfiniteTrackDrawer.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 5ea6a8a826704f743b3b0ce3e9d3c9a9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers.meta b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers.meta
new file mode 100644
index 0000000..920cf3a
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 16388ae022a89264b84107f0c1b44680
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ClipsLayer.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ClipsLayer.cs
new file mode 100644
index 0000000..910123e
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ClipsLayer.cs
@@ -0,0 +1,57 @@
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+using UnityEngine.Timeline;
+
+namespace UnityEditor.Timeline
+{
+ class ClipsLayer : ItemsLayer
+ {
+ static readonly GUIStyle k_ConnectorIcon = DirectorStyles.Instance.connector;
+
+ public ClipsLayer(Layer layerOrder, IRowGUI parent) : base(layerOrder)
+ {
+ var track = parent.asset;
+ track.SortClips();
+ TimelineClipGUI previousClipGUI = null;
+
+ foreach (var clip in track.clips)
+ {
+ var oldClipGUI = ItemToItemGui.GetGuiForClip(clip);
+ var isInvalid = oldClipGUI != null && oldClipGUI.isInvalid; // HACK Make sure to carry invalidy state when refereshing the cache.
+
+ var currentClipGUI = new TimelineClipGUI(clip, parent, this) {isInvalid = isInvalid};
+ if (previousClipGUI != null) previousClipGUI.nextClip = currentClipGUI;
+ currentClipGUI.previousClip = previousClipGUI;
+ AddItem(currentClipGUI);
+ previousClipGUI = currentClipGUI;
+ }
+ }
+
+ public override void Draw(Rect rect, WindowState state)
+ {
+ base.Draw(rect, state); //draw clips
+ DrawConnector(items.OfType<TimelineClipGUI>());
+ }
+
+ static void DrawConnector(IEnumerable<TimelineClipGUI> clips)
+ {
+ if (Event.current.type != EventType.Repaint)
+ return;
+
+ foreach (var clip in clips)
+ {
+ if (clip.previousClip != null && clip.visible && clip.treeViewRect.width > 14 &&
+ (DiscreteTime)clip.start == (DiscreteTime)clip.previousClip.end)
+ {
+ // draw little connector widget
+ var localRect = clip.treeViewRect;
+ localRect.x -= Mathf.Floor(k_ConnectorIcon.fixedWidth / 2.0f);
+ localRect.width = k_ConnectorIcon.fixedWidth;
+ localRect.height = k_ConnectorIcon.fixedHeight;
+ GUI.Label(localRect, GUIContent.none, k_ConnectorIcon);
+ }
+ }
+ }
+ }
+}
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ClipsLayer.cs.meta b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ClipsLayer.cs.meta
new file mode 100644
index 0000000..58ef809
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ClipsLayer.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a809a4b50addbf44b9023b5e7f9fd4d2
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ItemsLayer.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ItemsLayer.cs
new file mode 100644
index 0000000..7446d59
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ItemsLayer.cs
@@ -0,0 +1,134 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+using UnityEngine.Timeline;
+
+namespace UnityEditor.Timeline
+{
+ enum Layer : byte
+ {
+ Clips,
+ ClipHandles,
+ Markers,
+ MarkerHeaderTrack,
+ MarkersOnHeader
+ }
+
+ struct LayerZOrder : IComparable<LayerZOrder>
+ {
+ Layer m_Layer;
+ int m_ZOrder;
+
+ public LayerZOrder(Layer layer, int zOrder)
+ {
+ m_Layer = layer;
+ m_ZOrder = zOrder;
+ }
+
+ public int CompareTo(LayerZOrder other)
+ {
+ if (m_Layer == other.m_Layer)
+ return m_ZOrder.CompareTo(other.m_ZOrder);
+ return m_Layer.CompareTo(other.m_Layer);
+ }
+
+ public static LayerZOrder operator++(LayerZOrder x)
+ {
+ return new LayerZOrder(x.m_Layer, x.m_ZOrder + 1);
+ }
+
+ public LayerZOrder ChangeLayer(Layer layer)
+ {
+ return new LayerZOrder(layer, m_ZOrder);
+ }
+ }
+
+ interface ILayerable
+ {
+ LayerZOrder zOrder { get; }
+ }
+
+ interface IZOrderProvider
+ {
+ LayerZOrder Next();
+ }
+
+ abstract class ItemsLayer : IZOrderProvider
+ {
+ // provide a buffer for time-based culling to allow for UI that extends slightly beyong the time (e.g. markers)
+ // prevents popping of marker visibility.
+ private const int kVisibilityBufferInPixels = 10;
+
+ int m_PreviousLayerStateHash = -1;
+ LayerZOrder m_LastZOrder;
+
+ public LayerZOrder Next()
+ {
+ return m_LastZOrder++;
+ }
+
+ readonly List<TimelineItemGUI> m_Items = new List<TimelineItemGUI>();
+ bool m_NeedSort = true;
+
+ public virtual void Draw(Rect rect, WindowState state)
+ {
+ if (!m_Items.Any()) return;
+
+ Sort();
+
+ // buffer to prevent flickering of markers at boundaries
+ var onePixelTime = state.PixelDeltaToDeltaTime(kVisibilityBufferInPixels);
+ var visibleTime = state.timeAreaShownRange + new Vector2(-onePixelTime, onePixelTime);
+ var layerViewStateHasChanged = GetLayerViewStateChanged(rect, state);
+
+ foreach (var item in m_Items)
+ {
+ item.visible = item.end > visibleTime.x && item.start < visibleTime.y;
+ if (!item.visible)
+ continue;
+
+ item.Draw(rect, layerViewStateHasChanged, state);
+ }
+ }
+
+ public IEnumerable<TimelineItemGUI> items
+ {
+ get
+ {
+ return m_Items;
+ }
+ }
+
+ protected void AddItem(TimelineItemGUI item)
+ {
+ m_Items.Add(item);
+ m_NeedSort = true;
+ }
+
+ protected ItemsLayer(Layer layerOrder)
+ {
+ m_LastZOrder = new LayerZOrder(layerOrder, 0);
+ }
+
+ void Sort()
+ {
+ if (!m_NeedSort)
+ return;
+
+ m_Items.Sort((a, b) => a.zOrder.CompareTo(b.zOrder));
+ m_NeedSort = false;
+ }
+
+ bool GetLayerViewStateChanged(Rect rect, WindowState state)
+ {
+ var layerStateHash = rect.GetHashCode().CombineHash(state.viewStateHash);
+ var layerViewStateHasChanged = layerStateHash != m_PreviousLayerStateHash;
+
+ if (Event.current.type == EventType.Layout && layerViewStateHasChanged)
+ m_PreviousLayerStateHash = layerStateHash;
+
+ return layerViewStateHasChanged;
+ }
+ }
+}
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ItemsLayer.cs.meta b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ItemsLayer.cs.meta
new file mode 100644
index 0000000..5ebff18
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ItemsLayer.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ef97f39912c138b4cabdccedfb24093b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/MarkersLayer.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/MarkersLayer.cs
new file mode 100644
index 0000000..50d1432
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/MarkersLayer.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine.Timeline;
+
+namespace UnityEditor.Timeline
+{
+ class MarkersLayer : ItemsLayer
+ {
+ public MarkersLayer(Layer layerOrder, IRowGUI parent) : base(layerOrder)
+ {
+ CreateLists(parent);
+ }
+
+ void CreateLists(IRowGUI parent)
+ {
+ var markerCount = parent.asset.GetMarkerCount();
+ if (markerCount == 0) return;
+
+ var accumulator = new List<IMarker>();
+ var sortedMarkers = new List<IMarker>(parent.asset.GetMarkers());
+ var vm = TimelineWindowViewPrefs.GetTrackViewModelData(parent.asset);
+
+ sortedMarkers.Sort((lhs, rhs) =>
+ {
+ // Sort by time first
+ var timeComparison = lhs.time.CompareTo(rhs.time);
+ if (timeComparison != 0)
+ return timeComparison;
+
+ // If there's a collision, sort by edit timestamp
+ var lhsObject = lhs as object;
+ var rhsObject = rhs as object;
+
+ if (lhsObject.Equals(null) || rhsObject.Equals(null))
+ return 0;
+
+ var lhsHash = lhsObject.GetHashCode();
+ var rhsHash = rhsObject.GetHashCode();
+
+ if (vm.markerTimeStamps.ContainsKey(lhsHash) && vm.markerTimeStamps.ContainsKey(rhsHash))
+ return vm.markerTimeStamps[lhsHash].CompareTo(vm.markerTimeStamps[rhsHash]);
+
+ return 0;
+ });
+
+ foreach (var current in sortedMarkers)
+ {
+ // TODO: Take zoom factor into account?
+ if (accumulator.Count > 0 && Math.Abs(current.time - accumulator[accumulator.Count - 1].time) > TimeUtility.kTimeEpsilon)
+ ProcessAccumulator(accumulator, parent);
+
+ accumulator.Add(current);
+ }
+
+ ProcessAccumulator(accumulator, parent);
+ }
+
+ void ProcessAccumulator(List<IMarker> accumulator, IRowGUI parent)
+ {
+ if (accumulator.Count == 0) return;
+
+ if (accumulator.Count == 1)
+ {
+ AddItem(new TimelineMarkerGUI(accumulator[0], parent, this));
+ }
+ else
+ {
+ // Ensure that the cluster is always considered *below* the markers it contains.
+ var clusterZOrder = Next();
+ AddItem(
+ new TimelineMarkerClusterGUI(
+ accumulator.Select(m => new TimelineMarkerGUI(m, parent, this)).ToList(),
+ parent, this, clusterZOrder));
+ }
+
+ accumulator.Clear();
+ }
+ }
+}
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/MarkersLayer.cs.meta b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/MarkersLayer.cs.meta
new file mode 100644
index 0000000..32b0787
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/MarkersLayer.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: bea62e1faac8f9a48a4cb919ea05cb6a
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackDrawer.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackDrawer.cs
new file mode 100644
index 0000000..a29fefa
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackDrawer.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+using UnityEngine.Playables;
+using UnityEngine.Timeline;
+namespace UnityEditor.Timeline
+{
+ class TrackDrawer : GUIDrawer
+ {
+ internal WindowState sequencerState { get; set; }
+
+
+ public static TrackDrawer CreateInstance(TrackAsset trackAsset)
+ {
+ if (trackAsset == null)
+ return Activator.CreateInstance<TrackDrawer>();
+
+ TrackDrawer drawer;
+
+ try
+ {
+ drawer = (TrackDrawer)Activator.CreateInstance(TimelineHelpers.GetCustomDrawer(trackAsset.GetType()));
+ }
+ catch (Exception)
+ {
+ drawer = Activator.CreateInstance<TrackDrawer>();
+ }
+
+ drawer.track = trackAsset;
+ return drawer;
+ }
+
+ protected TrackAsset track { get; private set; }
+
+ public virtual bool DrawTrackHeaderButton(Rect rect, TrackAsset track, WindowState state)
+ {
+ return false;
+ }
+
+ public virtual bool DrawTrack(Rect trackRect, TrackAsset trackAsset, Vector2 visibleTime, WindowState state)
+ {
+ return false;
+ }
+
+ public virtual void DrawRecordingBackground(Rect trackRect, TrackAsset trackAsset, Vector2 visibleTime, WindowState state)
+ {
+ EditorGUI.DrawRect(trackRect, DirectorStyles.Instance.customSkin.colorTrackBackgroundRecording);
+ }
+ }
+}
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackDrawer.cs.meta b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackDrawer.cs.meta
new file mode 100644
index 0000000..9588043
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackDrawer.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9a0f991b6c2f45b44b92e163f9969e8e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackItemsDrawer.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackItemsDrawer.cs
new file mode 100644
index 0000000..677c2fe
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackItemsDrawer.cs
@@ -0,0 +1,42 @@
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+namespace UnityEditor.Timeline
+{
+ struct TrackItemsDrawer
+ {
+ List<ItemsLayer> m_Layers;
+ ClipsLayer m_ClipsLayer;
+
+ public IEnumerable<TimelineClipGUI> clips
+ {
+ get { return m_ClipsLayer.items.Cast<TimelineClipGUI>(); }
+ }
+
+ public TrackItemsDrawer(IRowGUI parent)
+ {
+ m_Layers = null;
+ m_ClipsLayer = null;
+ BuildGUICache(parent);
+ }
+
+ void BuildGUICache(IRowGUI parent)
+ {
+ m_ClipsLayer = new ClipsLayer(Layer.Clips, parent);
+ m_Layers = new List<ItemsLayer>
+ {
+ m_ClipsLayer,
+ new MarkersLayer(Layer.Markers, parent)
+ };
+ }
+
+ public void Draw(Rect rect, WindowState state)
+ {
+ foreach (var layer in m_Layers)
+ {
+ layer.Draw(rect, state);
+ }
+ }
+ }
+}
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackItemsDrawer.cs.meta b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackItemsDrawer.cs.meta
new file mode 100644
index 0000000..d41923c
--- /dev/null
+++ b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/TrackItemsDrawer.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c7137daaeb11e8647bf1ade9b7e9aa97
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant: