不知道Spine(2.1)的版本和cocos2dx(3.3RC0)的版本是否不匹配导致的,反正已修复
问题:部分Animation名字为null导致崩溃,仿写某游戏的时候,数据文件(json)有这个动画一直提示未找到,甚至崩溃,跟踪到了,SkeletonData.c,修改如下
原代码
spAnimation* spSkeletonData_findAnimation (const spSkeletonData* self, const char* animationName) {
int i;
for (i = 0; i < self->animationsCount; ++i)
{
if (strcmp(self->animations[i]->name, animationName) == 0)
{
return self->animations[i];
}
}
return 0;
}
修改后的代码
spAnimation* spSkeletonData_findAnimation (const spSkeletonData* self, const char* animationName) {
int i;
for (i = 0; i < self->animationsCount; ++i)
{
if (!self->animations[i]->name)continue;
if (strcmp(self->animations[i]->name, animationName) == 0)
{
return self->animations[i];
}
}
return 0;
}