mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +08:00
Go back to clearing the entry after the "end" listeners.
Changing the AnimationState state from an "end" listener is problematic even when the entry is cleared before the listener, so better to make the track that is ending available to the listener.
This commit is contained in:
parent
f0e4b5e9b8
commit
df70264a5b
@ -128,10 +128,10 @@ public class AnimationState {
|
|||||||
var current:TrackEntry = _tracks[trackIndex];
|
var current:TrackEntry = _tracks[trackIndex];
|
||||||
if (!current) return;
|
if (!current) return;
|
||||||
|
|
||||||
_tracks[trackIndex] = null;
|
|
||||||
|
|
||||||
if (current.onEnd != null) current.onEnd(trackIndex);
|
if (current.onEnd != null) current.onEnd(trackIndex);
|
||||||
onEnd.invoke(trackIndex);
|
onEnd.invoke(trackIndex);
|
||||||
|
|
||||||
|
_tracks[trackIndex] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function expandToIndex (index:int) : TrackEntry {
|
private function expandToIndex (index:int) : TrackEntry {
|
||||||
|
|||||||
@ -181,11 +181,11 @@ void spAnimationState_clearTrack (spAnimationState* self, int trackIndex) {
|
|||||||
current = self->tracks[trackIndex];
|
current = self->tracks[trackIndex];
|
||||||
if (!current) return;
|
if (!current) return;
|
||||||
|
|
||||||
self->tracks[trackIndex] = 0;
|
|
||||||
|
|
||||||
if (current->listener) current->listener(self, trackIndex, ANIMATION_END, 0, 0);
|
if (current->listener) current->listener(self, trackIndex, ANIMATION_END, 0, 0);
|
||||||
if (self->listener) self->listener(self, trackIndex, ANIMATION_END, 0, 0);
|
if (self->listener) self->listener(self, trackIndex, ANIMATION_END, 0, 0);
|
||||||
|
|
||||||
|
self->tracks[trackIndex] = 0;
|
||||||
|
|
||||||
if (current->previous) _spTrackEntry_dispose(current->previous);
|
if (current->previous) _spTrackEntry_dispose(current->previous);
|
||||||
_spTrackEntry_disposeAll(current);
|
_spTrackEntry_disposeAll(current);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -141,10 +141,10 @@ namespace Spine {
|
|||||||
TrackEntry current = tracks[trackIndex];
|
TrackEntry current = tracks[trackIndex];
|
||||||
if (current == null) return;
|
if (current == null) return;
|
||||||
|
|
||||||
tracks[trackIndex] = null;
|
|
||||||
|
|
||||||
current.OnEnd(this, trackIndex);
|
current.OnEnd(this, trackIndex);
|
||||||
if (End != null) End(this, trackIndex);
|
if (End != null) End(this, trackIndex);
|
||||||
|
|
||||||
|
tracks[trackIndex] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TrackEntry ExpandToIndex (int index) {
|
private TrackEntry ExpandToIndex (int index) {
|
||||||
|
|||||||
@ -1041,10 +1041,10 @@ spine.AnimationState.prototype = {
|
|||||||
var current = this.tracks[trackIndex];
|
var current = this.tracks[trackIndex];
|
||||||
if (!current) return;
|
if (!current) return;
|
||||||
|
|
||||||
this.tracks[trackIndex] = null;
|
|
||||||
|
|
||||||
if (current.onEnd != null) current.onEnd(trackIndex);
|
if (current.onEnd != null) current.onEnd(trackIndex);
|
||||||
if (this.onEnd != null) this.onEnd(trackIndex);
|
if (this.onEnd != null) this.onEnd(trackIndex);
|
||||||
|
|
||||||
|
this.tracks[trackIndex] = null;
|
||||||
},
|
},
|
||||||
_expandToIndex: function (index) {
|
_expandToIndex: function (index) {
|
||||||
if (index < this.tracks.length) return this.tracks[index];
|
if (index < this.tracks.length) return this.tracks[index];
|
||||||
|
|||||||
@ -140,12 +140,12 @@ public class AnimationState {
|
|||||||
TrackEntry current = tracks.get(trackIndex);
|
TrackEntry current = tracks.get(trackIndex);
|
||||||
if (current == null) return;
|
if (current == null) return;
|
||||||
|
|
||||||
tracks.set(trackIndex, null);
|
|
||||||
|
|
||||||
if (current.listener != null) current.listener.end(trackIndex);
|
if (current.listener != null) current.listener.end(trackIndex);
|
||||||
for (int i = 0, n = listeners.size; i < n; i++)
|
for (int i = 0, n = listeners.size; i < n; i++)
|
||||||
listeners.get(i).end(trackIndex);
|
listeners.get(i).end(trackIndex);
|
||||||
|
|
||||||
|
tracks.set(trackIndex, null);
|
||||||
|
|
||||||
freeAll(current);
|
freeAll(current);
|
||||||
if (current.previous != null) trackEntryPool.free(current.previous);
|
if (current.previous != null) trackEntryPool.free(current.previous);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -161,13 +161,13 @@ function AnimationState.new (data)
|
|||||||
local current = self.tracks[trackIndex]
|
local current = self.tracks[trackIndex]
|
||||||
if not current then return end
|
if not current then return end
|
||||||
|
|
||||||
|
if current.onEnd then current.onEnd(trackIndex) end
|
||||||
|
if self.onEnd then self.onEnd(trackIndex) end
|
||||||
|
|
||||||
self.tracks[trackIndex] = nil
|
self.tracks[trackIndex] = nil
|
||||||
if trackIndex == self.trackCount - 1 then
|
if trackIndex == self.trackCount - 1 then
|
||||||
self.trackCount = self.trackCount - 1
|
self.trackCount = self.trackCount - 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if current.onEnd then current.onEnd(trackIndex) end
|
|
||||||
if self.onEnd then self.onEnd(trackIndex) end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function self:setAnimationByName (trackIndex, animationName, loop)
|
function self:setAnimationByName (trackIndex, animationName, loop)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user