소스 검색

Deleted useAnimationName. Cleaned up examples.

useAnimationName isn't needed now that animationName is just a property that sets the animation for track zero.
NathanSweet 12 년 전
부모
커밋
9ab690005a

+ 9 - 17
spine-tk2d/Assets/Spine/Editor/SkeletonAnimationInspector.cs

@@ -38,13 +38,12 @@ using UnityEngine;
 [CustomEditor(typeof(SkeletonAnimation))]
 [CustomEditor(typeof(SkeletonAnimation))]
 public class SkeletonAnimationInspector : Editor {
 public class SkeletonAnimationInspector : Editor {
 	private SerializedProperty skeletonDataAsset, initialSkinName, timeScale, normals, tangents;
 	private SerializedProperty skeletonDataAsset, initialSkinName, timeScale, normals, tangents;
-	private SerializedProperty animationName, loop, useAnimationName;
+	private SerializedProperty animationName, loop;
 
 
 	void OnEnable () {
 	void OnEnable () {
 		skeletonDataAsset = serializedObject.FindProperty("skeletonDataAsset");
 		skeletonDataAsset = serializedObject.FindProperty("skeletonDataAsset");
 		animationName = serializedObject.FindProperty("_animationName");
 		animationName = serializedObject.FindProperty("_animationName");
 		loop = serializedObject.FindProperty("loop");
 		loop = serializedObject.FindProperty("loop");
-		useAnimationName = serializedObject.FindProperty("useAnimationName");
 		initialSkinName = serializedObject.FindProperty("initialSkinName");
 		initialSkinName = serializedObject.FindProperty("initialSkinName");
 		timeScale = serializedObject.FindProperty("timeScale");
 		timeScale = serializedObject.FindProperty("timeScale");
 		normals = serializedObject.FindProperty("calculateNormals");
 		normals = serializedObject.FindProperty("calculateNormals");
@@ -79,15 +78,14 @@ public class SkeletonAnimationInspector : Editor {
 			initialSkinName.stringValue = skins[skinIndex];
 			initialSkinName.stringValue = skins[skinIndex];
 
 
 			// Animation name.
 			// Animation name.
-			String[] animations = new String[component.skeleton.Data.Animations.Count + 2];
-			animations[0] = "<No Change>";
-			animations[1] = "<None>";
-			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] = "<None>";
+			int animationIndex = 0;
+			for (int i = 0; i < animations.Length - 1; i++) {
 				String name = component.skeleton.Data.Animations[i].Name;
 				String name = component.skeleton.Data.Animations[i].Name;
-				animations[i + 2] = name;
+				animations[i + 1] = name;
 				if (name == animationName.stringValue)
 				if (name == animationName.stringValue)
-					animationIndex = i + 2;
+					animationIndex = i + 1;
 			}
 			}
 		
 		
 			EditorGUILayout.BeginHorizontal();
 			EditorGUILayout.BeginHorizontal();
@@ -97,16 +95,10 @@ public class SkeletonAnimationInspector : Editor {
 			EditorGUIUtility.LookLikeInspector();
 			EditorGUIUtility.LookLikeInspector();
 			EditorGUILayout.EndHorizontal();
 			EditorGUILayout.EndHorizontal();
 
 
-			if (animationIndex == 0) {
+			if (animationIndex == 0)
 				component.animationName = null;
 				component.animationName = null;
-				useAnimationName.boolValue = false;
-			} else if (animationIndex == 1) {
-				component.animationName = null;
-				useAnimationName.boolValue = true;
-			} else {
+			else
 				component.animationName = animations[animationIndex];
 				component.animationName = animations[animationIndex];
-				useAnimationName.boolValue = true;
-			}
 		}
 		}
 
 
 		// Animation loop.
 		// Animation loop.

+ 0 - 1
spine-tk2d/Assets/examples/spineboy/Spineboy.cs

@@ -49,7 +49,6 @@ public class Spineboy : MonoBehaviour {
 	}
 	}
 
 
 	void OnMouseDown() {
 	void OnMouseDown() {
-		skeleton.useAnimationName = false;
 		skeleton.state.SetAnimation(0, "jump", false);
 		skeleton.state.SetAnimation(0, "jump", false);
 		skeleton.state.AddAnimation(0, "walk", true, 0);
 		skeleton.state.AddAnimation(0, "walk", true, 0);
 	}
 	}

BIN
spine-tk2d/Assets/examples/spineboy/spineboy.unity


+ 9 - 17
spine-unity/Assets/Spine/Editor/SkeletonAnimationInspector.cs

@@ -38,13 +38,12 @@ using UnityEngine;
 [CustomEditor(typeof(SkeletonAnimation))]
 [CustomEditor(typeof(SkeletonAnimation))]
 public class SkeletonAnimationInspector : Editor {
 public class SkeletonAnimationInspector : Editor {
 	private SerializedProperty skeletonDataAsset, initialSkinName, timeScale, normals, tangents;
 	private SerializedProperty skeletonDataAsset, initialSkinName, timeScale, normals, tangents;
-	private SerializedProperty animationName, loop, useAnimationName;
+	private SerializedProperty animationName, loop;
 
 
 	void OnEnable () {
 	void OnEnable () {
 		skeletonDataAsset = serializedObject.FindProperty("skeletonDataAsset");
 		skeletonDataAsset = serializedObject.FindProperty("skeletonDataAsset");
 		animationName = serializedObject.FindProperty("_animationName");
 		animationName = serializedObject.FindProperty("_animationName");
 		loop = serializedObject.FindProperty("loop");
 		loop = serializedObject.FindProperty("loop");
-		useAnimationName = serializedObject.FindProperty("useAnimationName");
 		initialSkinName = serializedObject.FindProperty("initialSkinName");
 		initialSkinName = serializedObject.FindProperty("initialSkinName");
 		timeScale = serializedObject.FindProperty("timeScale");
 		timeScale = serializedObject.FindProperty("timeScale");
 		normals = serializedObject.FindProperty("calculateNormals");
 		normals = serializedObject.FindProperty("calculateNormals");
@@ -79,15 +78,14 @@ public class SkeletonAnimationInspector : Editor {
 			initialSkinName.stringValue = skins[skinIndex];
 			initialSkinName.stringValue = skins[skinIndex];
 
 
 			// Animation name.
 			// Animation name.
-			String[] animations = new String[component.skeleton.Data.Animations.Count + 2];
-			animations[0] = "<No Change>";
-			animations[1] = "<None>";
-			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] = "<None>";
+			int animationIndex = 0;
+			for (int i = 0; i < animations.Length - 1; i++) {
 				String name = component.skeleton.Data.Animations[i].Name;
 				String name = component.skeleton.Data.Animations[i].Name;
-				animations[i + 2] = name;
+				animations[i + 1] = name;
 				if (name == animationName.stringValue)
 				if (name == animationName.stringValue)
-					animationIndex = i + 2;
+					animationIndex = i + 1;
 			}
 			}
 		
 		
 			EditorGUILayout.BeginHorizontal();
 			EditorGUILayout.BeginHorizontal();
@@ -97,16 +95,10 @@ public class SkeletonAnimationInspector : Editor {
 			EditorGUIUtility.LookLikeInspector();
 			EditorGUIUtility.LookLikeInspector();
 			EditorGUILayout.EndHorizontal();
 			EditorGUILayout.EndHorizontal();
 
 
-			if (animationIndex == 0) {
+			if (animationIndex == 0)
 				component.animationName = null;
 				component.animationName = null;
-				useAnimationName.boolValue = false;
-			} else if (animationIndex == 1) {
-				component.animationName = null;
-				useAnimationName.boolValue = true;
-			} else {
+			else
 				component.animationName = animations[animationIndex];
 				component.animationName = animations[animationIndex];
-				useAnimationName.boolValue = true;
-			}
 		}
 		}
 
 
 		// Animation loop.
 		// Animation loop.

+ 0 - 2
spine-unity/Assets/Spine/SkeletonAnimation.cs

@@ -40,7 +40,6 @@ using Spine;
 /** Extends SkeletonComponent to apply an animation. */
 /** Extends SkeletonComponent to apply an animation. */
 [ExecuteInEditMode, RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
 [ExecuteInEditMode, RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
 public class SkeletonAnimation : SkeletonComponent {
 public class SkeletonAnimation : SkeletonComponent {
-	public bool useAnimationName;
 	public bool loop;
 	public bool loop;
 	public Spine.AnimationState state;
 	public Spine.AnimationState state;
 
 
@@ -51,7 +50,6 @@ public class SkeletonAnimation : SkeletonComponent {
 			return entry == null ? null : entry.Animation.Name;
 			return entry == null ? null : entry.Animation.Name;
 		}
 		}
 		set {
 		set {
-			if (!useAnimationName) return;
 			if (_animationName == value) return;
 			if (_animationName == value) return;
 			_animationName = value;
 			_animationName = value;
 			if (value == null || value.Length == 0)
 			if (value == null || value.Length == 0)

+ 1 - 3
spine-unity/Assets/examples/spineboy/Spineboy.cs

@@ -40,9 +40,7 @@ public class Spineboy : MonoBehaviour {
 	SkeletonAnimation skeletonAnimation;
 	SkeletonAnimation skeletonAnimation;
 
 
 	public void Start () {
 	public void Start () {
-		skeletonAnimation = GetComponent<SkeletonAnimation>();
-		skeletonAnimation.state.SetAnimation(0, "walk", true);
-		
+		skeletonAnimation = GetComponent<SkeletonAnimation>();	
 		skeletonAnimation.state.Event += new EventHandler<EventTriggeredArgs>(Event);
 		skeletonAnimation.state.Event += new EventHandler<EventTriggeredArgs>(Event);
 	}
 	}
 	
 	

BIN
spine-unity/Assets/examples/spineboy/spineboy.unity