Browse Source

GLTFExporter: Prevent creating empty nodes

Fernando Serrano 8 năm trước cách đây
mục cha
commit
284628c8b7
1 tập tin đã thay đổi với 8 bổ sung1 xóa
  1. 8 1
      examples/js/exporters/GLTFExporter.js

+ 8 - 1
examples/js/exporters/GLTFExporter.js

@@ -834,6 +834,7 @@ THREE.GLTFExporter.prototype = {
 			for ( var i = 0, l = scene.children.length; i < l; i ++ ) {
 
 				var child = scene.children[ i ];
+				var nodes = [];
 
 				// @TODO We don't process lights yet
 				if ( child instanceof THREE.Mesh ||
@@ -842,7 +843,13 @@ THREE.GLTFExporter.prototype = {
 					child instanceof THREE.Line ||
 					child instanceof THREE.Points) {
 
-					gltfScene.nodes.push( processNode( child ) );
+					nodes.push( processNode( child ) );
+
+				}
+
+				if ( nodes.length > 0 ) {
+
+					gltfScene.nodes = nodes;
 
 				}