Pārlūkot izejas kodu

[Unity] Autoreset will be a separate script until we clear up mixing stuff. Sorry for the confusion!

pharan 9 gadi atpakaļ
vecāks
revīzija
8c7038c0b9

+ 0 - 3
spine-unity/Assets/spine-unity/Editor/SkeletonAnimationInspector.cs

@@ -45,8 +45,6 @@ public class SkeletonAnimationInspector : SkeletonRendererInspector {
 		animationName = serializedObject.FindProperty("_animationName");
 		loop = serializedObject.FindProperty("loop");
 		timeScale = serializedObject.FindProperty("timeScale");
-		autoReset = serializedObject.FindProperty("autoReset");
-		autoResetLabel = new GUIContent("Generic Auto-reset");
 
 		if (PrefabUtility.GetPrefabType(this.target) == PrefabType.Prefab)
 			m_isPrefab = true;
@@ -97,7 +95,6 @@ public class SkeletonAnimationInspector : SkeletonRendererInspector {
 
 		EditorGUILayout.PropertyField(loop);
 		EditorGUILayout.PropertyField(timeScale);
-		EditorGUILayout.PropertyField(autoReset, autoResetLabel);
 		component.timeScale = Math.Max(component.timeScale, 0);
 
 		EditorGUILayout.Space();

+ 11 - 7
spine-unity/Assets/spine-unity/SkeletonAnimation.cs

@@ -111,9 +111,9 @@ public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation {
 	#endif
 	public float timeScale = 1;
 
-	#if UNITY_5
+	#region AutoReset
+	/**
 	[Tooltip("Setting this to true makes the SkeletonAnimation behave similar to Spine editor. New animations will not inherit the pose from a previous animation. If you need to intermittently and programmatically pose your skeleton, leave this false.")]
-	#endif
 	[SerializeField]
 	protected bool autoReset = false;
 
@@ -132,6 +132,13 @@ public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation {
 		}
 	}
 
+	protected virtual void HandleNewAnimationAutoreset (Spine.AnimationState state, int trackIndex) {
+		if (!autoReset) return;
+		if (skeleton != null) skeleton.SetToSetupPose();
+	}
+	*/
+	#endregion
+
 	public override void Reset () {
 		base.Reset();
 		if (!valid)
@@ -139,20 +146,17 @@ public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation {
 
 		state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData());
 
+		/*
 		if (autoReset) {
 			state.Start += HandleNewAnimationAutoreset;
 		}
+		*/
 
 		if (_animationName != null && _animationName.Length > 0) {
 			state.SetAnimation(0, _animationName, loop);
 			Update(0);
 		}
 	}
-		
-	protected virtual void HandleNewAnimationAutoreset (Spine.AnimationState state, int trackIndex) {
-		if (!autoReset) return;
-		if (skeleton != null) skeleton.SetToSetupPose();
-	}
 
 	public virtual void Update () {
 		Update(Time.deltaTime);