Преглед изворни кода

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 );
 
 			}