Skip to content

Commit 14dd17b

Browse files
committed
fix: Consider array format materials
1 parent 6fef63a commit 14dd17b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/three-vrm-core/src/expressions/VRMExpressionLoaderPlugin.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,13 @@ export class VRMExpressionLoaderPlugin implements GLTFLoaderPlugin {
183183
// list up every material in `gltf.scene`
184184
const gltfMaterials: THREE.Material[] = [];
185185
gltf.scene.traverse((object) => {
186-
const material = (object as any).material as THREE.Material | undefined;
186+
const material = (object as any).material as THREE.Material | THREE.Material[] | undefined;
187187
if (material) {
188-
gltfMaterials.push(material);
188+
if (Array.isArray(material)) {
189+
gltfMaterials.push(...material);
190+
} else {
191+
gltfMaterials.push(material);
192+
}
189193
}
190194
});
191195

0 commit comments

Comments
 (0)