From 84ae36f90f578fd7c15833721e7445ad72adf565 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Wed, 17 Oct 2018 22:51:51 +0200 Subject: [PATCH] [libgdx] Improved fix for timeScale not returning to the setup pose. We should complete a mix frozen by timeScale 0 only when `to` has been mixed out. However, it would probably be better for TrackEntry#timeScale to not affect the mix time at all. #1194 --- .../com/esotericsoftware/spine/AnimationState.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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 cada4633f..3166ce1e7 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java @@ -172,6 +172,12 @@ public class AnimationState { // Require mixTime > 0 to ensure the mixing from entry was applied at least once. if (to.mixTime > 0 && to.mixTime >= to.mixDuration) { + if (from.timeScale == 0) { + // from has 0 timeScale and has been mixed out, remove its mix and apply it one more time to return to the setup pose. + from.timeScale = 1; + from.mixTime = 0; + from.mixDuration = 0; + } // 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,13 +188,6 @@ 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;