فهرست منبع

GLTFExporter: Add early exit if attributes not found in processMesh

Fernando Serrano 7 سال پیش
والد
کامیت
bbf74b96c8
1فایلهای تغییر یافته به همراه12 افزوده شده و 10 حذف شده
  1. 12 10
      examples/js/exporters/GLTFExporter.js

+ 12 - 10
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 ) {