Эх сурвалжийг харах

[unity] Now using SettingsProvider for Preferences - Spine menu. This stores Spine settings in Assets/Editor/SpineSettings.asset which can be shared with team members. Fixes a warning. Closes #1336.

Harald Csaszar 6 жил өмнө
parent
commit
bd69b9bc38

+ 3 - 3
spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineAtlasAssetInspector.cs

@@ -134,12 +134,12 @@ namespace Spine.Unity.Editor {
 			}
 
 			EditorGUILayout.Space();
-			if (SpineInspectorUtility.LargeCenteredButton(SpineInspectorUtility.TempContent("Set Mipmap Bias to " + SpineEditorUtilities.Preferences.DEFAULT_MIPMAPBIAS, tooltip: "This may help textures with mipmaps be less blurry when used for 2D sprites."))) {
+			if (SpineInspectorUtility.LargeCenteredButton(SpineInspectorUtility.TempContent("Set Mipmap Bias to " + SpinePreferences.DEFAULT_MIPMAPBIAS, tooltip: "This may help textures with mipmaps be less blurry when used for 2D sprites."))) {
 				foreach (var m in atlasAsset.materials) {
 					var texture = m.mainTexture;
-					texture.mipMapBias = SpineEditorUtilities.Preferences.DEFAULT_MIPMAPBIAS;
+					texture.mipMapBias = SpinePreferences.DEFAULT_MIPMAPBIAS;
 				}
-				Debug.Log("Texture mipmap bias set to " + SpineEditorUtilities.Preferences.DEFAULT_MIPMAPBIAS);
+				Debug.Log("Texture mipmap bias set to " + SpinePreferences.DEFAULT_MIPMAPBIAS);
 			}
 
 			EditorGUILayout.Space();

+ 82 - 39
spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs

@@ -46,6 +46,10 @@
 #define NEWHIERARCHYWINDOWCALLBACKS
 #endif
 
+#if UNITY_2018_3_OR_NEWER
+#define NEW_PREFERENCES_SETTINGS_PROVIDER
+#endif
+
 using UnityEngine;
 using UnityEditor;
 using System.Collections.Generic;
@@ -169,11 +173,35 @@ namespace Spine.Unity.Editor {
 
 		static int STRAIGHT_ALPHA_PARAM_ID = Shader.PropertyToID("_StraightAlphaInput");
 
+	#if NEW_PREFERENCES_SETTINGS_PROVIDER
+		static class SpineSettingsProviderRegistration
+		{
+			[SettingsProvider]
+			public static SettingsProvider CreateSpineSettingsProvider()
+			{
+				var provider = new SettingsProvider("Spine", SettingsScope.User)
+				{
+					label = "Spine",
+					guiHandler = (searchContext) =>
+					{
+						var settings = SpinePreferences.GetSerializedSettings();
+						SpinePreferences.HandlePreferencesGUI(settings);
+						settings.ApplyModifiedProperties();
+					},
+
+					// Populate the search keywords to enable smart search filtering and label highlighting:
+					keywords = new HashSet<string>(new[] { "Spine", "Preferences", "Skeleton", "Default", "Mix", "Duration" })
+				};
+				return provider;
+			}
+		}
+	#else
 		// Preferences entry point
 		[PreferenceItem("Spine")]
 		static void PreferencesGUI () {
 			Preferences.HandlePreferencesGUI();
 		}
+	#endif
 
 		// Auto-import entry point
 		static void OnPostprocessAllAssets (string[] imported, string[] deleted, string[] moved, string[] movedFromAssetPaths) {
@@ -191,7 +219,11 @@ namespace Spine.Unity.Editor {
 		static void Initialize () {
 			if (EditorApplication.isPlayingOrWillChangePlaymode) return;
 			
+			#if !NEW_PREFERENCES_SETTINGS_PROVIDER
 			Preferences.Load();
+			#else
+			SpinePreferences.Load();
+			#endif
 
 			string[] assets = AssetDatabase.FindAssets("t:script SpineEditorUtilities");
 			string assetPath = AssetDatabase.GUIDToAssetPath(assets[0]);
@@ -295,55 +327,53 @@ namespace Spine.Unity.Editor {
 		}
 		#endregion
 
+	#if NEW_PREFERENCES_SETTINGS_PROVIDER
+		public static SpinePreferences Preferences {
+			get {
+				return SpinePreferences.GetOrCreateSettings();
+			}
+		}
+	#endif
+
+	#if NEW_PREFERENCES_SETTINGS_PROVIDER
+		public static class OldPreferences {
+	#else
 		public static class Preferences {
-			#if SPINE_TK2D
-			const float DEFAULT_DEFAULT_SCALE = 1f;
-			#else
-			const float DEFAULT_DEFAULT_SCALE = 0.01f;
-			#endif
+	#endif
 			const string DEFAULT_SCALE_KEY = "SPINE_DEFAULT_SCALE";
-			public static float defaultScale = DEFAULT_DEFAULT_SCALE;
+			public static float defaultScale = SpinePreferences.DEFAULT_DEFAULT_SCALE;
 
-			const float DEFAULT_DEFAULT_MIX = 0.2f;
 			const string DEFAULT_MIX_KEY = "SPINE_DEFAULT_MIX";
-			public static float defaultMix = DEFAULT_DEFAULT_MIX;
+			public static float defaultMix = SpinePreferences.DEFAULT_DEFAULT_MIX;
 
-			const string DEFAULT_DEFAULT_SHADER = "Spine/Skeleton";
 			const string DEFAULT_SHADER_KEY = "SPINE_DEFAULT_SHADER";
-			public static string defaultShader = DEFAULT_DEFAULT_SHADER;
+			public static string defaultShader = SpinePreferences.DEFAULT_DEFAULT_SHADER;
 
-			const float DEFAULT_DEFAULT_ZSPACING = 0f;
 			const string DEFAULT_ZSPACING_KEY = "SPINE_DEFAULT_ZSPACING";
-			public static float defaultZSpacing = DEFAULT_DEFAULT_ZSPACING;
+			public static float defaultZSpacing = SpinePreferences.DEFAULT_DEFAULT_ZSPACING;
 
-			const bool DEFAULT_DEFAULT_INSTANTIATE_LOOP = true;
 			const string DEFAULT_INSTANTIATE_LOOP_KEY = "SPINE_DEFAULT_INSTANTIATE_LOOP";
-			public static bool defaultInstantiateLoop = DEFAULT_DEFAULT_INSTANTIATE_LOOP;
+			public static bool defaultInstantiateLoop = SpinePreferences.DEFAULT_DEFAULT_INSTANTIATE_LOOP;
 
-			const bool DEFAULT_SHOW_HIERARCHY_ICONS = true;
 			const string SHOW_HIERARCHY_ICONS_KEY = "SPINE_SHOW_HIERARCHY_ICONS";
-			public static bool showHierarchyIcons = DEFAULT_SHOW_HIERARCHY_ICONS;
+			public static bool showHierarchyIcons = SpinePreferences.DEFAULT_SHOW_HIERARCHY_ICONS;
 
-			const bool DEFAULT_SET_TEXTUREIMPORTER_SETTINGS = true;
 			const string SET_TEXTUREIMPORTER_SETTINGS_KEY = "SPINE_SET_TEXTUREIMPORTER_SETTINGS";
-			public static bool setTextureImporterSettings = DEFAULT_SET_TEXTUREIMPORTER_SETTINGS;
+			public static bool setTextureImporterSettings = SpinePreferences.DEFAULT_SET_TEXTUREIMPORTER_SETTINGS;
 
-			const bool DEFAULT_ATLASTXT_WARNING = true;
 			const string ATLASTXT_WARNING_KEY = "SPINE_ATLASTXT_WARNING";
-			public static bool atlasTxtImportWarning = DEFAULT_ATLASTXT_WARNING;
+			public static bool atlasTxtImportWarning = SpinePreferences.DEFAULT_ATLASTXT_WARNING;
 
-			const bool DEFAULT_TEXTUREIMPORTER_WARNING = true;
 			const string TEXTUREIMPORTER_WARNING_KEY = "SPINE_TEXTUREIMPORTER_WARNING";
-			public static bool textureImporterWarning = DEFAULT_TEXTUREIMPORTER_WARNING;
+			public static bool textureImporterWarning = SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING;
 
-			internal const float DEFAULT_MIPMAPBIAS = -0.5f;
+			public const float DEFAULT_MIPMAPBIAS = SpinePreferences.DEFAULT_MIPMAPBIAS;
 
-			public const float DEFAULT_SCENE_ICONS_SCALE = 1f;
-			public const string SCENE_ICONS_SCALE_KEY = "SPINE_SCENE_ICONS_SCALE";
+			public const float DEFAULT_SCENE_ICONS_SCALE = SpinePreferences.DEFAULT_SCENE_ICONS_SCALE;
+			public const string SCENE_ICONS_SCALE_KEY = SpinePreferences.SCENE_ICONS_SCALE_KEY;
 
-			const bool DEFAULT_AUTO_RELOAD_SCENESKELETONS = true;
 			const string AUTO_RELOAD_SCENESKELETONS_KEY = "SPINE_AUTO_RELOAD_SCENESKELETONS";
-			public static bool autoReloadSceneSkeletons = DEFAULT_AUTO_RELOAD_SCENESKELETONS;
+			public static bool autoReloadSceneSkeletons = SpinePreferences.DEFAULT_AUTO_RELOAD_SCENESKELETONS;
 
 			static bool preferencesLoaded = false;
 
@@ -351,20 +381,21 @@ namespace Spine.Unity.Editor {
 				if (preferencesLoaded)
 					return;
 
-				defaultMix = EditorPrefs.GetFloat(DEFAULT_MIX_KEY, DEFAULT_DEFAULT_MIX);
-				defaultScale = EditorPrefs.GetFloat(DEFAULT_SCALE_KEY, DEFAULT_DEFAULT_SCALE);
-				defaultZSpacing = EditorPrefs.GetFloat(DEFAULT_ZSPACING_KEY, DEFAULT_DEFAULT_ZSPACING);
-				defaultShader = EditorPrefs.GetString(DEFAULT_SHADER_KEY, DEFAULT_DEFAULT_SHADER);
-				showHierarchyIcons = EditorPrefs.GetBool(SHOW_HIERARCHY_ICONS_KEY, DEFAULT_SHOW_HIERARCHY_ICONS);
-				setTextureImporterSettings = EditorPrefs.GetBool(SET_TEXTUREIMPORTER_SETTINGS_KEY, DEFAULT_SET_TEXTUREIMPORTER_SETTINGS);
-				autoReloadSceneSkeletons = EditorPrefs.GetBool(AUTO_RELOAD_SCENESKELETONS_KEY, DEFAULT_AUTO_RELOAD_SCENESKELETONS);
-				atlasTxtImportWarning = EditorPrefs.GetBool(ATLASTXT_WARNING_KEY, DEFAULT_ATLASTXT_WARNING);
-				textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, DEFAULT_TEXTUREIMPORTER_WARNING);
+				defaultMix = EditorPrefs.GetFloat(DEFAULT_MIX_KEY, SpinePreferences.DEFAULT_DEFAULT_MIX);
+				defaultScale = EditorPrefs.GetFloat(DEFAULT_SCALE_KEY, SpinePreferences.DEFAULT_DEFAULT_SCALE);
+				defaultZSpacing = EditorPrefs.GetFloat(DEFAULT_ZSPACING_KEY, SpinePreferences.DEFAULT_DEFAULT_ZSPACING);
+				defaultShader = EditorPrefs.GetString(DEFAULT_SHADER_KEY, SpinePreferences.DEFAULT_DEFAULT_SHADER);
+				showHierarchyIcons = EditorPrefs.GetBool(SHOW_HIERARCHY_ICONS_KEY, SpinePreferences.DEFAULT_SHOW_HIERARCHY_ICONS);
+				setTextureImporterSettings = EditorPrefs.GetBool(SET_TEXTUREIMPORTER_SETTINGS_KEY, SpinePreferences.DEFAULT_SET_TEXTUREIMPORTER_SETTINGS);
+				autoReloadSceneSkeletons = EditorPrefs.GetBool(AUTO_RELOAD_SCENESKELETONS_KEY, SpinePreferences.DEFAULT_AUTO_RELOAD_SCENESKELETONS);
+				atlasTxtImportWarning = EditorPrefs.GetBool(ATLASTXT_WARNING_KEY, SpinePreferences.DEFAULT_ATLASTXT_WARNING);
+				textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING);
 
 				SpineHandles.handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, DEFAULT_SCENE_ICONS_SCALE);
 				preferencesLoaded = true;
 			}
 
+		#if !NEW_PREFERENCES_SETTINGS_PROVIDER
 			public static void HandlePreferencesGUI () {
 				if (!preferencesLoaded)
 					Load();
@@ -390,7 +421,7 @@ namespace Spine.Unity.Editor {
 
 					EditorGUI.BeginChangeCheck();
 					var shader = (EditorGUILayout.ObjectField("Default Shader", Shader.Find(defaultShader), typeof(Shader), false) as Shader);
-					defaultShader = shader != null ? shader.name : DEFAULT_DEFAULT_SHADER;
+					defaultShader = shader != null ? shader.name : SpinePreferences.DEFAULT_DEFAULT_SHADER;
 					if (EditorGUI.EndChangeCheck())
 						EditorPrefs.SetString(DEFAULT_SHADER_KEY, defaultShader);
 
@@ -439,6 +470,7 @@ namespace Spine.Unity.Editor {
 						SpineTK2DEditorUtility.DisableTK2D();
 				}
 			}
+		#endif // !NEW_PREFERENCES_SETTINGS_PROVIDER
 		}
 
 		static void BoolPrefsField (ref bool currentValue, string editorPrefsKey, GUIContent label) {
@@ -457,7 +489,18 @@ namespace Spine.Unity.Editor {
 			}
 		}
 
+		public static void FloatPropertyField(SerializedProperty property, GUIContent label, float min = float.NegativeInfinity, float max = float.PositiveInfinity) {
+			EditorGUI.BeginChangeCheck();
+			property.floatValue = EditorGUILayout.DelayedFloatField(label, property.floatValue);
+			if (EditorGUI.EndChangeCheck()) {
+				property.floatValue = Mathf.Clamp(property.floatValue, min, max);
+			}
+		}
 
+		public static void ShaderPropertyField(SerializedProperty property, GUIContent label, string fallbackShaderName) {
+			var shader = (EditorGUILayout.ObjectField(label, Shader.Find(property.stringValue), typeof(Shader), false) as Shader);
+			property.stringValue = shader != null ? shader.name : fallbackShaderName;
+		}
 
 		public static class DataReloadHandler {
 
@@ -1664,7 +1707,7 @@ namespace Spine.Unity.Editor {
 			}
 		}
 
-		static class HierarchyHandler {
+		public static class HierarchyHandler {
 			static Dictionary<int, GameObject> skeletonRendererTable = new Dictionary<int, GameObject>();
 			static Dictionary<int, SkeletonUtilityBone> skeletonUtilityBoneTable = new Dictionary<int, SkeletonUtilityBone>();
 			static Dictionary<int, BoundingBoxFollower> boundingBoxFollowerTable = new Dictionary<int, BoundingBoxFollower>();
@@ -1786,7 +1829,7 @@ namespace Spine.Unity.Editor {
 			}
 		}
 
-		internal static class SpineTK2DEditorUtility {
+		public static class SpineTK2DEditorUtility {
 			const string SPINE_TK2D_DEFINE = "SPINE_TK2D";
 
 			static bool IsInvalidGroup (BuildTargetGroup group) {

+ 179 - 0
spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpinePreferences.cs

@@ -0,0 +1,179 @@
+/******************************************************************************
+ * Spine Runtimes Software License v2.5
+ *
+ * Copyright (c) 2013-2019, Esoteric Software
+ * All rights reserved.
+ *
+ * You are granted a perpetual, non-exclusive, non-sublicensable, and
+ * non-transferable license to use, install, execute, and perform the Spine
+ * Runtimes software and derivative works solely for personal or internal
+ * use. Without the written permission of Esoteric Software (see Section 2 of
+ * the Spine Software License Agreement), you may not (a) modify, translate,
+ * adapt, or develop new applications using the Spine Runtimes or otherwise
+ * create derivative works or improvements of the Spine Runtimes or (b) remove,
+ * delete, alter, or obscure any trademarks or any copyright, trademark, patent,
+ * or other intellectual property or proprietary rights notices on or in the
+ * Software, including any copy thereof. Redistributions in binary or source
+ * form must include this license and terms.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
+ * USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *****************************************************************************/
+
+#if UNITY_2017_2_OR_NEWER
+#define NEWPLAYMODECALLBACKS
+#endif
+
+#if UNITY_2018_3_OR_NEWER
+#define NEW_PREFERENCES_SETTINGS_PROVIDER
+#endif
+
+using UnityEngine;
+using UnityEditor;
+
+namespace Spine.Unity.Editor {
+
+	public class SpinePreferences : ScriptableObject {
+
+		public const string SPINE_SETTINGS_ASSET_PATH = "Assets/Editor/SpineSettings.asset";
+
+		#if SPINE_TK2D
+		const float DEFAULT_DEFAULT_SCALE = 1f;
+		#else
+		internal const float DEFAULT_DEFAULT_SCALE = 0.01f;
+		#endif
+		public float defaultScale = DEFAULT_DEFAULT_SCALE;
+
+		internal const float DEFAULT_DEFAULT_MIX = 0.2f;
+		public float defaultMix = DEFAULT_DEFAULT_MIX;
+
+		internal const string DEFAULT_DEFAULT_SHADER = "Spine/Skeleton";
+		public string defaultShader = DEFAULT_DEFAULT_SHADER;
+
+		internal const float DEFAULT_DEFAULT_ZSPACING = 0f;
+		public float defaultZSpacing = DEFAULT_DEFAULT_ZSPACING;
+
+		internal const bool DEFAULT_DEFAULT_INSTANTIATE_LOOP = true;
+		public bool defaultInstantiateLoop = DEFAULT_DEFAULT_INSTANTIATE_LOOP;
+
+		internal const bool DEFAULT_SHOW_HIERARCHY_ICONS = true;
+		public bool showHierarchyIcons = DEFAULT_SHOW_HIERARCHY_ICONS;
+
+		internal const bool DEFAULT_SET_TEXTUREIMPORTER_SETTINGS = true;
+		public bool setTextureImporterSettings = DEFAULT_SET_TEXTUREIMPORTER_SETTINGS;
+
+		internal const bool DEFAULT_ATLASTXT_WARNING = true;
+		public bool atlasTxtImportWarning = DEFAULT_ATLASTXT_WARNING;
+
+		internal const bool DEFAULT_TEXTUREIMPORTER_WARNING = true;
+		public bool textureImporterWarning = DEFAULT_TEXTUREIMPORTER_WARNING;
+
+		public const float DEFAULT_MIPMAPBIAS = -0.5f;
+
+		public const bool DEFAULT_AUTO_RELOAD_SCENESKELETONS = true;
+		public bool autoReloadSceneSkeletons = DEFAULT_AUTO_RELOAD_SCENESKELETONS;
+
+		internal const float DEFAULT_SCENE_ICONS_SCALE = 1f;
+		public const string SCENE_ICONS_SCALE_KEY = "SPINE_SCENE_ICONS_SCALE";
+
+	#if NEW_PREFERENCES_SETTINGS_PROVIDER
+		public static void Load () {
+			SpineHandles.handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, DEFAULT_SCENE_ICONS_SCALE);
+			GetOrCreateSettings();
+		}
+
+		internal static SpinePreferences GetOrCreateSettings () {
+			var settings = AssetDatabase.LoadAssetAtPath<SpinePreferences>(SPINE_SETTINGS_ASSET_PATH);
+			if (settings == null)
+			{
+				settings = ScriptableObject.CreateInstance<SpinePreferences>();
+				if (!AssetDatabase.IsValidFolder("Assets/Editor"))
+					AssetDatabase.CreateFolder("Assets", "Editor");
+				AssetDatabase.CreateAsset(settings, SPINE_SETTINGS_ASSET_PATH);
+				AssetDatabase.SaveAssets();
+			}
+			return settings;
+		}
+
+		internal static SerializedObject GetSerializedSettings () {
+			return new SerializedObject(GetOrCreateSettings());
+		}
+
+		public static void HandlePreferencesGUI (SerializedObject settings) {
+			
+			float prevLabelWidth = EditorGUIUtility.labelWidth;
+			EditorGUIUtility.labelWidth = 250;
+			
+			using (new EditorGUI.IndentLevelScope()) {
+				EditorGUI.BeginChangeCheck();
+				EditorGUILayout.PropertyField(settings.FindProperty("showHierarchyIcons"), new GUIContent("Show Hierarchy Icons", "Show relevant icons on GameObjects with Spine Components on them. Disable this if you have large, complex scenes."));
+				if (EditorGUI.EndChangeCheck()) {
+					#if NEWPLAYMODECALLBACKS
+					SpineEditorUtilities.HierarchyHandler.IconsOnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode);
+					#else
+					SpineEditorUtilities.HierarchyHandler.IconsOnPlaymodeStateChanged();
+					#endif
+				}
+
+				EditorGUILayout.PropertyField(settings.FindProperty("autoReloadSceneSkeletons"), new GUIContent("Auto-reload scene components", "Reloads Skeleton components in the scene whenever their SkeletonDataAsset is modified. This makes it so changes in the SkeletonDataAsset inspector are immediately reflected. This may be slow when your scenes have large numbers of SkeletonRenderers or SkeletonGraphic."));
+
+				EditorGUILayout.Separator();
+				EditorGUILayout.LabelField("Auto-Import Settings", EditorStyles.boldLabel);
+				{
+					SpineEditorUtilities.FloatPropertyField(settings.FindProperty("defaultMix"), new GUIContent("Default Mix", "The Default Mix Duration for newly imported SkeletonDataAssets."), min: 0f);
+					SpineEditorUtilities.FloatPropertyField(settings.FindProperty("defaultScale"), new GUIContent("Default SkeletonData Scale", "The Default skeleton import scale for newly imported SkeletonDataAssets."), min: 0.0000001f);
+					
+					SpineEditorUtilities.ShaderPropertyField(settings.FindProperty("defaultShader"), new GUIContent("Default Shader"), SpinePreferences.DEFAULT_DEFAULT_SHADER);
+
+					EditorGUILayout.PropertyField(settings.FindProperty("setTextureImporterSettings"), new GUIContent("Apply Atlas Texture Settings", "Apply the recommended settings for Texture Importers."));
+				}
+
+				EditorGUILayout.Space();
+				EditorGUILayout.LabelField("Warnings", EditorStyles.boldLabel);
+				{
+					EditorGUILayout.PropertyField(settings.FindProperty("atlasTxtImportWarning"), new GUIContent("Atlas Extension Warning", "Log a warning and recommendation whenever a `.atlas` file is found."));
+					EditorGUILayout.PropertyField(settings.FindProperty("textureImporterWarning"), new GUIContent("Texture Settings Warning", "Log a warning and recommendation whenever Texture Import Settings are detected that could lead to undesired effects, e.g. white border artifacts."));
+				}
+
+				EditorGUILayout.Space();
+				EditorGUILayout.LabelField("Editor Instantiation", EditorStyles.boldLabel);
+				{
+					EditorGUILayout.Slider(settings.FindProperty("defaultZSpacing"), -0.1f, 0f, new GUIContent("Default Slot Z-Spacing"));
+					EditorGUILayout.PropertyField(settings.FindProperty("defaultInstantiateLoop"), new GUIContent("Default Loop", "Spawn Spine GameObjects with loop enabled."));
+				}
+
+				EditorGUILayout.Space();
+				EditorGUILayout.LabelField("Handles and Gizmos", EditorStyles.boldLabel);
+				{
+					EditorGUI.BeginChangeCheck();
+					SpineHandles.handleScale = EditorGUILayout.Slider("Editor Bone Scale", SpineHandles.handleScale, 0.01f, 2f);
+					SpineHandles.handleScale = Mathf.Max(0.01f, SpineHandles.handleScale);
+					if (EditorGUI.EndChangeCheck()) {
+						EditorPrefs.SetFloat(SpinePreferences.SCENE_ICONS_SCALE_KEY, SpineHandles.handleScale);
+						SceneView.RepaintAll();
+					}
+				}
+				
+				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)))
+						SpineEditorUtilities.SpineTK2DEditorUtility.EnableTK2D();
+					if (GUILayout.Button("Disable", GUILayout.Width(64)))
+						SpineEditorUtilities.SpineTK2DEditorUtility.DisableTK2D();
+				}
+			}
+			EditorGUIUtility.labelWidth = prevLabelWidth;
+		}
+	#endif // NEW_PREFERENCES_SETTINGS_PROVIDER
+	}
+}

+ 11 - 0
spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpinePreferences.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b29e98153ec2fbd44b8f7da1b41194e8
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: