1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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;
}
}
}
|