mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d19a4b22db
@ -46,7 +46,7 @@ void _spAnimationState_updateMixingFrom (spAnimationState* self, spTrackEntry* e
|
||||
float _spAnimationState_applyMixingFrom (spAnimationState* self, spTrackEntry* entry, spSkeleton* skeleton);
|
||||
void _spAnimationState_applyRotateTimeline (spAnimationState* self, spTimeline* timeline, spSkeleton* skeleton, float time, float alpha, int /*boolean*/ setupPose, float* timelinesRotation, int i, int /*boolean*/ firstFrame);
|
||||
void _spAnimationState_queueEvents (spAnimationState* self, spTrackEntry* entry, float animationTime);
|
||||
void _spAnimationState_setCurrent (spAnimationState* self, int index, spTrackEntry* current);
|
||||
void _spAnimationState_setCurrent (spAnimationState* self, int index, spTrackEntry* current, int /*boolean*/ interrupt);
|
||||
spTrackEntry* _spAnimationState_expandToIndex (spAnimationState* self, int index);
|
||||
spTrackEntry* _spAnimationState_trackEntry (spAnimationState* self, int trackIndex, spAnimation* animation, int /*boolean*/ loop, spTrackEntry* last);
|
||||
void _spAnimationState_disposeNext (spAnimationState* self, spTrackEntry* entry);
|
||||
@ -260,7 +260,7 @@ void spAnimationState_update (spAnimationState* self, float delta) {
|
||||
next->delay = 0;
|
||||
next->trackTime = nextTime + delta * next->timeScale;
|
||||
current->trackTime += currentDelta;
|
||||
_spAnimationState_setCurrent(self, i, next);
|
||||
_spAnimationState_setCurrent(self, i, next, 1);
|
||||
while (next->mixingFrom) {
|
||||
next->mixTime += currentDelta;
|
||||
next = next->mixingFrom;
|
||||
@ -571,13 +571,13 @@ void spAnimationState_clearTrack (spAnimationState* self, int trackIndex) {
|
||||
_spEventQueue_drain(internal->queue);
|
||||
}
|
||||
|
||||
void _spAnimationState_setCurrent (spAnimationState* self, int index, spTrackEntry* current) {
|
||||
void _spAnimationState_setCurrent (spAnimationState* self, int index, spTrackEntry* current, int /*boolean*/ interrupt) {
|
||||
_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
|
||||
spTrackEntry* from = _spAnimationState_expandToIndex(self, index);
|
||||
self->tracks[index] = current;
|
||||
|
||||
if (from) {
|
||||
_spEventQueue_interrupt(internal->queue, from);
|
||||
if (interrupt) _spEventQueue_interrupt(internal->queue, from);
|
||||
current->mixingFrom = from;
|
||||
current->mixTime = 0;
|
||||
|
||||
@ -598,6 +598,7 @@ spTrackEntry* spAnimationState_setAnimationByName (spAnimationState* self, int t
|
||||
spTrackEntry* spAnimationState_setAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop) {
|
||||
spTrackEntry* entry;
|
||||
_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
|
||||
int interrupt = 1;
|
||||
spTrackEntry* current = _spAnimationState_expandToIndex(self, trackIndex);
|
||||
if (current) {
|
||||
if (current->nextTrackLast == -1) {
|
||||
@ -607,11 +608,12 @@ spTrackEntry* spAnimationState_setAnimation (spAnimationState* self, int trackIn
|
||||
_spEventQueue_end(internal->queue, current);
|
||||
_spAnimationState_disposeNext(self, current);
|
||||
current = current->mixingFrom;
|
||||
interrupt = 0;
|
||||
} else
|
||||
_spAnimationState_disposeNext(self, current);
|
||||
}
|
||||
entry = _spAnimationState_trackEntry(self, trackIndex, animation, loop, current);
|
||||
_spAnimationState_setCurrent(self, trackIndex, entry);
|
||||
_spAnimationState_setCurrent(self, trackIndex, entry, interrupt);
|
||||
_spEventQueue_drain(internal->queue);
|
||||
return entry;
|
||||
}
|
||||
@ -637,7 +639,7 @@ spTrackEntry* spAnimationState_addAnimation (spAnimationState* self, int trackIn
|
||||
entry = _spAnimationState_trackEntry(self, trackIndex, animation, loop, last);
|
||||
|
||||
if (!last) {
|
||||
_spAnimationState_setCurrent(self, trackIndex, entry);
|
||||
_spAnimationState_setCurrent(self, trackIndex, entry, 1);
|
||||
_spEventQueue_drain(internal->queue);
|
||||
} else {
|
||||
last->next = entry;
|
||||
|
||||
@ -95,7 +95,7 @@ namespace Spine {
|
||||
next.delay = 0;
|
||||
next.trackTime = nextTime + (delta * next.timeScale);
|
||||
current.trackTime += currentDelta;
|
||||
SetCurrent(i, next);
|
||||
SetCurrent(i, next, true);
|
||||
while (next.mixingFrom != null) {
|
||||
next.mixTime += currentDelta;
|
||||
next = next.mixingFrom;
|
||||
@ -378,12 +378,12 @@ namespace Spine {
|
||||
queue.Drain();
|
||||
}
|
||||
|
||||
private void SetCurrent (int index, TrackEntry current) {
|
||||
private void SetCurrent (int index, TrackEntry current, bool interrupt) {
|
||||
TrackEntry from = ExpandToIndex(index);
|
||||
tracks.Items[index] = current;
|
||||
|
||||
if (from != null) {
|
||||
queue.Interrupt(from);
|
||||
if (interrupt) queue.Interrupt(from);
|
||||
current.mixingFrom = from;
|
||||
current.mixTime = 0;
|
||||
|
||||
@ -413,6 +413,7 @@ namespace Spine {
|
||||
/// after <see cref="AnimationState.Dispose"/>.</returns>
|
||||
public TrackEntry SetAnimation (int trackIndex, Animation animation, bool loop) {
|
||||
if (animation == null) throw new ArgumentNullException("animation", "animation cannot be null.");
|
||||
bool interrupt = true;
|
||||
TrackEntry current = ExpandToIndex(trackIndex);
|
||||
if (current != null) {
|
||||
if (current.nextTrackLast == -1) {
|
||||
@ -422,12 +423,13 @@ namespace Spine {
|
||||
queue.End(current);
|
||||
DisposeNext(current);
|
||||
current = current.mixingFrom;
|
||||
interrupt = false;
|
||||
} else {
|
||||
DisposeNext(current);
|
||||
}
|
||||
}
|
||||
TrackEntry entry = NewTrackEntry(trackIndex, animation, loop, current);
|
||||
SetCurrent(trackIndex, entry);
|
||||
SetCurrent(trackIndex, entry, interrupt);
|
||||
queue.Drain();
|
||||
return entry;
|
||||
}
|
||||
@ -460,7 +462,7 @@ namespace Spine {
|
||||
TrackEntry entry = NewTrackEntry(trackIndex, animation, loop, last);
|
||||
|
||||
if (last == null) {
|
||||
SetCurrent(trackIndex, entry);
|
||||
SetCurrent(trackIndex, entry, true);
|
||||
queue.Drain();
|
||||
} else {
|
||||
last.next = entry;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user