summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Attributes/ShortcutAttribute.cs
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2020-08-20 23:40:50 -0400
committerAndrew Lee <alee14498@protonmail.com>2020-08-20 23:40:50 -0400
commit3af4c218c0e70167db23a6303d2af30aff37d2fe (patch)
tree927f29edcf54ab562f40f3d1c6cb69287c7f5980 /Library/PackageCache/com.unity.timeline@1.2.13/Editor/Attributes/ShortcutAttribute.cs
parentb6daed0af784f4e9bc13329dd87c671b06ee1c65 (diff)
downloadProject-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/Attributes/ShortcutAttribute.cs')
-rw-r--r--Library/PackageCache/com.unity.timeline@1.2.13/Editor/Attributes/ShortcutAttribute.cs71
1 files changed, 0 insertions, 71 deletions
diff --git a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Attributes/ShortcutAttribute.cs b/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Attributes/ShortcutAttribute.cs
deleted file mode 100644
index 756a092..0000000
--- a/Library/PackageCache/com.unity.timeline@1.2.13/Editor/Attributes/ShortcutAttribute.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using System;
-using System.Linq;
-using UnityEditor.ShortcutManagement;
-using UnityEngine;
-
-namespace UnityEditor.Timeline
-{
- [AttributeUsage(AttributeTargets.Class, Inherited = false)]
- class ShortcutAttribute : Attribute
- {
- readonly string m_Identifier;
- readonly string m_EventCommandName;
- readonly string m_MenuShortcut;
-
- public ShortcutAttribute(string identifier)
- {
- m_Identifier = identifier;
- m_EventCommandName = identifier;
- }
-
- public ShortcutAttribute(string identifier, string commandName)
- {
- m_Identifier = identifier;
- m_EventCommandName = commandName;
- }
-
- public ShortcutAttribute(KeyCode key, ShortcutModifiers modifiers = ShortcutModifiers.None)
- {
- m_MenuShortcut = new KeyCombination(key, modifiers).ToMenuShortcutString();
- }
-
- public string GetMenuShortcut()
- {
- if (m_MenuShortcut != null)
- return m_MenuShortcut;
-
- //find the mapped shortcut in the shortcut manager
- var shortcut = ShortcutIntegration.instance.directory.FindShortcutEntry(m_Identifier);
- if (shortcut != null && shortcut.combinations.Any())
- {
- return KeyCombination.SequenceToMenuString(shortcut.combinations);
- }
-
- return string.Empty;
- }
-
- public bool MatchesEvent(Event evt)
- {
- if (evt.type != EventType.ExecuteCommand)
- return false;
- return evt.commandName == m_EventCommandName;
- }
- }
-
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
- class ShortcutPlatformOverrideAttribute : ShortcutAttribute
- {
- RuntimePlatform platform { get; }
-
- public ShortcutPlatformOverrideAttribute(RuntimePlatform platform, KeyCode key, ShortcutModifiers modifiers = ShortcutModifiers.None)
- : base(key, modifiers)
- {
- this.platform = platform;
- }
-
- public bool MatchesCurrentPlatform()
- {
- return Application.platform == platform;
- }
- }
-}