[unity] Added additional measures to prevent undesired setting of TK2D define. It has strangely been reported as enabled as if the respective button was pressed, although it never appeared - potentially a unity inspector UI bug.

This commit is contained in:
Harald Csaszar 2020-03-27 12:35:01 +01:00
parent 501677b969
commit 3bac3da543
3 changed files with 36 additions and 4 deletions

View File

@ -62,7 +62,15 @@ namespace Spine.Unity.Editor {
Shader.Find("tk2d/AdditiveVertexColor") != null);
}
internal static bool IsTK2DAllowed {
get {
return false; // replace with "return true;" to allow TK2D support
}
}
internal static void EnableTK2D () {
if (!IsTK2DAllowed)
return;
SpineBuildEnvUtility.DisableSpineAsmdefFiles();
SpineBuildEnvUtility.EnableBuildDefine(SPINE_TK2D_DEFINE);
}

View File

@ -278,16 +278,28 @@ namespace Spine.Unity.Editor {
}
}
if (SpineTK2DEditorUtility.IsTK2DInstalled()) {
#if SPINE_TK2D_DEFINE
bool isTK2DDefineSet = true;
#else
bool isTK2DDefineSet = false;
#endif
bool isTK2DAllowed = SpineTK2DEditorUtility.IsTK2DAllowed;
if (SpineTK2DEditorUtility.IsTK2DInstalled() || isTK2DDefineSet) {
GUILayout.Space(20);
EditorGUILayout.LabelField("3rd Party Settings", EditorStyles.boldLabel);
using (new GUILayout.HorizontalScope()) {
EditorGUILayout.PrefixLabel("Define TK2D");
if (GUILayout.Button("Enable", GUILayout.Width(64)))
if (isTK2DAllowed && GUILayout.Button("Enable", GUILayout.Width(64)))
SpineTK2DEditorUtility.EnableTK2D();
if (GUILayout.Button("Disable", GUILayout.Width(64)))
SpineTK2DEditorUtility.DisableTK2D();
}
#if !SPINE_TK2D_DEFINE
if (!isTK2DAllowed) {
EditorGUILayout.LabelField("To allow TK2D support, please modify line 67 in", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Spine/Editor/spine-unity/Editor/Util./BuildSettings.cs", EditorStyles.boldLabel);
}
#endif
}
GUILayout.Space(20);

View File

@ -192,16 +192,28 @@ namespace Spine.Unity.Editor {
}
}
if (SpineEditorUtilities.SpineTK2DEditorUtility.IsTK2DInstalled()) {
#if SPINE_TK2D_DEFINE
bool isTK2DDefineSet = true;
#else
bool isTK2DDefineSet = false;
#endif
bool isTK2DAllowed = SpineEditorUtilities.SpineTK2DEditorUtility.IsTK2DAllowed;
if (SpineEditorUtilities.SpineTK2DEditorUtility.IsTK2DInstalled() || isTK2DDefineSet) {
GUILayout.Space(20);
EditorGUILayout.LabelField("3rd Party Settings", EditorStyles.boldLabel);
using (new GUILayout.HorizontalScope()) {
EditorGUILayout.PrefixLabel("Define TK2D");
if (GUILayout.Button("Enable", GUILayout.Width(64)))
if (isTK2DAllowed && GUILayout.Button("Enable", GUILayout.Width(64)))
SpineEditorUtilities.SpineTK2DEditorUtility.EnableTK2D();
if (GUILayout.Button("Disable", GUILayout.Width(64)))
SpineEditorUtilities.SpineTK2DEditorUtility.DisableTK2D();
}
#if !SPINE_TK2D_DEFINE
if (!isTK2DAllowed) {
EditorGUILayout.LabelField("To allow TK2D support, please modify line 67 in", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Spine/Editor/spine-unity/Editor/Util./BuildSettings.cs", EditorStyles.boldLabel);
}
#endif
}
GUILayout.Space(20);