diff --git a/spine-tk2d/Assets/Spine/Editor/SkeletonAnimationInspector.cs b/spine-tk2d/Assets/Spine/Editor/SkeletonAnimationInspector.cs index 02f6b9264..e1b24ba0c 100644 --- a/spine-tk2d/Assets/Spine/Editor/SkeletonAnimationInspector.cs +++ b/spine-tk2d/Assets/Spine/Editor/SkeletonAnimationInspector.cs @@ -38,13 +38,12 @@ using UnityEngine; [CustomEditor(typeof(SkeletonAnimation))] public class SkeletonAnimationInspector : Editor { private SerializedProperty skeletonDataAsset, initialSkinName, timeScale, normals, tangents; - private SerializedProperty animationName, loop, useAnimationName; + private SerializedProperty animationName, loop; void OnEnable () { skeletonDataAsset = serializedObject.FindProperty("skeletonDataAsset"); animationName = serializedObject.FindProperty("_animationName"); loop = serializedObject.FindProperty("loop"); - useAnimationName = serializedObject.FindProperty("useAnimationName"); initialSkinName = serializedObject.FindProperty("initialSkinName"); timeScale = serializedObject.FindProperty("timeScale"); normals = serializedObject.FindProperty("calculateNormals"); @@ -79,15 +78,14 @@ public class SkeletonAnimationInspector : Editor { initialSkinName.stringValue = skins[skinIndex]; // Animation name. - String[] animations = new String[component.skeleton.Data.Animations.Count + 2]; - animations[0] = ""; - animations[1] = ""; - int animationIndex = useAnimationName.boolValue ? 1 : 0; - for (int i = 0; i < animations.Length - 2; i++) { + String[] animations = new String[component.skeleton.Data.Animations.Count + 1]; + animations[0] = ""; + int animationIndex = 0; + for (int i = 0; i < animations.Length - 1; i++) { String name = component.skeleton.Data.Animations[i].Name; - animations[i + 2] = name; + animations[i + 1] = name; if (name == animationName.stringValue) - animationIndex = i + 2; + animationIndex = i + 1; } EditorGUILayout.BeginHorizontal(); @@ -97,16 +95,10 @@ public class SkeletonAnimationInspector : Editor { EditorGUIUtility.LookLikeInspector(); EditorGUILayout.EndHorizontal(); - if (animationIndex == 0) { + if (animationIndex == 0) component.animationName = null; - useAnimationName.boolValue = false; - } else if (animationIndex == 1) { - component.animationName = null; - useAnimationName.boolValue = true; - } else { + else component.animationName = animations[animationIndex]; - useAnimationName.boolValue = true; - } } // Animation loop. diff --git a/spine-tk2d/Assets/examples/spineboy/Spineboy.cs b/spine-tk2d/Assets/examples/spineboy/Spineboy.cs index 5d9e37bca..10dda6d66 100644 --- a/spine-tk2d/Assets/examples/spineboy/Spineboy.cs +++ b/spine-tk2d/Assets/examples/spineboy/Spineboy.cs @@ -49,7 +49,6 @@ public class Spineboy : MonoBehaviour { } void OnMouseDown() { - skeleton.useAnimationName = false; skeleton.state.SetAnimation(0, "jump", false); skeleton.state.AddAnimation(0, "walk", true, 0); } diff --git a/spine-tk2d/Assets/examples/spineboy/spineboy.unity b/spine-tk2d/Assets/examples/spineboy/spineboy.unity index 841d2c62c..c79575cd4 100644 Binary files a/spine-tk2d/Assets/examples/spineboy/spineboy.unity and b/spine-tk2d/Assets/examples/spineboy/spineboy.unity differ diff --git a/spine-unity/Assets/Spine/Editor/SkeletonAnimationInspector.cs b/spine-unity/Assets/Spine/Editor/SkeletonAnimationInspector.cs index 02f6b9264..e1b24ba0c 100644 --- a/spine-unity/Assets/Spine/Editor/SkeletonAnimationInspector.cs +++ b/spine-unity/Assets/Spine/Editor/SkeletonAnimationInspector.cs @@ -38,13 +38,12 @@ using UnityEngine; [CustomEditor(typeof(SkeletonAnimation))] public class SkeletonAnimationInspector : Editor { private SerializedProperty skeletonDataAsset, initialSkinName, timeScale, normals, tangents; - private SerializedProperty animationName, loop, useAnimationName; + private SerializedProperty animationName, loop; void OnEnable () { skeletonDataAsset = serializedObject.FindProperty("skeletonDataAsset"); animationName = serializedObject.FindProperty("_animationName"); loop = serializedObject.FindProperty("loop"); - useAnimationName = serializedObject.FindProperty("useAnimationName"); initialSkinName = serializedObject.FindProperty("initialSkinName"); timeScale = serializedObject.FindProperty("timeScale"); normals = serializedObject.FindProperty("calculateNormals"); @@ -79,15 +78,14 @@ public class SkeletonAnimationInspector : Editor { initialSkinName.stringValue = skins[skinIndex]; // Animation name. - String[] animations = new String[component.skeleton.Data.Animations.Count + 2]; - animations[0] = ""; - animations[1] = ""; - int animationIndex = useAnimationName.boolValue ? 1 : 0; - for (int i = 0; i < animations.Length - 2; i++) { + String[] animations = new String[component.skeleton.Data.Animations.Count + 1]; + animations[0] = ""; + int animationIndex = 0; + for (int i = 0; i < animations.Length - 1; i++) { String name = component.skeleton.Data.Animations[i].Name; - animations[i + 2] = name; + animations[i + 1] = name; if (name == animationName.stringValue) - animationIndex = i + 2; + animationIndex = i + 1; } EditorGUILayout.BeginHorizontal(); @@ -97,16 +95,10 @@ public class SkeletonAnimationInspector : Editor { EditorGUIUtility.LookLikeInspector(); EditorGUILayout.EndHorizontal(); - if (animationIndex == 0) { + if (animationIndex == 0) component.animationName = null; - useAnimationName.boolValue = false; - } else if (animationIndex == 1) { - component.animationName = null; - useAnimationName.boolValue = true; - } else { + else component.animationName = animations[animationIndex]; - useAnimationName.boolValue = true; - } } // Animation loop. diff --git a/spine-unity/Assets/Spine/SkeletonAnimation.cs b/spine-unity/Assets/Spine/SkeletonAnimation.cs index 370acd67c..39d2b7ae8 100644 --- a/spine-unity/Assets/Spine/SkeletonAnimation.cs +++ b/spine-unity/Assets/Spine/SkeletonAnimation.cs @@ -40,7 +40,6 @@ using Spine; /** Extends SkeletonComponent to apply an animation. */ [ExecuteInEditMode, RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))] public class SkeletonAnimation : SkeletonComponent { - public bool useAnimationName; public bool loop; public Spine.AnimationState state; @@ -51,7 +50,6 @@ public class SkeletonAnimation : SkeletonComponent { return entry == null ? null : entry.Animation.Name; } set { - if (!useAnimationName) return; if (_animationName == value) return; _animationName = value; if (value == null || value.Length == 0) diff --git a/spine-unity/Assets/examples/spineboy/Spineboy.cs b/spine-unity/Assets/examples/spineboy/Spineboy.cs index ae17fc0d3..c0d9bd943 100644 --- a/spine-unity/Assets/examples/spineboy/Spineboy.cs +++ b/spine-unity/Assets/examples/spineboy/Spineboy.cs @@ -40,9 +40,7 @@ public class Spineboy : MonoBehaviour { SkeletonAnimation skeletonAnimation; public void Start () { - skeletonAnimation = GetComponent(); - skeletonAnimation.state.SetAnimation(0, "walk", true); - + skeletonAnimation = GetComponent(); skeletonAnimation.state.Event += new EventHandler(Event); } diff --git a/spine-unity/Assets/examples/spineboy/spineboy.unity b/spine-unity/Assets/examples/spineboy/spineboy.unity index 6c6e8161c..4c0a78ed4 100644 Binary files a/spine-unity/Assets/examples/spineboy/spineboy.unity and b/spine-unity/Assets/examples/spineboy/spineboy.unity differ