[c] Fix for clearTracks, see #805

This commit is contained in:
badlogic 2016-12-15 13:32:44 +01:00
parent dc8f89fd65
commit fe33e912c6

View File

@ -534,12 +534,13 @@ void _spAnimationState_queueEvents (spAnimationState* self, spTrackEntry* entry,
void spAnimationState_clearTracks (spAnimationState* self) {
_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
int i, n;
int i, n, oldDrainDisabled;
oldDrainDisabled = internal->queue->drainDisabled;
internal->queue->drainDisabled = 1;
for (i = 0, n = self->tracksCount; i < n; i++)
spAnimationState_clearTrack(self, i);
self->tracksCount = 0;
internal->queue->drainDisabled = 0;
internal->queue->drainDisabled = oldDrainDisabled;
_spEventQueue_drain(internal->queue);
}
@ -674,15 +675,16 @@ spTrackEntry* spAnimationState_addEmptyAnimation(spAnimationState* self, int tra
}
void spAnimationState_setEmptyAnimations(spAnimationState* self, float mixDuration) {
int i, n;
int i, n, oldDrainDisabled;
spTrackEntry* current;
_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
oldDrainDisabled = internal->queue->drainDisabled;
internal->queue->drainDisabled = 1;
for (i = 0, n = self->tracksCount; i < n; i++) {
current = self->tracks[i];
if (current) spAnimationState_setEmptyAnimation(self, current->trackIndex, mixDuration);
}
internal->queue->drainDisabled = 0;
internal->queue->drainDisabled = oldDrainDisabled;
_spEventQueue_drain(internal->queue);
}