diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-08-20 23:40:50 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-08-20 23:40:50 -0400 |
| commit | 3af4c218c0e70167db23a6303d2af30aff37d2fe (patch) | |
| tree | 927f29edcf54ab562f40f3d1c6cb69287c7f5980 /Library/PackageCache/com.unity.timeline@1.2.13/Editor/Manipulators/Trim/TrimItemModeMix.cs | |
| parent | b6daed0af784f4e9bc13329dd87c671b06ee1c65 (diff) | |
| download | Project-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.tar.gz Project-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.tar.bz2 Project-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.zip | |
Removed a bunch of stuff; Changes
Diffstat (limited to 'Library/PackageCache/com.unity.timeline@1.2.13/Editor/Manipulators/Trim/TrimItemModeMix.cs')
| -rw-r--r-- | Library/PackageCache/com.unity.timeline@1.2.13/Editor/Manipulators/Trim/TrimItemModeMix.cs | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Manipulators/Trim/TrimItemModeMix.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Manipulators/Trim/TrimItemModeMix.cs deleted file mode 100644 index 7232c29..0000000 --- a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Manipulators/Trim/TrimItemModeMix.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Linq; -using UnityEngine; -using UnityEngine.Timeline; - -namespace UnityEditor.Timeline -{ - class TrimItemModeMix : ITrimItemMode, ITrimItemDrawer - { - ITrimmable m_Item; - - double m_Min; - double m_Max; - - public void OnBeforeTrim(ITrimmable item, TrimEdge trimDirection) - { - m_Item = item; - - var sortedItems = ItemsUtils.GetItemsExcept(item.parentTrack, new[] {item}) - .OfType<ITrimmable>() - .OrderBy(c => c.start); - - var itemStart = (DiscreteTime)item.start; - var itemEnd = (DiscreteTime)item.end; - - var overlapped = sortedItems.LastOrDefault(c => (DiscreteTime)c.start == itemStart && (DiscreteTime)c.end == itemEnd); - - ITrimmable nextItem; - ITrimmable prevItem; - - m_Min = 0.0; - m_Max = double.PositiveInfinity; - - var blendableItem = item as IBlendable; - if (blendableItem != null && blendableItem.supportsBlending) - { - if (trimDirection == TrimEdge.Start) - { - nextItem = sortedItems.FirstOrDefault(c => (DiscreteTime)c.start >= itemStart && (DiscreteTime)c.end > itemEnd); - prevItem = sortedItems.LastOrDefault(c => (DiscreteTime)c.start <= itemStart && (DiscreteTime)c.end < itemEnd); - - if (prevItem != null) - m_Min = prevItem.start + EditModeUtils.BlendDuration(prevItem, TrimEdge.Start); - - if (nextItem != null) - m_Max = nextItem.start; - } - else - { - nextItem = sortedItems.FirstOrDefault(c => c != overlapped && (DiscreteTime)c.start >= itemStart && (DiscreteTime)c.end >= itemEnd); - prevItem = sortedItems.LastOrDefault(c => c != overlapped && (DiscreteTime)c.start <= itemStart && (DiscreteTime)c.end <= itemEnd); - - if (prevItem != null) - m_Min = prevItem.end; - - if (nextItem != null) - m_Max = nextItem.end - EditModeUtils.BlendDuration(nextItem, TrimEdge.End); - } - } - else - { - nextItem = sortedItems.FirstOrDefault(c => (DiscreteTime)c.start > itemStart); - prevItem = sortedItems.LastOrDefault(c => (DiscreteTime)c.start < itemStart); - - if (prevItem != null) - m_Min = prevItem.end; - - if (nextItem != null) - m_Max = nextItem.start; - } - } - - public void TrimStart(ITrimmable item, double time) - { - time = Math.Min(Math.Max(time, m_Min), m_Max); - item.SetStart(time); - } - - public void TrimEnd(ITrimmable item, double time, bool affectTimeScale) - { - time = Math.Min(Math.Max(time, m_Min), m_Max); - item.SetEnd(time, affectTimeScale); - } - - public void DrawGUI(WindowState state, Rect bounds, Color color, TrimEdge edge) - { - if (EditModeUtils.HasBlends(m_Item, edge)) - { - EditModeGUIUtils.DrawBoundsEdge(bounds, color, edge); - var cursorType = (edge == TrimEdge.End) - ? TimelineCursors.CursorType.MixRight - : TimelineCursors.CursorType.MixLeft; - - TimelineCursors.SetCursor(cursorType); - } - else - { - TimelineCursors.ClearCursor(); - } - } - } -} |
