diff --git a/examples/js/exporters/GLTFExporter.js b/examples/js/exporters/GLTFExporter.js index 455f4afc087aa..72f1d3b00ca51 100644 --- a/examples/js/exporters/GLTFExporter.js +++ b/examples/js/exporters/GLTFExporter.js @@ -975,6 +975,13 @@ THREE.GLTFExporter.prototype = { } + // Skip if no exportable attributes found + if ( Object.keys( attributes ).length === 0 ) { + + return null; + + } + // Morph targets if ( mesh.morphTargetInfluences !== undefined && mesh.morphTargetInfluences.length > 0 ) { @@ -1107,21 +1114,16 @@ THREE.GLTFExporter.prototype = { } - // Skip meshes without exportable attributes - if ( Object.keys( primitive.attributes ).length > 0 ) { + var material = processMaterial( materials[ groups[ i ].materialIndex ] ); - var material = processMaterial( materials[ groups[ i ].materialIndex ] ); + if ( material !== null ) { - if ( material !== null ) { - - primitive.material = material; - - } - - primitives.push( primitive ); + primitive.material = material; } + primitives.push( primitive ); + } if ( didForceIndices ) {