- Modifié
parse json error
hi:
I am a chinese.so my Engish is very poor,parden me!
Today I update my spine runtime(cocos2dx) to latest version.But I have promble to Parse json(It's ok ,before my update).
The parsed Animation name is error(messy code).l log out it:
Names:: run
Names:: shifa
Names:: shifa_begin
Names:: shifa_end
Names:: skill_10_begin
Names:: skill_10_begin
Names:: skill_10_end
Names:: skill_11_begin
Names:: skill_11_begin
Names::
Names:: skill_12_begin
Names:: skill_12_end
Names:: skill_13_begin
Names:: skill_13_begin
Names:: (null)
Names:: skill_14_begin
Names::
Names::
Names:: skill_15_end
Names:: skill_16_
Names:: skill_16_begin
Names:: skill_16_end
Names:: (null)
Names:: (null)
Names:: skill_6_begin
Names:: skill_6_end
Names:: skill_7_
Names:: skill_7_begin
Names:: skill_7_end
Names:: skill_8_
Names:: skill_8_begin
My log Code:
spAnimation* spSkeletonData_findAnimation (const spSkeletonData* self, const char* animationName) {
printf("animationName:::%s \n", animationName);
int i;
for (i = 0; i < self->animationCount; ++i)
{
printf("Names:: %s \n", self->animations[i]->name);
}
for (i = 0; i < self->animationCount; ++i)
{
printf("CurrentNames:: %s \n", self->animations[i]->name);
if (strcmp(self->animations[i]->name, animationName) == 0) return self->animations[i];
}
return 0;
}
I am not sure is my json file promble or the parse promble? So please Help me!! I send you my files.
Look forward to your reply!!Thank you!!
Can someone parse the files for me?? thank you!
Can someone parse the files for me?? thank you!
Sorry for the delay! I'm not sure exactly what the problem is. I don't see "skill_16_end" and other names in the JSON. Trying to parse the skeleton with the SkeletonTest tool I see that animations use an event called "attack_event", but this event is never defined in the skeleton data section. Was this JSON exported from Spine? If so, can you post or email the .spine file? contact@esotericsoftware.com
Hi Nate:
Thank you for your reply!
I post My spine and resource.It works Well In the old runtimes.
About the "attack_event",we add the events to the XX_body.spine at beginning,but later we move it to XX_effect.spine.So in the XX_body.spine project,we don't use the event.
Sorry for the delay. I see the project file has event keys but the skeleton has no events. I'm unable to reproduce this by keying an event and then deleting the event, so I assume the bug has been fixed in Spine since you deleted your events. I've added code that cleans up orphaned events when the project is loaded. Your project now exports valid JSON (1.8.16).