spine的问题之二、、、

        之前说到spine在end回调里面调用setAnimation会蹦,那个是现象之一。又发现一个更具体的原因。


        setAnimation之后,会调用到getCurrent函数:

spTrackEntry* spAnimationState_setAnimation (spAnimationState* self, int trackIndex, spAnimation* animation, int/*bool*/loop, int/*bool*/ inCallback) {
	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);

	spTrackEntry* entry;
	spTrackEntry* current = _spAnimationState_expandToIndex(self, trackIndex);
	if (current) _spAnimationState_disposeAllEntries(self, current->next);

	entry = internal->createTrackEntry(self);
    entry->next = NULL;
	entry->animation = animation;
	entry->loop = loop;
	entry->endTime = animation->duration;
	_spAnimationState_setCurrent(self, trackIndex, entry,inCallback);    //就是这里!!!
	return entry;
}
        getCurrent在里面,会调end回调:
void _spAnimationState_setCurrent (spAnimationState* self, int index, spTrackEntry* entry, int/*bool*/ inCallback) {
	_spAnimationState* internal = SUB_CAST(_spAnimationState, self);

	spTrackEntry* current = _spAnimationState_expandToIndex(self, index);
	if (current) {
		spTrackEntry* previous = current->previous;
		current->previous = 0;

	if (current->listener)
            current->listener(self, index, SP_ANIMATION_END, 0, 0);
	if (self->listener)
                self->listener(self, index, SP_ANIMATION_END, 0, 0);
         。。。   。。。
}
        然后,后面的事情,就是这2个函数一直死循环的调用。。。


        我尝试改了一下这个地方,发现通过简单的办法不能解决。。。还是在回调里面用scheduler延时大法设置算了。。。。


        PS:之前说的那个删除野指针的问题依然还存在,目前就发现这2个问题,虽然都还没从源头上解决。。。。

你可能感兴趣的:(cocos2d-x)