mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] SpineEditorUtilities better defines.
This commit is contained in:
parent
54c6aacaa2
commit
ce9492a74c
@ -33,6 +33,15 @@
|
|||||||
// Original contribution by: Mitch Thompson
|
// Original contribution by: Mitch Thompson
|
||||||
|
|
||||||
#define SPINE_SKELETONMECANIM
|
#define SPINE_SKELETONMECANIM
|
||||||
|
|
||||||
|
#if UNITY_2017_2_OR_NEWER
|
||||||
|
#define NEWPLAYMODECALLBACKS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UNITY_2018 || UNITY_2019
|
||||||
|
#define NEWHIERARCHYWINDOWCALLBACKS
|
||||||
|
#endif
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -169,7 +178,7 @@ namespace Spine.Unity.Editor {
|
|||||||
AssetUtility.HandleOnPostprocessAllAssets(imported);
|
AssetUtility.HandleOnPostprocessAllAssets(imported);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Initialization
|
#region Initialization
|
||||||
static SpineEditorUtilities () {
|
static SpineEditorUtilities () {
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
@ -192,7 +201,7 @@ namespace Spine.Unity.Editor {
|
|||||||
EditorApplication.hierarchyWindowItemOnGUI += HierarchyHandler.HandleDragAndDrop;
|
EditorApplication.hierarchyWindowItemOnGUI += HierarchyHandler.HandleDragAndDrop;
|
||||||
|
|
||||||
// Hierarchy Icons
|
// Hierarchy Icons
|
||||||
#if UNITY_2017_2_OR_NEWER
|
#if NEWPLAYMODECALLBACKS
|
||||||
EditorApplication.playModeStateChanged -= HierarchyHandler.IconsOnPlaymodeStateChanged;
|
EditorApplication.playModeStateChanged -= HierarchyHandler.IconsOnPlaymodeStateChanged;
|
||||||
EditorApplication.playModeStateChanged += HierarchyHandler.IconsOnPlaymodeStateChanged;
|
EditorApplication.playModeStateChanged += HierarchyHandler.IconsOnPlaymodeStateChanged;
|
||||||
HierarchyHandler.IconsOnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode);
|
HierarchyHandler.IconsOnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode);
|
||||||
@ -204,7 +213,7 @@ namespace Spine.Unity.Editor {
|
|||||||
|
|
||||||
// Data Refresh Edit Mode.
|
// Data Refresh Edit Mode.
|
||||||
// This prevents deserialized SkeletonData from persisting from play mode to edit mode.
|
// This prevents deserialized SkeletonData from persisting from play mode to edit mode.
|
||||||
#if UNITY_2017_2_OR_NEWER
|
#if NEWPLAYMODECALLBACKS
|
||||||
EditorApplication.playModeStateChanged -= DataReloadHandler.OnPlaymodeStateChanged;
|
EditorApplication.playModeStateChanged -= DataReloadHandler.OnPlaymodeStateChanged;
|
||||||
EditorApplication.playModeStateChanged += DataReloadHandler.OnPlaymodeStateChanged;
|
EditorApplication.playModeStateChanged += DataReloadHandler.OnPlaymodeStateChanged;
|
||||||
DataReloadHandler.OnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode);
|
DataReloadHandler.OnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode);
|
||||||
@ -221,7 +230,7 @@ namespace Spine.Unity.Editor {
|
|||||||
if (!initialized || Icons.skeleton == null)
|
if (!initialized || Icons.skeleton == null)
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public static class Preferences {
|
public static class Preferences {
|
||||||
#if SPINE_TK2D
|
#if SPINE_TK2D
|
||||||
@ -288,7 +297,7 @@ namespace Spine.Unity.Editor {
|
|||||||
showHierarchyIcons = EditorGUILayout.Toggle(new GUIContent("Show Hierarchy Icons", "Show relevant icons on GameObjects with Spine Components on them. Disable this if you have large, complex scenes."), showHierarchyIcons);
|
showHierarchyIcons = EditorGUILayout.Toggle(new GUIContent("Show Hierarchy Icons", "Show relevant icons on GameObjects with Spine Components on them. Disable this if you have large, complex scenes."), showHierarchyIcons);
|
||||||
if (EditorGUI.EndChangeCheck()) {
|
if (EditorGUI.EndChangeCheck()) {
|
||||||
EditorPrefs.SetBool(SHOW_HIERARCHY_ICONS_KEY, showHierarchyIcons);
|
EditorPrefs.SetBool(SHOW_HIERARCHY_ICONS_KEY, showHierarchyIcons);
|
||||||
#if UNITY_2017_2_OR_NEWER
|
#if NEWPLAYMODECALLBACKS
|
||||||
HierarchyHandler.IconsOnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode);
|
HierarchyHandler.IconsOnPlaymodeStateChanged(PlayModeStateChange.EnteredEditMode);
|
||||||
#else
|
#else
|
||||||
HierarchyHandler.IconsOnPlaymodeStateChanged();
|
HierarchyHandler.IconsOnPlaymodeStateChanged();
|
||||||
@ -360,7 +369,7 @@ namespace Spine.Unity.Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class DataReloadHandler {
|
public static class DataReloadHandler {
|
||||||
#if UNITY_2017_2_OR_NEWER
|
#if NEWPLAYMODECALLBACKS
|
||||||
internal static void OnPlaymodeStateChanged (PlayModeStateChange stateChange) {
|
internal static void OnPlaymodeStateChanged (PlayModeStateChange stateChange) {
|
||||||
#else
|
#else
|
||||||
internal static void OnPlaymodeStateChanged () {
|
internal static void OnPlaymodeStateChanged () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user