Просмотр исходного кода

GLTFExporter: Prevent creating empty nodes

Fernando Serrano 8 лет назад
Родитель
Сommit
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;
 
 				}