From 3af4c218c0e70167db23a6303d2af30aff37d2fe Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 20 Aug 2020 23:40:50 -0400 Subject: Removed a bunch of stuff; Changes --- .../Editor/Items/ItemsUtils.cs | 116 --------------------- 1 file changed, 116 deletions(-) delete mode 100644 Library/PackageCache/com.unity.timeline@1.2.13/Editor/Items/ItemsUtils.cs (limited to 'Library/PackageCache/com.unity.timeline@1.2.13/Editor/Items/ItemsUtils.cs') diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Items/ItemsUtils.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Items/ItemsUtils.cs deleted file mode 100644 index 90e7985..0000000 --- a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Items/ItemsUtils.cs +++ /dev/null @@ -1,116 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEngine.Timeline; - -namespace UnityEditor.Timeline -{ - static class ItemsUtils - { - static readonly Dictionary s_ClipCache = new Dictionary(); - static readonly Dictionary s_MarkerCache = new Dictionary(); - - public static IEnumerable ToItemsPerTrack(this IEnumerable items) - { - var groupedItems = items.GroupBy(c => c.parentTrack); - foreach (var group in groupedItems) - { - yield return new ItemsPerTrack(group.Key, group.ToArray()); - } - } - - public static ITimelineItem ToItem(this TimelineClip clip) - { - if (s_ClipCache.ContainsKey(clip)) - return s_ClipCache[clip]; - - var ret = new ClipItem(clip); - s_ClipCache.Add(clip, ret); - return ret; - } - - public static ITimelineItem ToItem(this IMarker marker) - { - if (s_MarkerCache.ContainsKey(marker)) - return s_MarkerCache[marker]; - - var ret = new MarkerItem(marker); - s_MarkerCache.Add(marker, ret); - return ret; - } - - public static IEnumerable ToItems(this IEnumerable clips) - { - return clips.Select(ToItem); - } - - public static IEnumerable ToItems(this IEnumerable markers) - { - return markers.Select(ToItem); - } - - public static IEnumerable GetItems(this TrackAsset track) - { - var list = track.clips.Select(clip => (ITimelineItem) new ClipItem(clip)).ToList(); - list.AddRange(track.GetMarkers().Select(marker => (ITimelineItem) new MarkerItem(marker))); - - list = list.OrderBy(x => x.start).ThenBy(x => x.end).ToList(); - return list; - } - - public static void GetItemRange(this TrackAsset track, out double start, out double end) - { - start = 0; - end = 0; - var items = track.GetItems().ToList(); - if (items.Any()) - { - start = items.Min(p => p.start); - end = items.Max(p => p.end); - } - } - - public static IEnumerable GetItemsExcept(this TrackAsset track, IEnumerable items) - { - return GetItems(track).Except(items); - } - - public static IEnumerable GetItemTypes(IEnumerable items) - { - var types = new List(); - if (items.OfType().Any()) - types.Add(typeof(ClipItem)); - if (items.OfType().Any()) - types.Add(typeof(MarkerItem)); - - return types; - } - - public static IEnumerable GetItemTypes(IEnumerable itemsGroups) - { - return GetItemTypes(itemsGroups.SelectMany(i => i.items)).Distinct(); - } - - public static void SetItemsStartTime(IEnumerable newItems, double time) - { - var startTimes = newItems.Select(d => d.items.Min(x => x.start)).ToList(); - var min = startTimes.Min(); - startTimes = startTimes.Select(x => x - min + time).ToList(); - - for (int i = 0; i < newItems.Count(); ++i) - EditModeUtils.SetStart(newItems.ElementAt(i).items, startTimes[i]); - } - - public static double TimeGapBetweenItems(ITimelineItem leftItem, ITimelineItem rightItem, WindowState state) - { - if (leftItem is MarkerItem && rightItem is MarkerItem) - { - var markerType = ((MarkerItem)leftItem).marker.GetType(); - var gap = state.PixelDeltaToDeltaTime(StyleManager.UssStyleForType(markerType).fixedWidth); - return gap; - } - - return 0.0; - } - } -} -- cgit v1.2.3