mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[unity] Fixed Mecanim events for folders. Added preferences entry whether folder name shall be added to called method name or omitted.
This commit is contained in:
parent
0b4bc2db94
commit
9c331fcf4f
@ -39,14 +39,6 @@
|
|||||||
#define NEW_PREFAB_SYSTEM
|
#define NEW_PREFAB_SYSTEM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UNITY_2018 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEWHIERARCHYWINDOWCALLBACKS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEW_PREFERENCES_SETTINGS_PROVIDER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@ -43,10 +43,6 @@
|
|||||||
#define NEWHIERARCHYWINDOWCALLBACKS
|
#define NEWHIERARCHYWINDOWCALLBACKS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEW_PREFERENCES_SETTINGS_PROVIDER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@ -35,18 +35,6 @@
|
|||||||
#define NEWPLAYMODECALLBACKS
|
#define NEWPLAYMODECALLBACKS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEW_PREFAB_SYSTEM
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEWHIERARCHYWINDOWCALLBACKS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEW_PREFERENCES_SETTINGS_PROVIDER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@ -31,22 +31,6 @@
|
|||||||
|
|
||||||
#define SPINE_SKELETONMECANIM
|
#define SPINE_SKELETONMECANIM
|
||||||
|
|
||||||
#if UNITY_2017_2_OR_NEWER
|
|
||||||
#define NEWPLAYMODECALLBACKS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEW_PREFAB_SYSTEM
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEWHIERARCHYWINDOWCALLBACKS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEW_PREFERENCES_SETTINGS_PROVIDER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@ -31,22 +31,6 @@
|
|||||||
|
|
||||||
#define SPINE_SKELETONMECANIM
|
#define SPINE_SKELETONMECANIM
|
||||||
|
|
||||||
#if UNITY_2017_2_OR_NEWER
|
|
||||||
#define NEWPLAYMODECALLBACKS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEW_PREFAB_SYSTEM
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEWHIERARCHYWINDOWCALLBACKS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEW_PREFERENCES_SETTINGS_PROVIDER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@ -39,10 +39,6 @@
|
|||||||
#define NEW_PREFAB_SYSTEM
|
#define NEW_PREFAB_SYSTEM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UNITY_2018 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEWHIERARCHYWINDOWCALLBACKS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018_3_OR_NEWER
|
#if UNITY_2018_3_OR_NEWER
|
||||||
#define NEW_PREFERENCES_SETTINGS_PROVIDER
|
#define NEW_PREFERENCES_SETTINGS_PROVIDER
|
||||||
#endif
|
#endif
|
||||||
@ -139,6 +135,9 @@ namespace Spine.Unity.Editor {
|
|||||||
const string AUTO_RELOAD_SCENESKELETONS_KEY = "SPINE_AUTO_RELOAD_SCENESKELETONS";
|
const string AUTO_RELOAD_SCENESKELETONS_KEY = "SPINE_AUTO_RELOAD_SCENESKELETONS";
|
||||||
public static bool autoReloadSceneSkeletons = SpinePreferences.DEFAULT_AUTO_RELOAD_SCENESKELETONS;
|
public static bool autoReloadSceneSkeletons = SpinePreferences.DEFAULT_AUTO_RELOAD_SCENESKELETONS;
|
||||||
|
|
||||||
|
const string MECANIM_EVENT_INCLUDE_FOLDERNAME_KEY = "SPINE_MECANIM_EVENT_INCLUDE_FOLDERNAME";
|
||||||
|
public static bool mecanimEventIncludeFolderName = SpinePreferences.DEFAULT_MECANIM_EVENT_INCLUDE_FOLDERNAME;
|
||||||
|
|
||||||
static bool preferencesLoaded = false;
|
static bool preferencesLoaded = false;
|
||||||
|
|
||||||
public static void Load () {
|
public static void Load () {
|
||||||
@ -152,6 +151,7 @@ namespace Spine.Unity.Editor {
|
|||||||
showHierarchyIcons = EditorPrefs.GetBool(SHOW_HIERARCHY_ICONS_KEY, SpinePreferences.DEFAULT_SHOW_HIERARCHY_ICONS);
|
showHierarchyIcons = EditorPrefs.GetBool(SHOW_HIERARCHY_ICONS_KEY, SpinePreferences.DEFAULT_SHOW_HIERARCHY_ICONS);
|
||||||
setTextureImporterSettings = EditorPrefs.GetBool(SET_TEXTUREIMPORTER_SETTINGS_KEY, SpinePreferences.DEFAULT_SET_TEXTUREIMPORTER_SETTINGS);
|
setTextureImporterSettings = EditorPrefs.GetBool(SET_TEXTUREIMPORTER_SETTINGS_KEY, SpinePreferences.DEFAULT_SET_TEXTUREIMPORTER_SETTINGS);
|
||||||
autoReloadSceneSkeletons = EditorPrefs.GetBool(AUTO_RELOAD_SCENESKELETONS_KEY, SpinePreferences.DEFAULT_AUTO_RELOAD_SCENESKELETONS);
|
autoReloadSceneSkeletons = EditorPrefs.GetBool(AUTO_RELOAD_SCENESKELETONS_KEY, SpinePreferences.DEFAULT_AUTO_RELOAD_SCENESKELETONS);
|
||||||
|
mecanimEventIncludeFolderName = EditorPrefs.GetBool(MECANIM_EVENT_INCLUDE_FOLDERNAME_KEY, SpinePreferences.DEFAULT_MECANIM_EVENT_INCLUDE_FOLDERNAME);
|
||||||
atlasTxtImportWarning = EditorPrefs.GetBool(ATLASTXT_WARNING_KEY, SpinePreferences.DEFAULT_ATLASTXT_WARNING);
|
atlasTxtImportWarning = EditorPrefs.GetBool(ATLASTXT_WARNING_KEY, SpinePreferences.DEFAULT_ATLASTXT_WARNING);
|
||||||
textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING);
|
textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING);
|
||||||
|
|
||||||
@ -168,6 +168,7 @@ namespace Spine.Unity.Editor {
|
|||||||
newPreferences.showHierarchyIcons = EditorPrefs.GetBool(SHOW_HIERARCHY_ICONS_KEY, SpinePreferences.DEFAULT_SHOW_HIERARCHY_ICONS);
|
newPreferences.showHierarchyIcons = EditorPrefs.GetBool(SHOW_HIERARCHY_ICONS_KEY, SpinePreferences.DEFAULT_SHOW_HIERARCHY_ICONS);
|
||||||
newPreferences.setTextureImporterSettings = EditorPrefs.GetBool(SET_TEXTUREIMPORTER_SETTINGS_KEY, SpinePreferences.DEFAULT_SET_TEXTUREIMPORTER_SETTINGS);
|
newPreferences.setTextureImporterSettings = EditorPrefs.GetBool(SET_TEXTUREIMPORTER_SETTINGS_KEY, SpinePreferences.DEFAULT_SET_TEXTUREIMPORTER_SETTINGS);
|
||||||
newPreferences.autoReloadSceneSkeletons = EditorPrefs.GetBool(AUTO_RELOAD_SCENESKELETONS_KEY, SpinePreferences.DEFAULT_AUTO_RELOAD_SCENESKELETONS);
|
newPreferences.autoReloadSceneSkeletons = EditorPrefs.GetBool(AUTO_RELOAD_SCENESKELETONS_KEY, SpinePreferences.DEFAULT_AUTO_RELOAD_SCENESKELETONS);
|
||||||
|
newPreferences.mecanimEventIncludeFolderName = EditorPrefs.GetBool(MECANIM_EVENT_INCLUDE_FOLDERNAME_KEY, SpinePreferences.DEFAULT_MECANIM_EVENT_INCLUDE_FOLDERNAME);
|
||||||
newPreferences.atlasTxtImportWarning = EditorPrefs.GetBool(ATLASTXT_WARNING_KEY, SpinePreferences.DEFAULT_ATLASTXT_WARNING);
|
newPreferences.atlasTxtImportWarning = EditorPrefs.GetBool(ATLASTXT_WARNING_KEY, SpinePreferences.DEFAULT_ATLASTXT_WARNING);
|
||||||
newPreferences.textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING);
|
newPreferences.textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING);
|
||||||
}
|
}
|
||||||
@ -180,6 +181,7 @@ namespace Spine.Unity.Editor {
|
|||||||
EditorPrefs.SetBool(SHOW_HIERARCHY_ICONS_KEY, preferences.showHierarchyIcons);
|
EditorPrefs.SetBool(SHOW_HIERARCHY_ICONS_KEY, preferences.showHierarchyIcons);
|
||||||
EditorPrefs.SetBool(SET_TEXTUREIMPORTER_SETTINGS_KEY, preferences.setTextureImporterSettings);
|
EditorPrefs.SetBool(SET_TEXTUREIMPORTER_SETTINGS_KEY, preferences.setTextureImporterSettings);
|
||||||
EditorPrefs.SetBool(AUTO_RELOAD_SCENESKELETONS_KEY, preferences.autoReloadSceneSkeletons);
|
EditorPrefs.SetBool(AUTO_RELOAD_SCENESKELETONS_KEY, preferences.autoReloadSceneSkeletons);
|
||||||
|
EditorPrefs.SetBool(MECANIM_EVENT_INCLUDE_FOLDERNAME_KEY, preferences.mecanimEventIncludeFolderName);
|
||||||
EditorPrefs.SetBool(ATLASTXT_WARNING_KEY, preferences.atlasTxtImportWarning);
|
EditorPrefs.SetBool(ATLASTXT_WARNING_KEY, preferences.atlasTxtImportWarning);
|
||||||
EditorPrefs.SetBool(TEXTUREIMPORTER_WARNING_KEY, preferences.textureImporterWarning);
|
EditorPrefs.SetBool(TEXTUREIMPORTER_WARNING_KEY, preferences.textureImporterWarning);
|
||||||
}
|
}
|
||||||
@ -236,6 +238,12 @@ namespace Spine.Unity.Editor {
|
|||||||
SpineEditorUtilities.BoolPrefsField(ref defaultInstantiateLoop, DEFAULT_INSTANTIATE_LOOP_KEY, new GUIContent("Default Loop", "Spawn Spine GameObjects with loop enabled."));
|
SpineEditorUtilities.BoolPrefsField(ref defaultInstantiateLoop, DEFAULT_INSTANTIATE_LOOP_KEY, new GUIContent("Default Loop", "Spawn Spine GameObjects with loop enabled."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.LabelField("Mecanim Settings", EditorStyles.boldLabel);
|
||||||
|
{
|
||||||
|
SpineEditorUtilities.BoolPrefsField(ref mecanimEventIncludeFolderName, MECANIM_EVENT_INCLUDE_FOLDERNAME_KEY, new GUIContent("Include Folder Name in Event", "When enabled, Mecanim events will call methods named 'FolderNameEventName', when disabled it will call 'EventName'."));
|
||||||
|
}
|
||||||
|
|
||||||
EditorGUILayout.Space();
|
EditorGUILayout.Space();
|
||||||
EditorGUILayout.LabelField("Handles and Gizmos", EditorStyles.boldLabel);
|
EditorGUILayout.LabelField("Handles and Gizmos", EditorStyles.boldLabel);
|
||||||
{
|
{
|
||||||
|
|||||||
@ -38,10 +38,6 @@
|
|||||||
#define NEWPLAYMODECALLBACKS
|
#define NEWPLAYMODECALLBACKS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEW_PREFAB_SYSTEM
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
#if UNITY_2018 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
||||||
#define NEWHIERARCHYWINDOWCALLBACKS
|
#define NEWHIERARCHYWINDOWCALLBACKS
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -31,22 +31,6 @@
|
|||||||
|
|
||||||
#define SPINE_SKELETONMECANIM
|
#define SPINE_SKELETONMECANIM
|
||||||
|
|
||||||
#if UNITY_2017_2_OR_NEWER
|
|
||||||
#define NEWPLAYMODECALLBACKS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018_3 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEW_PREFAB_SYSTEM
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018 || UNITY_2019 || UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEWHIERARCHYWINDOWCALLBACKS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if UNITY_2018_3_OR_NEWER
|
|
||||||
#define NEW_PREFERENCES_SETTINGS_PROVIDER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|||||||
@ -1301,9 +1301,14 @@ namespace Spine.Unity.Editor {
|
|||||||
var animEvents = new List<AnimationEvent>();
|
var animEvents = new List<AnimationEvent>();
|
||||||
for (int i = 0, n = frames.Length; i < n; i++) {
|
for (int i = 0, n = frames.Length; i < n; i++) {
|
||||||
var spineEvent = events[i];
|
var spineEvent = events[i];
|
||||||
|
string eventName = spineEvent.Data.Name;
|
||||||
|
if (SpineEditorUtilities.Preferences.mecanimEventIncludeFolderName)
|
||||||
|
eventName = eventName.Replace("/", ""); // calls method FolderNameEventName()
|
||||||
|
else
|
||||||
|
eventName = eventName.Substring(eventName.LastIndexOf('/') + 1); // calls method EventName()
|
||||||
var unityAnimationEvent = new AnimationEvent {
|
var unityAnimationEvent = new AnimationEvent {
|
||||||
time = frames[i],
|
time = frames[i],
|
||||||
functionName = spineEvent.Data.Name,
|
functionName = eventName,
|
||||||
messageOptions = eventOptions
|
messageOptions = eventOptions
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -89,6 +89,9 @@ namespace Spine.Unity.Editor {
|
|||||||
internal const float DEFAULT_SCENE_ICONS_SCALE = 1f;
|
internal const float DEFAULT_SCENE_ICONS_SCALE = 1f;
|
||||||
public const string SCENE_ICONS_SCALE_KEY = "SPINE_SCENE_ICONS_SCALE";
|
public const string SCENE_ICONS_SCALE_KEY = "SPINE_SCENE_ICONS_SCALE";
|
||||||
|
|
||||||
|
public const bool DEFAULT_MECANIM_EVENT_INCLUDE_FOLDERNAME = true;
|
||||||
|
public bool mecanimEventIncludeFolderName = DEFAULT_MECANIM_EVENT_INCLUDE_FOLDERNAME;
|
||||||
|
|
||||||
#if NEW_PREFERENCES_SETTINGS_PROVIDER
|
#if NEW_PREFERENCES_SETTINGS_PROVIDER
|
||||||
public static void Load () {
|
public static void Load () {
|
||||||
SpineHandles.handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, DEFAULT_SCENE_ICONS_SCALE);
|
SpineHandles.handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, DEFAULT_SCENE_ICONS_SCALE);
|
||||||
@ -155,6 +158,12 @@ namespace Spine.Unity.Editor {
|
|||||||
EditorGUILayout.PropertyField(settings.FindProperty("defaultInstantiateLoop"), new GUIContent("Default Loop", "Spawn Spine GameObjects with loop enabled."));
|
EditorGUILayout.PropertyField(settings.FindProperty("defaultInstantiateLoop"), new GUIContent("Default Loop", "Spawn Spine GameObjects with loop enabled."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EditorGUILayout.Space();
|
||||||
|
EditorGUILayout.LabelField("Mecanim Settings", EditorStyles.boldLabel);
|
||||||
|
{
|
||||||
|
EditorGUILayout.PropertyField(settings.FindProperty("mecanimEventIncludeFolderName"), new GUIContent("Include Folder Name in Event", "When enabled, Mecanim events will call methods named 'FolderNameEventName', when disabled it will call 'EventName'."));
|
||||||
|
}
|
||||||
|
|
||||||
EditorGUILayout.Space();
|
EditorGUILayout.Space();
|
||||||
EditorGUILayout.LabelField("Handles and Gizmos", EditorStyles.boldLabel);
|
EditorGUILayout.LabelField("Handles and Gizmos", EditorStyles.boldLabel);
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user