Skip to content

Commit bbf74b9

Browse files
committed
GLTFExporter: Add early exit if attributes not found in processMesh
1 parent 214435b commit bbf74b9

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

examples/js/exporters/GLTFExporter.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,13 @@ THREE.GLTFExporter.prototype = {
975975

976976
}
977977

978+
// Skip if no exportable attributes found
979+
if ( Object.keys( attributes ).length === 0 ) {
980+
981+
return null;
982+
983+
}
984+
978985
// Morph targets
979986
if ( mesh.morphTargetInfluences !== undefined && mesh.morphTargetInfluences.length > 0 ) {
980987

@@ -1107,21 +1114,16 @@ THREE.GLTFExporter.prototype = {
11071114

11081115
}
11091116

1110-
// Skip meshes without exportable attributes
1111-
if ( Object.keys( primitive.attributes ).length > 0 ) {
1117+
var material = processMaterial( materials[ groups[ i ].materialIndex ] );
11121118

1113-
var material = processMaterial( materials[ groups[ i ].materialIndex ] );
1119+
if ( material !== null ) {
11141120

1115-
if ( material !== null ) {
1116-
1117-
primitive.material = material;
1118-
1119-
}
1120-
1121-
primitives.push( primitive );
1121+
primitive.material = material;
11221122

11231123
}
11241124

1125+
primitives.push( primitive );
1126+
11251127
}
11261128

11271129
if ( didForceIndices ) {

0 commit comments

Comments
 (0)