Skip to content

Commit

Permalink
[c][cpp] Ported new fix for 0 timeScale not returning to setup pose. …
Browse files Browse the repository at this point in the history
…See #1194.
  • Loading branch information
badlogic committed Oct 30, 2018
1 parent a064d76 commit 11e24df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
12 changes: 3 additions & 9 deletions spine-c/spine-c/src/spine/AnimationState.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,11 @@ void spAnimationState_update (spAnimationState* self, float delta) {
float nextTime = current->trackLast - next->delay;
if (nextTime >= 0) {
next->delay = 0;
next->trackTime = nextTime + delta * next->timeScale;
next->trackTime = (nextTime / current->timeScale + delta) * next->timeScale;
current->trackTime += currentDelta;
_spAnimationState_setCurrent(self, i, next, 1);
while (next->mixingFrom) {
next->mixTime += currentDelta;
next->mixTime += delta;
next = next->mixingFrom;
}
continue;
Expand Down Expand Up @@ -338,14 +338,8 @@ int /*boolean*/ _spAnimationState_updateMixingFrom (spAnimationState* self, spTr
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;
to->mixTime += delta;
return 0;
}

Expand Down
12 changes: 3 additions & 9 deletions spine-cpp/spine-cpp/src/spine/AnimationState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,11 @@ void AnimationState::update(float delta) {
float nextTime = current._trackLast - next->_delay;
if (nextTime >= 0) {
next->_delay = 0;
next->_trackTime = nextTime + (delta * next->_timeScale);
next->_trackTime = (nextTime / current._timeScale + delta) * next->_timeScale;
current._trackTime += currentDelta;
setCurrent(i, next, true);
while (next->_mixingFrom != NULL) {
next->_mixTime += currentDelta;
next->_mixTime += delta;
next = next->_mixingFrom;
}
continue;
Expand Down Expand Up @@ -728,14 +728,8 @@ 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;
to->_mixTime += delta;

return false;
}
Expand Down

0 comments on commit 11e24df

Please sign in to comment.