Skip to content

Commit

Permalink
[cpp] Ported 0 timeScale fix, see #1194.
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogic committed Oct 15, 2018
1 parent 2c73175 commit e11e0d4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spine-cpp/spine-cpp/src/spine/AnimationState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ bool AnimationState::updateMixingFrom(TrackEntry *to, float delta) {
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;
Expand All @@ -728,6 +728,12 @@ bool AnimationState::updateMixingFrom(TrackEntry *to, float delta) {
return finished;
}

if (to->_timeScale == 0 && to->_mixingTo) {
to->_timeScale = 1;
to->_mixTime = 0;
to->_mixDuration = 0;
}

from->_trackTime += delta * from->_timeScale;
to->_mixTime += delta * to->_timeScale;

Expand Down

0 comments on commit e11e0d4

Please sign in to comment.