Do not write negative skeleton id(skeleton is not assigned).

Also ensure `inverseBindMatrices` should not be -2 or other negative values.
This commit is contained in:
Syoyo Fujita 2021-04-28 19:15:16 +09:00
parent 08a7dd8dad
commit d07b976d59

View File

@ -7243,11 +7243,17 @@ static void SerializeGltfScene(Scene &scene, json &o) {
}
static void SerializeGltfSkin(Skin &skin, json &o) {
if (skin.inverseBindMatrices != -1)
SerializeNumberProperty("inverseBindMatrices", skin.inverseBindMatrices, o);
// required
SerializeNumberArrayProperty<int>("joints", skin.joints, o);
if (skin.inverseBindMatrices >= 0) {
SerializeNumberProperty("inverseBindMatrices", skin.inverseBindMatrices, o);
}
if (skin.skeleton >= 0) {
SerializeNumberProperty("skeleton", skin.skeleton, o);
}
if (skin.name.size()) {
SerializeStringProperty("name", skin.name, o);
}