浏览代码

GLTFExporter: Prevent exporting multimaterial without groups

Fernando Serrano 7 年之前
父节点
当前提交
7eff7951af
共有 1 个文件被更改,包括 2 次插入6 次删除
  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 ) {