Sfoglia il codice sorgente

Merge pull request #14057 from takahirox/AddAttributeReturnValue

 Fix inconsistency of return value from BufferGeometry .addAttribute
Mr.doob 7 anni fa
parent
commit
3bd2353290
2 ha cambiato i file con 3 aggiunte e 5 eliminazioni
  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>[method:null addAttribute]( [param:String name], [param:BufferAttribute attribute] )</h3>
+		<h3>[method:BufferGeometry addAttribute]( [param:String name], [param:BufferAttribute attribute] )</h3>
 		<p>
 		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

+ 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 ).' );
 
-			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.' );
 			this.setIndex( attribute );
 
-			return;
+			return this;
 
 		}