From 9ab690005a79f967a7a486edbcdc7425ec4acbb5 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Thu, 3 Oct 2013 21:47:55 +0200 Subject: [PATCH] Deleted useAnimationName. Cleaned up examples. useAnimationName isn't needed now that animationName is just a property that sets the animation for track zero. --- .../Editor/SkeletonAnimationInspector.cs | 26 ++++++------------ .../Assets/examples/spineboy/Spineboy.cs | 1 - .../Assets/examples/spineboy/spineboy.unity | Bin 18696 -> 18360 bytes .../Editor/SkeletonAnimationInspector.cs | 26 ++++++------------ spine-unity/Assets/Spine/SkeletonAnimation.cs | 2 -- .../Assets/examples/spineboy/Spineboy.cs | 4 +-- .../Assets/examples/spineboy/spineboy.unity | Bin 18688 -> 18328 bytes 7 files changed, 19 insertions(+), 40 deletions(-) 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 841d2c62c377b7744734aa147771f64a0149fcb5..c79575cd46e1ed7bb9ebcab278f3e1ed407d86e9 100644 GIT binary patch delta 440 zcmXYrOG^S#7>3W6iZeqOp$V<&;th;0qn44Iu9|KqC=hAUO56m}CZQqlfn;RZep6E!FUjwVhlS$$sm9S7`icYa@*VAwOS*tJtI1IU7>BT2Xo1u9ME1 z!%MZ?hw5RMQp0yPC)L6Esh)e405xz%>7qtHhHv5UTo?IE?mGfo1B-$U zNWCPtCN9CYkV%Lsvxrx~A#7@ZACr0m%Sg5kW~vNUlx!N=)H~Q2*aEyN^#P{w^}s2Y hV@_i=c27K-XeHv6L_0smDvVMhN*qj78c&0_^aG{sk*WXy 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 6c6e8161c63c812b485c633d43d461057a877f81..4c0a78ed4ffaabf9c66e5a75a6fbce1ec3ba9404 100644 GIT binary patch delta 547 zcmY+B%PT}t9LImZ8Jc?)7G@e;j~SzgJjNqZ@(Ow66(uR%x-*)ZhprI|g&hmT+04Si zQp)Oj{RuX9vbOamONH+pC*@b)^ZWfi=hyk3(^=o=)Glj8-AvS3gSE}! z;GWjRiuGRe$<~mghecgRwbiEGu*mgR{*nbxrszi~HBTHjxW#f~wrE#f z;#$$zEAEv5=ZkDLAodjOxpKHLJsDQrtcmf0Jh7u{TqKUwx`|@jAAvg&4cH6O)IdDh zO3_4OA&pCZ>A#W1q#23N)0`fU#Pnn&5g*ZGA^Jv?rtN*UJ^Nwn=Q7*ey3LwwSu=2y zJ!B$V9}k1A4x%H}Ua3>CJFs%}eyKAs#Yr@VK11ppY#OW+eV5b)SPHBj{g?E396p@8 z0^0(^3un@AcmkZpNj|`Fsb{bi$yUK^y?~`8n?-Ny73>l$hT1Ll23Bb~d$t`xT%9^U pPRNC9gu?n#G>K}x1Iu6F*U2#TKPWBySSpoaB1ANP9d$S=*RyOX@u`>soR*rWho*F2*D-^L=mobYf^spXe(jq4SS zKh^4_^DiY#jqFjw6y&(tLQU*dBGk;sejkr0I)!*f>4~+-J5eMb_Vq%HWs2qtF<;H6 zibf%88l~c!Y$0!d(#reFQ(yKTmnVnqxHdbk-Hz)(oG*AcYPM7=+rLL-3hFM+no=j8 zFOH*^BPw`X=O@Eamk{6K{f@T54#C>c%Wb80z%IZ>;U78L1sie;(T6_eXb zlW{t-Ie7r~5e$1w*vp&&j$%>>@U5fYU}c9bfJyxUTXWbu^iqGpw!jMTnxlVUA&XNh iu6huGRYl+VPiX}&^=n)nY_!U+mWf0Cigh*cjs63y+oxjy