Переглянути джерело

Merge pull request #14057 from takahirox/AddAttributeReturnValue

 Fix inconsistency of return value from BufferGeometry .addAttribute
Mr.doob 7 роки тому
батько
коміт
3bd2353290
2 змінених файлів з 3 додано та 5 видалено
  1. 1 1
      docs/api/core/BufferGeometry.html
  2. 2 4
      src/core/BufferGeometry.js

+ 1 - 1
docs/api/core/BufferGeometry.html

@@ -195,7 +195,7 @@
 
 
 		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
 		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
 
 
-		<h3>[method:null addAttribute]( [param:String name], [param:BufferAttribute attribute] )</h3>
+		<h3>[method:BufferGeometry addAttribute]( [param:String name], [param:BufferAttribute attribute] )</h3>
 		<p>
 		<p>
 		Adds an attribute to this geometry. Use this rather than the attributes property,
 		Adds an attribute to this geometry. Use this rather than the attributes property,
 		because an internal hashmap of [page:.attributes] is maintained to speed up iterating over
 		because an internal hashmap of [page:.attributes] is maintained to speed up iterating over

+ 2 - 4
src/core/BufferGeometry.js

@@ -72,9 +72,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 
 
 			console.warn( 'THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).' );
 			console.warn( 'THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).' );
 
 
-			this.addAttribute( name, new BufferAttribute( arguments[ 1 ], arguments[ 2 ] ) );
-
-			return;
+			return this.addAttribute( name, new BufferAttribute( arguments[ 1 ], arguments[ 2 ] ) );
 
 
 		}
 		}
 
 
@@ -83,7 +81,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 			console.warn( 'THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.' );
 			console.warn( 'THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.' );
 			this.setIndex( attribute );
 			this.setIndex( attribute );
 
 
-			return;
+			return this;
 
 
 		}
 		}