diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-04-19 17:19:32 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-04-19 17:19:32 -0400 |
| commit | c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78 (patch) | |
| tree | ee4d51c7c1d633e11f46453ef1edd3c77c4ef9f7 /Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ClipsLayer.cs | |
| download | Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.gz Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.tar.bz2 Project-Sandbox-c55fba8ab2a1c9d3df65eda4a5a1e957f4aa1f78.zip | |
Inital commit
Diffstat (limited to 'Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ClipsLayer.cs')
| -rw-r--r-- | Library/PackageCache/com.unity.timeline@1.2.13/Editor/treeview/Drawers/Layers/ClipsLayer.cs | 57 |
1 files changed, 57 insertions, 0 deletions
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); + } + } + } + } +} |
