瀏覽代碼

Export buffer attribute name only when it is not empty in BufferGeometry.toJSON()

Takahiro 6 年之前
父節點
當前提交
7d455a467e
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      src/core/BufferGeometry.js

+ 6 - 3
src/core/BufferGeometry.js

@@ -1025,13 +1025,16 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 
 				var attribute = attributeArray[ i ];
 
-				array.push( {
-					name: attribute.name,
+				var attributeData = {
 					itemSize: attribute.itemSize,
 					type: attribute.array.constructor.name,
 					array: Array.prototype.slice.call( attribute.array ),
 					normalized: attribute.normalized
-				} );
+				};
+
+				if ( attribute.name !== '' ) attributeData.name = attribute.name;
+
+				array.push( attributeData );
 
 			}