From abdbb10480e4906d659bb11c18d1dc65e0af1e88 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Mon, 15 Oct 2018 16:24:48 +0200 Subject: [PATCH] [libgdx] Fixed 0 timeScale not returning to the setup pose. closes #1194 --- .../src/com/esotericsoftware/spine/AnimationState.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java index 233a2c0aa..7c826ac40 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java @@ -171,7 +171,7 @@ public class AnimationState { from.trackLast = from.nextTrackLast; // Require mixTime > 0 to ensure the mixing from entry was applied at least once. - if (to.mixTime > 0 && (to.mixTime >= to.mixDuration || to.timeScale == 0)) { + if (to.mixTime > 0 && to.mixTime >= to.mixDuration) { // Require totalAlpha == 0 to ensure mixing is complete, unless mixDuration == 0 (the transition is a single frame). if (from.totalAlpha == 0 || to.mixDuration == 0) { to.mixingFrom = from.mixingFrom; @@ -182,6 +182,13 @@ public class AnimationState { return finished; } + // If to has 0 timeScale and is not the first entry, remove the mix and apply it one more time to return to the setup pose. + if (to.timeScale == 0 && to.mixingTo != null) { + to.timeScale = 1; + to.mixTime = 0; + to.mixDuration = 0; + } + from.trackTime += delta * from.timeScale; to.mixTime += delta * to.timeScale; return false;