[c][cpp] Ported new fix for 0 timeScale not returning to setup pose. See #1194.

This commit is contained in:
badlogic 2018-10-30 16:56:10 +01:00
parent a064d76832
commit 11e24df981
2 changed files with 6 additions and 18 deletions

View File

@ -280,11 +280,11 @@ void spAnimationState_update (spAnimationState* self, float delta) {
float nextTime = current->trackLast - next->delay; float nextTime = current->trackLast - next->delay;
if (nextTime >= 0) { if (nextTime >= 0) {
next->delay = 0; next->delay = 0;
next->trackTime = nextTime + delta * next->timeScale; next->trackTime = (nextTime / current->timeScale + delta) * next->timeScale;
current->trackTime += currentDelta; current->trackTime += currentDelta;
_spAnimationState_setCurrent(self, i, next, 1); _spAnimationState_setCurrent(self, i, next, 1);
while (next->mixingFrom) { while (next->mixingFrom) {
next->mixTime += currentDelta; next->mixTime += delta;
next = next->mixingFrom; next = next->mixingFrom;
} }
continue; continue;
@ -338,14 +338,8 @@ int /*boolean*/ _spAnimationState_updateMixingFrom (spAnimationState* self, spTr
return finished; return finished;
} }
if (to->timeScale == 0 && to->mixingTo) {
to->timeScale = 1;
to->mixTime = 0;
to->mixDuration = 0;
}
from->trackTime += delta * from->timeScale; from->trackTime += delta * from->timeScale;
to->mixTime += delta * to->timeScale; to->mixTime += delta;
return 0; return 0;
} }

View File

@ -334,11 +334,11 @@ void AnimationState::update(float delta) {
float nextTime = current._trackLast - next->_delay; float nextTime = current._trackLast - next->_delay;
if (nextTime >= 0) { if (nextTime >= 0) {
next->_delay = 0; next->_delay = 0;
next->_trackTime = nextTime + (delta * next->_timeScale); next->_trackTime = (nextTime / current._timeScale + delta) * next->_timeScale;
current._trackTime += currentDelta; current._trackTime += currentDelta;
setCurrent(i, next, true); setCurrent(i, next, true);
while (next->_mixingFrom != NULL) { while (next->_mixingFrom != NULL) {
next->_mixTime += currentDelta; next->_mixTime += delta;
next = next->_mixingFrom; next = next->_mixingFrom;
} }
continue; continue;
@ -728,14 +728,8 @@ bool AnimationState::updateMixingFrom(TrackEntry *to, float delta) {
return finished; return finished;
} }
if (to->_timeScale == 0 && to->_mixingTo) {
to->_timeScale = 1;
to->_mixTime = 0;
to->_mixDuration = 0;
}
from->_trackTime += delta * from->_timeScale; from->_trackTime += delta * from->_timeScale;
to->_mixTime += delta * to->_timeScale; to->_mixTime += delta;
return false; return false;
} }