Hi.Nate.I got a problem when use your spine runtime with cocos2d-x, I need to stop animation by its name,
But I check the code of CCSkeletonAnimation and CCSkeleton:
void setAnimation (const char* name, bool loop, int stateIndex = 0);
void addAnimation (const char* name, bool loop, float delay = 0, int stateIndex = 0);
void clearAnimation (int stateIndex = 0);
clearAnimation just stop all animation in queue, then I want to implement one by my own, so I check the code
inside, I knew I just need find animation by its name, and clear it from the queue, here is my code:
void AnimationState_clearAnimationByName(AnimationState* self, const char* animationName)
{
Animation* animation = animationName ? SkeletonData_findAnimation(self->data->skeletonData, animationName) : 0;
if(NULL == animation)
return ;
_Internal* internal = SUB_CAST(_Internal, self);
_Entry* entry = internal->queue;
if(NULL == entry)
return ;
//if is first one in queue, clear it and return
if(entry->animation == animation)
{
internal->queue = entry->next;
return ;
}
while (entry)
{
_Entry* nextEntry = entry->next;
if(nextEntry->animation == animation)
{
_Entry* nnextEntry = nextEntry->next;
entry->next = nnextEntry;
FREE(entry);
break;
}
entry = nextEntry;
}
}
But I got null ptr in line (_Entry* entry = internal->queue😉, can you give some code guide how to find the playing animation in queue?
Very appreciated.