浏览代码

GLTFExporter: Prevent creating empty nodes

Fernando Serrano 8 年之前
父节点
当前提交
284628c8b7
共有 1 个文件被更改,包括 8 次插入1 次删除
  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;
 
 				}