mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 18:26:12 +08:00
Fixed parsing animations with no bone timelines.
This commit is contained in:
parent
4ea3a8a632
commit
b083ce8816
@ -97,7 +97,7 @@ static void readCurve (CurveTimeline* timeline, int frameIndex, Json* frame) {
|
|||||||
|
|
||||||
static Animation* _SkeletonJson_readAnimation (SkeletonJson* self, Json* root, SkeletonData *skeletonData) {
|
static Animation* _SkeletonJson_readAnimation (SkeletonJson* self, Json* root, SkeletonData *skeletonData) {
|
||||||
Json* bones = Json_getItem(root, "bones");
|
Json* bones = Json_getItem(root, "bones");
|
||||||
int boneCount = Json_getSize(bones);
|
int boneCount = bones ? Json_getSize(bones) : 0;
|
||||||
|
|
||||||
Json* slots = Json_getItem(root, "slots");
|
Json* slots = Json_getItem(root, "slots");
|
||||||
int slotCount = slots ? Json_getSize(slots) : 0;
|
int slotCount = slots ? Json_getSize(slots) : 0;
|
||||||
@ -167,7 +167,6 @@ static Animation* _SkeletonJson_readAnimation (SkeletonJson* self, Json* root, S
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slots) {
|
|
||||||
for (i = 0; i < slotCount; ++i) {
|
for (i = 0; i < slotCount; ++i) {
|
||||||
Json* slotMap = Json_getItemAt(slots, i);
|
Json* slotMap = Json_getItemAt(slots, i);
|
||||||
const char* slotName = slotMap->name;
|
const char* slotName = slotMap->name;
|
||||||
@ -191,8 +190,8 @@ static Animation* _SkeletonJson_readAnimation (SkeletonJson* self, Json* root, S
|
|||||||
for (iii = 0; iii < frameCount; ++iii) {
|
for (iii = 0; iii < frameCount; ++iii) {
|
||||||
Json* frame = Json_getItemAt(timelineArray, iii);
|
Json* frame = Json_getItemAt(timelineArray, iii);
|
||||||
const char* s = Json_getString(frame, "color", 0);
|
const char* s = Json_getString(frame, "color", 0);
|
||||||
ColorTimeline_setFrame(timeline, iii, Json_getFloat(frame, "time", 0), toColor(s, 0), toColor(s, 1),
|
ColorTimeline_setFrame(timeline, iii, Json_getFloat(frame, "time", 0), toColor(s, 0), toColor(s, 1), toColor(s, 2),
|
||||||
toColor(s, 2), toColor(s, 3));
|
toColor(s, 3));
|
||||||
readCurve(SUPER(timeline), iii, frame);
|
readCurve(SUPER(timeline), iii, frame);
|
||||||
}
|
}
|
||||||
animation->timelines[animation->timelineCount++] = (Timeline*)timeline;
|
animation->timelines[animation->timelineCount++] = (Timeline*)timeline;
|
||||||
@ -219,7 +218,6 @@ static Animation* _SkeletonJson_readAnimation (SkeletonJson* self, Json* root, S
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return animation;
|
return animation;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user