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/Actions/ItemAction.cs | 124 --------------------- 1 file changed, 124 deletions(-) delete mode 100644 Library/PackageCache/com.unity.timeline@1.2.13/Editor/Actions/ItemAction.cs (limited to 'Library/PackageCache/com.unity.timeline@1.2.13/Editor/Actions/ItemAction.cs') diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Actions/ItemAction.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Actions/ItemAction.cs deleted file mode 100644 index cd4c3a4..0000000 --- a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Actions/ItemAction.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using UnityEngine; -using UnityEngine.Timeline; - -namespace UnityEditor.Timeline -{ - [ActiveInMode(TimelineModes.Default)] - abstract class ItemAction : MenuItemActionBase where T : class - { - public abstract bool Execute(WindowState state, T[] items); - - protected virtual MenuActionDisplayState GetDisplayState(WindowState state, T[] items) - { - return items.Length > 0 ? MenuActionDisplayState.Visible : MenuActionDisplayState.Disabled; - } - - protected virtual string GetDisplayName(T[] items) - { - return menuName; - } - - public bool CanExecute(WindowState state, T[] items) - { - return GetDisplayState(state, items) == MenuActionDisplayState.Visible; - } - - protected virtual void AddMenuItem(WindowState state, T[] items, List menuItem) - { - var mode = TimelineWindow.instance.currentMode.mode; - menuItem.Add( - new MenuActionItem() - { - category = category, - entryName = GetDisplayName(items), - shortCut = this.shortCut, - isChecked = false, - isActiveInMode = IsActionActiveInMode(this, mode), - priority = priority, - state = GetDisplayState(state, items), - callback = () => Execute(state, items) - } - ); - } - - public static bool HandleShortcut(WindowState state, Event evt, T item) - { - T[] items = { item }; - - foreach (ItemAction action in actions) - { - var attr = action.GetType().GetCustomAttributes(typeof(ShortcutAttribute), true); - - foreach (ShortcutAttribute shortcut in attr) - { - if (shortcut.MatchesEvent(evt)) - { - if (s_ShowActionTriggeredByShortcut) - Debug.Log(action.GetType().Name); - - if (!IsActionActiveInMode(action, TimelineWindow.instance.currentMode.mode)) - return false; - - var result = action.Execute(state, items); - state.Refresh(); - state.Evaluate(); - return result; - } - } - } - - return false; - } - - static List> s_ActionClasses; - - static List> actions - { - get - { - if (s_ActionClasses == null) - { - s_ActionClasses = GetActionsOfType(typeof(ItemAction)).Select(x => (ItemAction)x.GetConstructors()[0].Invoke(null)).ToList(); - } - - return s_ActionClasses; - } - } - - public static void GetMenuEntries(T[] items, List menuItems) - { - if (items == null || items.Length == 0) - return; - - foreach (var action in actions) - { - if (action.showInMenu) - action.AddMenuItem(TimelineWindow.instance.state, items, menuItems); - } - } - - public static bool Invoke(WindowState state, T[] items) - where TAction : ItemAction - { - var itemsDerived = items.ToArray(); - - if (!itemsDerived.Any()) - return false; - - var action = actions.FirstOrDefault(x => x.GetType() == typeof(TAction)); - - if (action != null) - return action.Execute(state, itemsDerived); - - return false; - } - - public static bool Invoke(WindowState state, T item) - where TAction : ItemAction - { - return Invoke(state, new[] {item}); - } - } -} -- cgit v1.2.3