diff --git a/examples/js/loaders/GLTF2Loader.js b/examples/js/loaders/GLTF2Loader.js index 61a044daa782551396a8c51ac55659fc3da1d1b8..13834c6df9947f0d29cf4cec79cbdaeb42c89877 100644 --- a/examples/js/loaders/GLTF2Loader.js +++ b/examples/js/loaders/GLTF2Loader.js @@ -1594,7 +1594,7 @@ THREE.GLTF2Loader = ( function () { var attributeEntry = attributes[ attributeId ]; - if ( ! attributeEntry ) return; + if ( attributeEntry === undefined ) return; var bufferAttribute = dependencies.accessors[ attributeEntry ]; @@ -1923,11 +1923,25 @@ THREE.GLTF2Loader = ( function () { var node = json.nodes[ nodeId ]; - if ( node.meshes !== undefined ) { + var meshes; + + if ( node.mesh !== undefined) { + + meshes = [ node.mesh ]; + + } else if ( node.meshes !== undefined ) { + + console.warn( 'GLTF2Loader: Legacy glTF file detected. Nodes may have no more than 1 mesh.' ); + + meshes = node.meshes; + + } + + if ( meshes !== undefined ) { - for ( var meshId in node.meshes ) { + for ( var meshId in meshes ) { - var mesh = node.meshes[ meshId ]; + var mesh = meshes[ meshId ]; var group = dependencies.meshes[ mesh ]; if ( group === undefined ) {