Browse Source

GLTFExporter: Fix empty children

Fernando Serrano 8 years ago
parent
commit
316f07829e
1 changed files with 9 additions and 2 deletions
  1. 9 2
      examples/js/exporters/GLTFExporter.js

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

@@ -772,7 +772,7 @@ THREE.GLTFExporter.prototype = {
 
 			if ( object.children.length > 0 ) {
 
-				gltfNode.children = [];
+				var children = [];
 
 				for ( var i = 0, l = object.children.length; i < l; i ++ ) {
 
@@ -783,12 +783,19 @@ THREE.GLTFExporter.prototype = {
 						child instanceof THREE.Line ||
 						child instanceof THREE.Points) {
 
-						gltfNode.children.push( processNode( child ) );
+						children.push( processNode( child ) );
 
 					}
 
 				}
 
+				if ( children.length > 0 ) {
+
+					gltfNode.children = children;
+
+				}
+
+
 			}
 
 			outputJSON.nodes.push( gltfNode );