Auto-reset checkbox in SkeletonAnimation inspector

This commit is contained in:
John 2015-12-24 06:56:04 +08:00
parent f67a5457a0
commit 5378b7979e

View File

@ -36,19 +36,20 @@ using Spine;
[CustomEditor(typeof(SkeletonAnimation))] [CustomEditor(typeof(SkeletonAnimation))]
public class SkeletonAnimationInspector : SkeletonRendererInspector { public class SkeletonAnimationInspector : SkeletonRendererInspector {
protected SerializedProperty animationName, loop, timeScale; protected SerializedProperty animationName, loop, timeScale, autoReset;
protected bool isPrefab; protected bool m_isPrefab;
protected GUIContent autoResetLabel;
protected override void OnEnable () { protected override void OnEnable () {
base.OnEnable(); base.OnEnable();
animationName = serializedObject.FindProperty("_animationName"); animationName = serializedObject.FindProperty("_animationName");
loop = serializedObject.FindProperty("loop"); loop = serializedObject.FindProperty("loop");
timeScale = serializedObject.FindProperty("timeScale"); timeScale = serializedObject.FindProperty("timeScale");
autoReset = serializedObject.FindProperty("autoReset");
autoResetLabel = new GUIContent("Generic Auto-reset");
if (PrefabUtility.GetPrefabType(this.target) == PrefabType.Prefab) if (PrefabUtility.GetPrefabType(this.target) == PrefabType.Prefab)
isPrefab = true; m_isPrefab = true;
} }
protected override void gui () { protected override void gui () {
@ -96,11 +97,12 @@ public class SkeletonAnimationInspector : SkeletonRendererInspector {
EditorGUILayout.PropertyField(loop); EditorGUILayout.PropertyField(loop);
EditorGUILayout.PropertyField(timeScale); EditorGUILayout.PropertyField(timeScale);
EditorGUILayout.PropertyField(autoReset, autoResetLabel);
component.timeScale = Math.Max(component.timeScale, 0); component.timeScale = Math.Max(component.timeScale, 0);
EditorGUILayout.Space(); EditorGUILayout.Space();
if (!isPrefab) { if (!m_isPrefab) {
if (component.GetComponent<SkeletonUtility>() == null) { if (component.GetComponent<SkeletonUtility>() == null) {
if (GUILayout.Button(new GUIContent("Add Skeleton Utility", SpineEditorUtilities.Icons.skeletonUtility), GUILayout.Height(30))) { if (GUILayout.Button(new GUIContent("Add Skeleton Utility", SpineEditorUtilities.Icons.skeletonUtility), GUILayout.Height(30))) {
component.gameObject.AddComponent<SkeletonUtility>(); component.gameObject.AddComponent<SkeletonUtility>();