Explorar el Código

[unity] Update Timeline code.

pharan hace 7 años
padre
commit
13cb394353

+ 3 - 2
spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Timeline/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs

@@ -40,6 +40,7 @@ namespace Spine.Unity.Playables {
 	public class SpineAnimationStateMixerBehaviour : PlayableBehaviour {
 
 		float[] lastInputWeights;
+		public int trackIndex;
 
 		// NOTE: This function is called at runtime and edit time. Keep that in mind when setting the values of properties.
 		public override void ProcessFrame (Playable playable, FrameData info, object playerData) {
@@ -80,10 +81,10 @@ namespace Spine.Unity.Playables {
 
 					if (clipData.animationReference == null) {
 						float mixDuration = clipData.customDuration ? clipData.mixDuration : state.Data.DefaultMix;
-						state.SetEmptyAnimation(0, mixDuration);
+						state.SetEmptyAnimation(trackIndex, mixDuration);
 					} else {
 						if (clipData.animationReference.Animation != null) {
-							Spine.TrackEntry trackEntry = state.SetAnimation(0, clipData.animationReference.Animation, clipData.loop);
+							Spine.TrackEntry trackEntry = state.SetAnimation(trackIndex, clipData.animationReference.Animation, clipData.loop);
 
 							//trackEntry.TrackTime = (float)inputPlayable.GetTime(); // More accurate time-start?
 							trackEntry.EventThreshold = clipData.eventThreshold;

+ 6 - 1
spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Timeline/SpineAnimationState/SpineAnimationStateTrack.cs

@@ -38,8 +38,13 @@ namespace Spine.Unity.Playables {
 	[TrackClipType(typeof(SpineAnimationStateClip))]
 	[TrackBindingType(typeof(SkeletonAnimation))]
 	public class SpineAnimationStateTrack : TrackAsset {
+		public int trackIndex = 0;
+
 		public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) {
-			return ScriptPlayable<SpineAnimationStateMixerBehaviour>.Create (graph, inputCount);
+			var scriptPlayable = ScriptPlayable<SpineAnimationStateMixerBehaviour>.Create(graph, inputCount);
+			var mixerBehaviour = scriptPlayable.GetBehaviour();
+			mixerBehaviour.trackIndex = this.trackIndex;
+			return scriptPlayable;
 		}
 	}
 }

+ 8 - 8
spine-unity/Assets/Spine/Runtime/spine-unity/Modules/Timeline/SpineSkeletonFlip/SpineSkeletonFlipMixerBehaviour.cs

@@ -52,8 +52,8 @@ namespace Spine.Unity.Playables {
 			var skeleton = playableHandle.Skeleton;
 
 			if (!m_FirstFrameHappened) {
-				defaultFlipX = skeleton.flipX;
-				defaultFlipY = skeleton.flipY;
+				defaultFlipX = skeleton.FlipX;
+				defaultFlipY = skeleton.FlipY;
 				m_FirstFrameHappened = true;
 			}
 
@@ -71,8 +71,8 @@ namespace Spine.Unity.Playables {
 				totalWeight += inputWeight;
 
 				if (inputWeight > greatestWeight) {
-					skeleton.flipX = input.flipX;
-					skeleton.flipY = input.flipY;
+					skeleton.FlipX = input.flipX;
+					skeleton.FlipY = input.flipY;
 					greatestWeight = inputWeight;
 				}
 
@@ -81,8 +81,8 @@ namespace Spine.Unity.Playables {
 			}
 
 			if (currentInputs != 1 && 1f - totalWeight > greatestWeight) {
-				skeleton.flipX = defaultFlipX;
-				skeleton.flipY = defaultFlipY;
+				skeleton.FlipX = defaultFlipX;
+				skeleton.FlipY = defaultFlipY;
 			}
 		}
 
@@ -93,8 +93,8 @@ namespace Spine.Unity.Playables {
 				return;
 
 			var skeleton = playableHandle.Skeleton;
-			skeleton.flipX = defaultFlipX;
-			skeleton.flipY = defaultFlipY;
+			skeleton.FlipX = defaultFlipX;
+			skeleton.FlipY = defaultFlipY;
 		}
 	}