Forráskód Böngészése

GLTFExporter: Prevent exporting multimaterial without groups

Fernando Serrano 7 éve
szülő
commit
7eff7951af
1 módosított fájl, 2 hozzáadás és 6 törlés
  1. 2 6
      examples/js/exporters/GLTFExporter.js

+ 2 - 6
examples/js/exporters/GLTFExporter.js

@@ -1070,6 +1070,8 @@ THREE.GLTFExporter.prototype = {
 			var forceIndices = options.forceIndices;
 			var isMultiMaterial = Array.isArray( mesh.material );
 
+			if ( isMultiMaterial && mesh.geometry.groups.length === 0 ) return null;
+
 			if ( ! forceIndices && geometry.index === null && isMultiMaterial ) {
 
 				// temporal workaround.
@@ -1132,12 +1134,6 @@ THREE.GLTFExporter.prototype = {
 
 			}
 
-			if ( primitives.length === 0 ) {
-
-				return null;
-
-			}
-
 			gltfMesh.primitives = primitives;
 
 			if ( ! outputJSON.meshes ) {