Эх сурвалжийг харах

[csharp] Port of commit f1e0f0f: Fixed animation not being mixed out in some cases. See #2786.

Harald Csaszar 6 сар өмнө
parent
commit
58f99b1c0c

+ 9 - 11
spine-csharp/src/AnimationState.cs

@@ -204,18 +204,16 @@ namespace Spine {
 			from.animationLast = from.nextAnimationLast;
 			from.animationLast = from.nextAnimationLast;
 			from.trackLast = from.nextTrackLast;
 			from.trackLast = from.nextTrackLast;
 
 
-			if (to.nextTrackLast != -1) { // The from entry was applied at least once.
-				bool discard = to.mixTime == 0 && from.mixTime == 0; // Discard the from entry when neither have advanced yet.
-				if (to.mixTime >= to.mixDuration || discard) {
-					// Require totalAlpha == 0 to ensure mixing is complete or the transition is a single frame or discarded.
-					if (from.totalAlpha == 0 || to.mixDuration == 0 || discard) {
-						to.mixingFrom = from.mixingFrom;
-						if (from.mixingFrom != null) from.mixingFrom.mixingTo = to;
-						to.interruptAlpha = from.interruptAlpha;
-						queue.End(from);
-					}
-					return finished;
+			// The from entry was applied at least once and the mix is complete.
+			if (to.nextTrackLast != -1 && to.mixTime >= to.mixDuration) {
+				// Mixing is complete for all entries before the from entry or the mix is instantaneous.
+				if (from.totalAlpha == 0 || to.mixDuration == 0) {
+					to.mixingFrom = from.mixingFrom;
+					if (from.mixingFrom != null) from.mixingFrom.mixingTo = to;
+					to.interruptAlpha = from.interruptAlpha;
+					queue.End(from);
 				}
 				}
+				return finished;
 			}
 			}
 
 
 			from.trackTime += delta * from.timeScale;
 			from.trackTime += delta * from.timeScale;

+ 1 - 1
spine-csharp/src/package.json

@@ -2,7 +2,7 @@
 	"name": "com.esotericsoftware.spine.spine-csharp",
 	"name": "com.esotericsoftware.spine.spine-csharp",
 	"displayName": "spine-csharp Runtime",
 	"displayName": "spine-csharp Runtime",
 	"description": "This plugin provides the spine-csharp core runtime.",
 	"description": "This plugin provides the spine-csharp core runtime.",
-	"version": "4.2.34",
+	"version": "4.2.35",
 	"unity": "2018.3",
 	"unity": "2018.3",
 	"author": {
 	"author": {
 		"name": "Esoteric Software",
 		"name": "Esoteric Software",