summaryrefslogtreecommitdiff
path: root/Assets/ThirdParty/UMotion/UMotionEditor/Scripts
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-10-13 10:33:05 +0800
committerchai <chaifix@163.com>2020-10-13 10:33:05 +0800
commitfc6de82e75310b4c007d80753a5f58e6692f4855 (patch)
treee6d8d9226595a6727d43f18a218f53533101a4e0 /Assets/ThirdParty/UMotion/UMotionEditor/Scripts
parent8cd16fb71177bb61a9475284d944bc6aba30740e (diff)
+misc
Diffstat (limited to 'Assets/ThirdParty/UMotion/UMotionEditor/Scripts')
-rw-r--r--Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Application/AssetResourcesFile.cs238
-rw-r--r--Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Application/VersionCompatibilityUtility.cs234
-rw-r--r--Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/AnimationCurveUtilityRecent.cs210
-rw-r--r--Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/EditorVersionCompatibilityUtility.cs134
-rw-r--r--Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/GUICompatibilityUtility.cs202
5 files changed, 509 insertions, 509 deletions
diff --git a/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Application/AssetResourcesFile.cs b/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Application/AssetResourcesFile.cs
index 7f5392be..0380f56b 100644
--- a/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Application/AssetResourcesFile.cs
+++ b/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Application/AssetResourcesFile.cs
@@ -1,120 +1,120 @@
-#if UNITY_EDITOR
-using UnityEngine;
-using UnityEditor;
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-namespace UMotionEditor
-{
- public class AssetResourcesFile : ScriptableObject
- {
- //********************************************************************************
- // Public Properties
- //********************************************************************************
-
- //********************************************************************************
- // Private Properties
- //********************************************************************************
-
- #pragma warning disable 0649 // Suppress "Field 'field' is never assigned to, and will always have its default value 'value'"
- [Serializable]
- private struct ResourceDefinition
- {
- public string Name;
- public UnityEngine.Object Reference;
- }
- #pragma warning restore 0649
-
- //----------------------
- // Inspector
- //----------------------
- [SerializeField]private List<ResourceDefinition> resourcesList = new List<ResourceDefinition>();
- [SerializeField]private List<ResourceDefinition> optionalResourcesList = new List<ResourceDefinition>();
- private Dictionary<string, UnityEngine.Object> resourcesDictionary = new Dictionary<string, UnityEngine.Object>();
-
- //----------------------
- // Internal
- //----------------------
-
- //********************************************************************************
- // Public Methods
- //********************************************************************************
-
- public static AssetResourcesFile FindAssetResourcesFile()
- {
- string[] resourceFilesGUID = AssetDatabase.FindAssets("UMotionResources t:AssetResourcesFile");
-
- if (resourceFilesGUID.Length > 1)
- {
- throw new UnityException("More than one resource file was found. Please remove all UMotion files and install UMotion again.");
- }
- else if (resourceFilesGUID.Length == 0)
- {
- throw new UnityException("Resource file not found. Please install UMotion again.");
- }
- else
- {
- AssetResourcesFile resourceFile = AssetDatabase.LoadAssetAtPath<AssetResourcesFile>(AssetDatabase.GUIDToAssetPath(resourceFilesGUID[0]));
-
- resourceFile.InitializeDictionary();
-
- return resourceFile;
- }
- }
-
- public string GetEditorDataPath()
- {
- string resourcesPath = AssetDatabase.GetAssetPath(this);
-
- string dataPath = Path.GetDirectoryName(resourcesPath);
- dataPath = Path.Combine(Path.GetDirectoryName(dataPath), "Data");
-
- return dataPath;
- }
-
- public T GetResource<T>(string name, bool required = true) where T : UnityEngine.Object
- {
- T loadedObject = null;
- UnityEngine.Object obj;
- if (resourcesDictionary.TryGetValue(name, out obj))
- {
- loadedObject = obj as T;
- }
-
- if (required && (loadedObject == null))
- {
- throw new Exception(string.Format("Resource \"{0}\" can not be loaded.", name));
- }
- else
- {
- return loadedObject;
- }
- }
-
- //********************************************************************************
- // Private Methods
- //********************************************************************************
-
- private void InitializeDictionary()
- {
- resourcesDictionary.Clear();
- foreach (ResourceDefinition resourceDef in resourcesList)
- {
- if (resourceDef.Reference == null)
- {
- throw new UnityException(string.Format("Required resource \"{0}\" not found. Please reinstall UMotion.", resourceDef.Name));
- }
- else
- {
- resourcesDictionary.Add(resourceDef.Name, resourceDef.Reference);
- }
- }
- foreach (ResourceDefinition resourceDef in optionalResourcesList)
- {
- resourcesDictionary.Add(resourceDef.Name, resourceDef.Reference);
- }
- }
- }
-}
+#if UNITY_EDITOR
+using UnityEngine;
+using UnityEditor;
+using System;
+using System.Collections.Generic;
+using System.IO;
+
+namespace UMotionEditor
+{
+ public class AssetResourcesFile : ScriptableObject
+ {
+ //********************************************************************************
+ // Public Properties
+ //********************************************************************************
+
+ //********************************************************************************
+ // Private Properties
+ //********************************************************************************
+
+ #pragma warning disable 0649 // Suppress "Field 'field' is never assigned to, and will always have its default value 'value'"
+ [Serializable]
+ private struct ResourceDefinition
+ {
+ public string Name;
+ public UnityEngine.Object Reference;
+ }
+ #pragma warning restore 0649
+
+ //----------------------
+ // Inspector
+ //----------------------
+ [SerializeField]private List<ResourceDefinition> resourcesList = new List<ResourceDefinition>();
+ [SerializeField]private List<ResourceDefinition> optionalResourcesList = new List<ResourceDefinition>();
+ private Dictionary<string, UnityEngine.Object> resourcesDictionary = new Dictionary<string, UnityEngine.Object>();
+
+ //----------------------
+ // Internal
+ //----------------------
+
+ //********************************************************************************
+ // Public Methods
+ //********************************************************************************
+
+ public static AssetResourcesFile FindAssetResourcesFile()
+ {
+ string[] resourceFilesGUID = AssetDatabase.FindAssets("UMotionResources t:AssetResourcesFile");
+
+ if (resourceFilesGUID.Length > 1)
+ {
+ throw new UnityException("More than one resource file was found. Please remove all UMotion files and install UMotion again.");
+ }
+ else if (resourceFilesGUID.Length == 0)
+ {
+ throw new UnityException("Resource file not found. Please install UMotion again.");
+ }
+ else
+ {
+ AssetResourcesFile resourceFile = AssetDatabase.LoadAssetAtPath<AssetResourcesFile>(AssetDatabase.GUIDToAssetPath(resourceFilesGUID[0]));
+
+ resourceFile.InitializeDictionary();
+
+ return resourceFile;
+ }
+ }
+
+ public string GetEditorDataPath()
+ {
+ string resourcesPath = AssetDatabase.GetAssetPath(this);
+
+ string dataPath = Path.GetDirectoryName(resourcesPath);
+ dataPath = Path.Combine(Path.GetDirectoryName(dataPath), "Data");
+
+ return dataPath;
+ }
+
+ public T GetResource<T>(string name, bool required = true) where T : UnityEngine.Object
+ {
+ T loadedObject = null;
+ UnityEngine.Object obj;
+ if (resourcesDictionary.TryGetValue(name, out obj))
+ {
+ loadedObject = obj as T;
+ }
+
+ if (required && (loadedObject == null))
+ {
+ throw new Exception(string.Format("Resource \"{0}\" can not be loaded.", name));
+ }
+ else
+ {
+ return loadedObject;
+ }
+ }
+
+ //********************************************************************************
+ // Private Methods
+ //********************************************************************************
+
+ private void InitializeDictionary()
+ {
+ resourcesDictionary.Clear();
+ foreach (ResourceDefinition resourceDef in resourcesList)
+ {
+ if (resourceDef.Reference == null)
+ {
+ throw new UnityException(string.Format("Required resource \"{0}\" not found. Please reinstall UMotion.", resourceDef.Name));
+ }
+ else
+ {
+ resourcesDictionary.Add(resourceDef.Name, resourceDef.Reference);
+ }
+ }
+ foreach (ResourceDefinition resourceDef in optionalResourcesList)
+ {
+ resourcesDictionary.Add(resourceDef.Name, resourceDef.Reference);
+ }
+ }
+ }
+}
#endif \ No newline at end of file
diff --git a/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Application/VersionCompatibilityUtility.cs b/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Application/VersionCompatibilityUtility.cs
index ee7861ff..50ec535b 100644
--- a/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Application/VersionCompatibilityUtility.cs
+++ b/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Application/VersionCompatibilityUtility.cs
@@ -1,118 +1,118 @@
-#if UNITY_EDITOR
-using System.Collections;
-using System.Collections.Generic;
-using System.Reflection;
-using UnityEngine;
-
-namespace UMotionEditor
-{
- public static class VersionCompatibilityUtility
- {
- #if !UNITY_2017_4_OR_NEWER
- #error "This Unity version is not supported by UMotion. Please update to Unity 2017.4 or higher."
- #endif
-
- //********************************************************************************
- // Public Properties
- //********************************************************************************
-
- public enum EditorPlatform
- {
- Windows = 0,
- Mac,
- Linux,
- Invalid
- }
-
- public static EditorPlatform CurrentEditorPlatform
- {
- get
- {
- switch (Application.platform)
- {
- case RuntimePlatform.WindowsEditor:
- return EditorPlatform.Windows;
-
- case RuntimePlatform.OSXEditor:
- return EditorPlatform.Mac;
-
- case RuntimePlatform.LinuxEditor:
- return EditorPlatform.Linux;
-
- default:
- return EditorPlatform.Invalid;
- }
- }
- }
-
- public static bool Unity2018_1_OrNewer
- {
- get
- {
- #if UNITY_2018_1_OR_NEWER
- return true;
- #else
- return false;
- #endif
- }
- }
-
- public static bool Unity2018_3_OrNewer
- {
- get
- {
- #if UNITY_2018_3_OR_NEWER
- return true;
- #else
- return false;
- #endif
- }
- }
-
- public static bool Unity2019_1_Or_Newer
- {
- get
- {
- #if UNITY_2019_1_OR_NEWER
- return true;
- #else
- return false;
- #endif
- }
- }
-
- public static bool UsesScriptableRenderPipeline
- {
- get
- {
- #if UNITY_2019_1_OR_NEWER
- return (UnityEngine.Rendering.RenderPipelineManager.currentPipeline != null);
- #else
- #if UNITY_2018_1_OR_NEWER
- return (UnityEngine.Experimental.Rendering.RenderPipelineManager.currentPipeline != null);
- #else
- return false;
- #endif
- #endif
- }
- }
-
- public static string GetCurrentAssemblyName()
- {
- return Assembly.GetExecutingAssembly().GetName().Name;
- }
-
- //********************************************************************************
- // Private Properties
- //********************************************************************************
-
- //********************************************************************************
- // Public Methods
- //********************************************************************************
-
- //********************************************************************************
- // Private Methods
- //********************************************************************************
- }
-}
+#if UNITY_EDITOR
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+using UnityEngine;
+
+namespace UMotionEditor
+{
+ public static class VersionCompatibilityUtility
+ {
+ #if !UNITY_2017_4_OR_NEWER
+ #error "This Unity version is not supported by UMotion. Please update to Unity 2017.4 or higher."
+ #endif
+
+ //********************************************************************************
+ // Public Properties
+ //********************************************************************************
+
+ public enum EditorPlatform
+ {
+ Windows = 0,
+ Mac,
+ Linux,
+ Invalid
+ }
+
+ public static EditorPlatform CurrentEditorPlatform
+ {
+ get
+ {
+ switch (Application.platform)
+ {
+ case RuntimePlatform.WindowsEditor:
+ return EditorPlatform.Windows;
+
+ case RuntimePlatform.OSXEditor:
+ return EditorPlatform.Mac;
+
+ case RuntimePlatform.LinuxEditor:
+ return EditorPlatform.Linux;
+
+ default:
+ return EditorPlatform.Invalid;
+ }
+ }
+ }
+
+ public static bool Unity2018_1_OrNewer
+ {
+ get
+ {
+ #if UNITY_2018_1_OR_NEWER
+ return true;
+ #else
+ return false;
+ #endif
+ }
+ }
+
+ public static bool Unity2018_3_OrNewer
+ {
+ get
+ {
+ #if UNITY_2018_3_OR_NEWER
+ return true;
+ #else
+ return false;
+ #endif
+ }
+ }
+
+ public static bool Unity2019_1_Or_Newer
+ {
+ get
+ {
+ #if UNITY_2019_1_OR_NEWER
+ return true;
+ #else
+ return false;
+ #endif
+ }
+ }
+
+ public static bool UsesScriptableRenderPipeline
+ {
+ get
+ {
+ #if UNITY_2019_1_OR_NEWER
+ return (UnityEngine.Rendering.RenderPipelineManager.currentPipeline != null);
+ #else
+ #if UNITY_2018_1_OR_NEWER
+ return (UnityEngine.Experimental.Rendering.RenderPipelineManager.currentPipeline != null);
+ #else
+ return false;
+ #endif
+ #endif
+ }
+ }
+
+ public static string GetCurrentAssemblyName()
+ {
+ return Assembly.GetExecutingAssembly().GetName().Name;
+ }
+
+ //********************************************************************************
+ // Private Properties
+ //********************************************************************************
+
+ //********************************************************************************
+ // Public Methods
+ //********************************************************************************
+
+ //********************************************************************************
+ // Private Methods
+ //********************************************************************************
+ }
+}
#endif \ No newline at end of file
diff --git a/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/AnimationCurveUtilityRecent.cs b/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/AnimationCurveUtilityRecent.cs
index 0b44b879..d3238362 100644
--- a/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/AnimationCurveUtilityRecent.cs
+++ b/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/AnimationCurveUtilityRecent.cs
@@ -1,105 +1,105 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections;
-using System.Reflection;
-
-namespace UMotionEditor
-{
- public static class AnimationCurveUtilityRecent
- {
- //********************************************************************************
- // Public Properties
- //********************************************************************************
-
- public static bool WeightedTangentsImplemented
- {
- get
- {
- #if UNITY_2018_1_OR_NEWER
- return true;
- #else
- return false;
- #endif
- }
- }
-
- //********************************************************************************
- // Private Properties
- //********************************************************************************
-
- //----------------------
- // Inspector
- //----------------------
-
- //----------------------
- // Internal
- //----------------------
-
- //********************************************************************************
- // Public Methods
- //********************************************************************************
-
- public static void SetKeyWeightedMode(ref Keyframe key, int weightedMode)
- {
- #if UNITY_2018_1_OR_NEWER
- key.weightedMode = (WeightedMode)weightedMode;
- #endif
- }
-
- public static int GetKeyWeightedMode(Keyframe key)
- {
- #if UNITY_2018_1_OR_NEWER
- return (int)key.weightedMode;
- #else
- return 0;
- #endif
- }
-
- public static void SetKeyLeftWeight(ref Keyframe key, float weight)
- {
- #if UNITY_2018_1_OR_NEWER
- key.inWeight = weight;
- #endif
- }
-
- public static float GetKeyLeftWeight(Keyframe key)
- {
- #if UNITY_2018_1_OR_NEWER
- return key.inWeight;
- #else
- return 1f / 3f;
- #endif
- }
-
- public static void SetKeyRightWeight(ref Keyframe key, float weight)
- {
- #if UNITY_2018_1_OR_NEWER
- key.outWeight = weight;
- #endif
- }
-
- public static float GetKeyRightWeight(Keyframe key)
- {
- #if UNITY_2018_1_OR_NEWER
- return key.outWeight;
- #else
- return 1f / 3f;
- #endif
- }
-
- public static void InitializeKeyframe(int frame, float value, float inTangent, float outTangent, int weightedMode, float leftWeight, float rightWeight, out Keyframe key)
- {
- key = new Keyframe(frame, value, inTangent, outTangent);
-
- #if UNITY_2018_1_OR_NEWER
- key.weightedMode = (WeightedMode)weightedMode;
- key.inWeight = leftWeight;
- key.outWeight = rightWeight;
- #endif
- }
-
- //********************************************************************************
- // Private Methods
- //********************************************************************************
- }
-}
+using UnityEngine;
+using UnityEditor;
+using System.Collections;
+using System.Reflection;
+
+namespace UMotionEditor
+{
+ public static class AnimationCurveUtilityRecent
+ {
+ //********************************************************************************
+ // Public Properties
+ //********************************************************************************
+
+ public static bool WeightedTangentsImplemented
+ {
+ get
+ {
+ #if UNITY_2018_1_OR_NEWER
+ return true;
+ #else
+ return false;
+ #endif
+ }
+ }
+
+ //********************************************************************************
+ // Private Properties
+ //********************************************************************************
+
+ //----------------------
+ // Inspector
+ //----------------------
+
+ //----------------------
+ // Internal
+ //----------------------
+
+ //********************************************************************************
+ // Public Methods
+ //********************************************************************************
+
+ public static void SetKeyWeightedMode(ref Keyframe key, int weightedMode)
+ {
+ #if UNITY_2018_1_OR_NEWER
+ key.weightedMode = (WeightedMode)weightedMode;
+ #endif
+ }
+
+ public static int GetKeyWeightedMode(Keyframe key)
+ {
+ #if UNITY_2018_1_OR_NEWER
+ return (int)key.weightedMode;
+ #else
+ return 0;
+ #endif
+ }
+
+ public static void SetKeyLeftWeight(ref Keyframe key, float weight)
+ {
+ #if UNITY_2018_1_OR_NEWER
+ key.inWeight = weight;
+ #endif
+ }
+
+ public static float GetKeyLeftWeight(Keyframe key)
+ {
+ #if UNITY_2018_1_OR_NEWER
+ return key.inWeight;
+ #else
+ return 1f / 3f;
+ #endif
+ }
+
+ public static void SetKeyRightWeight(ref Keyframe key, float weight)
+ {
+ #if UNITY_2018_1_OR_NEWER
+ key.outWeight = weight;
+ #endif
+ }
+
+ public static float GetKeyRightWeight(Keyframe key)
+ {
+ #if UNITY_2018_1_OR_NEWER
+ return key.outWeight;
+ #else
+ return 1f / 3f;
+ #endif
+ }
+
+ public static void InitializeKeyframe(int frame, float value, float inTangent, float outTangent, int weightedMode, float leftWeight, float rightWeight, out Keyframe key)
+ {
+ key = new Keyframe(frame, value, inTangent, outTangent);
+
+ #if UNITY_2018_1_OR_NEWER
+ key.weightedMode = (WeightedMode)weightedMode;
+ key.inWeight = leftWeight;
+ key.outWeight = rightWeight;
+ #endif
+ }
+
+ //********************************************************************************
+ // Private Methods
+ //********************************************************************************
+ }
+}
diff --git a/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/EditorVersionCompatibilityUtility.cs b/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/EditorVersionCompatibilityUtility.cs
index 318bd59e..567b7a0e 100644
--- a/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/EditorVersionCompatibilityUtility.cs
+++ b/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/EditorVersionCompatibilityUtility.cs
@@ -1,67 +1,67 @@
-using UnityEngine;
-using UnityEditor;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using UnityEditor.Compilation;
-#if UNITY_2018_3_OR_NEWER
-using UnityEditor.Experimental.SceneManagement;
-#endif
-
-namespace UMotionEditor
-{
- public static class EditorVersionCompatibilityUtility
- {
- //********************************************************************************
- // Public Properties
- //********************************************************************************
-
- //********************************************************************************
- // Private Properties
- //********************************************************************************
-
- //----------------------
- // Inspector
- //----------------------
-
- //----------------------
- // Internal
- //----------------------
-
- //********************************************************************************
- // Public Methods
- //********************************************************************************
-
- public static bool IsModelPrefab(GameObject gameObject)
- {
- #if UNITY_2018_3_OR_NEWER
- return (PrefabUtility.GetPrefabAssetType(gameObject) == PrefabAssetType.Model);
- #else
- return (PrefabUtility.GetPrefabType(gameObject) == PrefabType.ModelPrefab);
- #endif
- }
-
- public static bool IsPrefab(GameObject gameObject)
- {
- #if UNITY_2018_3_OR_NEWER
- return (PrefabUtility.GetPrefabAssetType(gameObject) != PrefabAssetType.NotAPrefab);
- #else
- return (PrefabUtility.GetPrefabType(gameObject) != PrefabType.None);
- #endif
- }
-
- public static bool IsInPrefabStage()
- {
- #if UNITY_2018_3_OR_NEWER
- return (PrefabStageUtility.GetCurrentPrefabStage() != null);
- #else
- return false;
- #endif
- }
-
- //********************************************************************************
- // Private Methods
- //********************************************************************************
-
- }
-}
+using UnityEngine;
+using UnityEditor;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using UnityEditor.Compilation;
+#if UNITY_2018_3_OR_NEWER
+using UnityEditor.Experimental.SceneManagement;
+#endif
+
+namespace UMotionEditor
+{
+ public static class EditorVersionCompatibilityUtility
+ {
+ //********************************************************************************
+ // Public Properties
+ //********************************************************************************
+
+ //********************************************************************************
+ // Private Properties
+ //********************************************************************************
+
+ //----------------------
+ // Inspector
+ //----------------------
+
+ //----------------------
+ // Internal
+ //----------------------
+
+ //********************************************************************************
+ // Public Methods
+ //********************************************************************************
+
+ public static bool IsModelPrefab(GameObject gameObject)
+ {
+ #if UNITY_2018_3_OR_NEWER
+ return (PrefabUtility.GetPrefabAssetType(gameObject) == PrefabAssetType.Model);
+ #else
+ return (PrefabUtility.GetPrefabType(gameObject) == PrefabType.ModelPrefab);
+ #endif
+ }
+
+ public static bool IsPrefab(GameObject gameObject)
+ {
+ #if UNITY_2018_3_OR_NEWER
+ return (PrefabUtility.GetPrefabAssetType(gameObject) != PrefabAssetType.NotAPrefab);
+ #else
+ return (PrefabUtility.GetPrefabType(gameObject) != PrefabType.None);
+ #endif
+ }
+
+ public static bool IsInPrefabStage()
+ {
+ #if UNITY_2018_3_OR_NEWER
+ return (PrefabStageUtility.GetCurrentPrefabStage() != null);
+ #else
+ return false;
+ #endif
+ }
+
+ //********************************************************************************
+ // Private Methods
+ //********************************************************************************
+
+ }
+}
diff --git a/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/GUICompatibilityUtility.cs b/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/GUICompatibilityUtility.cs
index 73a44bd4..2b9c1775 100644
--- a/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/GUICompatibilityUtility.cs
+++ b/Assets/ThirdParty/UMotion/UMotionEditor/Scripts/Editor/GUICompatibilityUtility.cs
@@ -1,102 +1,102 @@
-using System;
-using System.Reflection;
-using UnityEngine;
-using UnityEditor;
-
-namespace UMotionEditor
-{
- public static class GUICompatibilityUtility
- {
- //********************************************************************************
- // Public Properties
- //********************************************************************************
-
- public static event System.Action<SceneView> OnSceneGui
- {
- add
- {
- #if UNITY_2019_1_OR_NEWER
- SceneView.duringSceneGui += value;
- #else
- legacySceneViewGUI += value;
- if (!initialized)
- {
- // Doing this in a static constructor instead caused an exception in Unity 2017.4
- SceneView.onSceneGUIDelegate += delegate(SceneView sceneView) { legacySceneViewGUI(sceneView); };
- initialized = true;
- }
- #endif
- }
- remove
- {
- #if UNITY_2019_1_OR_NEWER
- SceneView.duringSceneGui -= value;
- #else
- legacySceneViewGUI -= value;
- #endif
- }
- }
-
- //********************************************************************************
- // Private Properties
- //********************************************************************************
-
- //----------------------
- // Inspector
- //----------------------
-
- //----------------------
- // Internal
- //----------------------
- #if !UNITY_2019_1_OR_NEWER
- private static event System.Action<SceneView> legacySceneViewGUI;
- private static bool initialized = false;
- #endif
-
- //********************************************************************************
- // Public Methods
- //********************************************************************************
-
- [MenuItem("Window/UMotion Editor/Contact Support", true, 1232)]
- public static bool UMotionSupportMenuItemValidate()
- {
- CheckCurrentAssembly();
- return true;
- }
-
- [MenuItem("Window/UMotion Editor/Contact Support", false, 1232)]
- public static void UMotionSupportMenuItem()
- {
- Help.BrowseURL("https://support.soxware.com");
- }
-
- public static Color ColorField(GUIContent label, Color value, bool showEyedropper, bool showAlpha, bool hdr, params GUILayoutOption[] options)
- {
- #if UNITY_2018_1_OR_NEWER
- return EditorGUILayout.ColorField(label, value, showEyedropper, showAlpha, hdr, options);
- #else
- return EditorGUILayout.ColorField(label, value, showEyedropper, showAlpha, hdr, null, options);
- #endif
- }
-
- //********************************************************************************
- // Private Methods
- //********************************************************************************
-
- private static bool CheckCurrentAssembly()
- {
- string applicationAssemblyName = VersionCompatibilityUtility.GetCurrentAssemblyName();
- string editorAssemblyName = Assembly.GetExecutingAssembly().GetName().Name;
-
- bool assemblyOk = (applicationAssemblyName == "UMotionSourceApplication") && (editorAssemblyName == "UMotionSourceEditor");
-
- if (!assemblyOk)
- {
- string message = string.Format("The UMotion script files are not compiled to the correct assembly:\r\n\r\n\"{0}\"\r\n(should be \"UMotionSourceApplication\")\r\n\r\n\"{1}\"\r\n(should be \"UMotionSourceEditor\")\r\n\r\nMake sure that you haven't deleted or re-named the assembly definition files inside the UMotion folder.", applicationAssemblyName, editorAssemblyName);
- EditorUtility.DisplayDialog("UMotion - Invalid Assembly", message, "OK");
- }
-
- return assemblyOk;
- }
- }
+using System;
+using System.Reflection;
+using UnityEngine;
+using UnityEditor;
+
+namespace UMotionEditor
+{
+ public static class GUICompatibilityUtility
+ {
+ //********************************************************************************
+ // Public Properties
+ //********************************************************************************
+
+ public static event System.Action<SceneView> OnSceneGui
+ {
+ add
+ {
+ #if UNITY_2019_1_OR_NEWER
+ SceneView.duringSceneGui += value;
+ #else
+ legacySceneViewGUI += value;
+ if (!initialized)
+ {
+ // Doing this in a static constructor instead caused an exception in Unity 2017.4
+ SceneView.onSceneGUIDelegate += delegate(SceneView sceneView) { legacySceneViewGUI(sceneView); };
+ initialized = true;
+ }
+ #endif
+ }
+ remove
+ {
+ #if UNITY_2019_1_OR_NEWER
+ SceneView.duringSceneGui -= value;
+ #else
+ legacySceneViewGUI -= value;
+ #endif
+ }
+ }
+
+ //********************************************************************************
+ // Private Properties
+ //********************************************************************************
+
+ //----------------------
+ // Inspector
+ //----------------------
+
+ //----------------------
+ // Internal
+ //----------------------
+ #if !UNITY_2019_1_OR_NEWER
+ private static event System.Action<SceneView> legacySceneViewGUI;
+ private static bool initialized = false;
+ #endif
+
+ //********************************************************************************
+ // Public Methods
+ //********************************************************************************
+
+ [MenuItem("Window/UMotion Editor/Contact Support", true, 1232)]
+ public static bool UMotionSupportMenuItemValidate()
+ {
+ CheckCurrentAssembly();
+ return true;
+ }
+
+ [MenuItem("Window/UMotion Editor/Contact Support", false, 1232)]
+ public static void UMotionSupportMenuItem()
+ {
+ Help.BrowseURL("https://support.soxware.com");
+ }
+
+ public static Color ColorField(GUIContent label, Color value, bool showEyedropper, bool showAlpha, bool hdr, params GUILayoutOption[] options)
+ {
+ #if UNITY_2018_1_OR_NEWER
+ return EditorGUILayout.ColorField(label, value, showEyedropper, showAlpha, hdr, options);
+ #else
+ return EditorGUILayout.ColorField(label, value, showEyedropper, showAlpha, hdr, null, options);
+ #endif
+ }
+
+ //********************************************************************************
+ // Private Methods
+ //********************************************************************************
+
+ private static bool CheckCurrentAssembly()
+ {
+ string applicationAssemblyName = VersionCompatibilityUtility.GetCurrentAssemblyName();
+ string editorAssemblyName = Assembly.GetExecutingAssembly().GetName().Name;
+
+ bool assemblyOk = (applicationAssemblyName == "UMotionSourceApplication") && (editorAssemblyName == "UMotionSourceEditor");
+
+ if (!assemblyOk)
+ {
+ string message = string.Format("The UMotion script files are not compiled to the correct assembly:\r\n\r\n\"{0}\"\r\n(should be \"UMotionSourceApplication\")\r\n\r\n\"{1}\"\r\n(should be \"UMotionSourceEditor\")\r\n\r\nMake sure that you haven't deleted or re-named the assembly definition files inside the UMotion folder.", applicationAssemblyName, editorAssemblyName);
+ EditorUtility.DisplayDialog("UMotion - Invalid Assembly", message, "OK");
+ }
+
+ return assemblyOk;
+ }
+ }
} \ No newline at end of file