Update gltf-model-import to use SkeletonUtils.clone for better skinned mesh handling
This commit is contained in:
@@ -328,7 +328,11 @@ function rewriteGltfResourceUris(gltfJson, files) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
function cloneTemplateScene(scene) {
|
function cloneTemplateScene(scene) {
|
||||||
return scene.clone(true);
|
// Use SkeletonUtils.clone so that SkinnedMesh.skeleton.bones are remapped
|
||||||
|
// to the cloned hierarchy. A plain scene.clone(true) leaves the bones array
|
||||||
|
// pointing at the original loader's nodes, which are gone after parsing,
|
||||||
|
// making every skinned mesh invisible at runtime.
|
||||||
|
return cloneSkeleton(scene);
|
||||||
}
|
}
|
||||||
function cloneMaterial(material) {
|
function cloneMaterial(material) {
|
||||||
return material.clone();
|
return material.clone();
|
||||||
|
|||||||
@@ -453,7 +453,11 @@ function rewriteGltfResourceUris(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cloneTemplateScene(scene: Group): Group {
|
function cloneTemplateScene(scene: Group): Group {
|
||||||
return scene.clone(true);
|
// Use SkeletonUtils.clone so that SkinnedMesh.skeleton.bones are remapped
|
||||||
|
// to the cloned hierarchy. A plain scene.clone(true) leaves the bones array
|
||||||
|
// pointing at the original loader's nodes, which are gone after parsing,
|
||||||
|
// making every skinned mesh invisible at runtime.
|
||||||
|
return cloneSkeleton(scene) as Group;
|
||||||
}
|
}
|
||||||
|
|
||||||
function cloneMaterial(material: Material): Material {
|
function cloneMaterial(material: Material): Material {
|
||||||
|
|||||||
Reference in New Issue
Block a user