mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 17:56:04 +08:00
parent
725fd49c77
commit
5e2e5ed8d9
@ -78,9 +78,12 @@ spAnimationState* spAnimationState_create (spAnimationStateData* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void spAnimationState_dispose (spAnimationState* self) {
|
void spAnimationState_dispose (spAnimationState* self) {
|
||||||
|
_spAnimationState* internal = SUB_CAST(_spAnimationState, self);
|
||||||
|
FREE(internal->events);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < self->trackCount; i++)
|
for (i = 0; i < self->trackCount; i++)
|
||||||
_spTrackEntry_disposeAll(self->tracks[i]);
|
_spTrackEntry_disposeAll(self->tracks[i]);
|
||||||
|
FREE(self->tracks);
|
||||||
FREE(self);
|
FREE(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,6 +192,7 @@ spTrackEntry* _spAnimationState_expandToIndex (spAnimationState* self, int index
|
|||||||
if (index < self->trackCount) return self->tracks[index];
|
if (index < self->trackCount) return self->tracks[index];
|
||||||
newTracks = CALLOC(spTrackEntry*, index + 1);
|
newTracks = CALLOC(spTrackEntry*, index + 1);
|
||||||
memcpy(newTracks, self->tracks, self->trackCount * sizeof(spTrackEntry*));
|
memcpy(newTracks, self->tracks, self->trackCount * sizeof(spTrackEntry*));
|
||||||
|
FREE(self->tracks);
|
||||||
self->tracks = newTracks;
|
self->tracks = newTracks;
|
||||||
self->trackCount = index + 1;
|
self->trackCount = index + 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -57,6 +57,10 @@ void spSkeletonData_dispose (spSkeletonData* self) {
|
|||||||
spAnimation_dispose(self->animations[i]);
|
spAnimation_dispose(self->animations[i]);
|
||||||
FREE(self->animations);
|
FREE(self->animations);
|
||||||
|
|
||||||
|
for (i = 0; i < self->eventCount; ++i)
|
||||||
|
spEventData_dispose(self->events[i]);
|
||||||
|
FREE(self->events);
|
||||||
|
|
||||||
FREE(self);
|
FREE(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -59,6 +59,7 @@ static void callback (AnimationState* state, int trackIndex, EventType type, Eve
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void) initialize {
|
- (void) initialize {
|
||||||
|
_ownsAnimationStateData = true;
|
||||||
_state = AnimationState_create(AnimationStateData_create(_skeleton->data));
|
_state = AnimationState_create(AnimationStateData_create(_skeleton->data));
|
||||||
_state->context = self;
|
_state->context = self;
|
||||||
_state->listener = callback;
|
_state->listener = callback;
|
||||||
@ -113,7 +114,7 @@ static void callback (AnimationState* state, int trackIndex, EventType type, Eve
|
|||||||
if (_ownsAnimationStateData) AnimationStateData_dispose(_state->data);
|
if (_ownsAnimationStateData) AnimationStateData_dispose(_state->data);
|
||||||
AnimationState_dispose(_state);
|
AnimationState_dispose(_state);
|
||||||
|
|
||||||
_ownsAnimationStateData = true;
|
_ownsAnimationStateData = false;
|
||||||
_state = AnimationState_create(stateData);
|
_state = AnimationState_create(stateData);
|
||||||
_state->context = self;
|
_state->context = self;
|
||||||
_state->listener = callback;
|
_state->listener = callback;
|
||||||
|
|||||||
@ -68,6 +68,7 @@ void CCSkeletonAnimation::initialize () {
|
|||||||
listenerInstance = 0;
|
listenerInstance = 0;
|
||||||
listenerMethod = 0;
|
listenerMethod = 0;
|
||||||
|
|
||||||
|
ownsAnimationStateData = true;
|
||||||
state = spAnimationState_create(spAnimationStateData_create(skeleton->data));
|
state = spAnimationState_create(spAnimationStateData_create(skeleton->data));
|
||||||
state->context = this;
|
state->context = this;
|
||||||
state->listener = callback;
|
state->listener = callback;
|
||||||
@ -108,7 +109,7 @@ void CCSkeletonAnimation::setAnimationStateData (spAnimationStateData* stateData
|
|||||||
if (ownsAnimationStateData) spAnimationStateData_dispose(state->data);
|
if (ownsAnimationStateData) spAnimationStateData_dispose(state->data);
|
||||||
spAnimationState_dispose(state);
|
spAnimationState_dispose(state);
|
||||||
|
|
||||||
ownsAnimationStateData = true;
|
ownsAnimationStateData = false;
|
||||||
state = spAnimationState_create(stateData);
|
state = spAnimationState_create(stateData);
|
||||||
state->context = this;
|
state->context = this;
|
||||||
state->listener = callback;
|
state->listener = callback;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user