Skip to content

Commit

Permalink
filter -1 index bones
Browse files Browse the repository at this point in the history
  • Loading branch information
memelotsqui committed Nov 15, 2023
1 parent 32ac87a commit d5adc78
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/library/VRMExporterv0.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ export default class VRMExporterv0 {
skins: outputSkins,
textures: outputTextures,
};
console.log(outputData);
const jsonChunk = new GlbChunk(parseString2Binary(JSON.stringify(outputData, undefined, 2)), "JSON");
const binaryChunk = new GlbChunk(concatBinary(bufferViews.map((buf) => buf.buffer)), "BIN\x00");
const fileData = concatBinary([jsonChunk.buffer, binaryChunk.buffer]);
Expand Down Expand Up @@ -1011,7 +1012,7 @@ const toOutputSkins = (meshes, meshDatas, nodeNames) => {
inverseBindMatrices: meshDatas
.map((data) => data.type === MeshDataType.BIND_MATRIX ? data.meshName : null)
.indexOf(mesh.name),
joints: mesh.skeleton.bones.map((bone) => nodeNames.indexOf(bone.name)),
joints: mesh.skeleton.bones.map((bone) => nodeNames.indexOf(bone.name)).filter((index) => index !== -1),
skeleton: nodeNames.indexOf(mesh.skeleton.bones[0].name),
};
});
Expand Down

0 comments on commit d5adc78

Please sign in to comment.