diff --git a/src/animation/PropertyBinding.js b/src/animation/PropertyBinding.js index 09fd0cff6ff9c00d41622eeb6cb4628fc0c6c731..797165821faf93acf435384615134c7f9b84e97a 100644 --- a/src/animation/PropertyBinding.js +++ b/src/animation/PropertyBinding.js @@ -237,6 +237,12 @@ THREE.PropertyBinding.prototype = { this.resolvedProperty = nodeProperty; + } else if ( Array.isArray( nodeProperty ) ) { + + bindingType = this.BindingType.EntireArray; + + this.resolvedProperty = nodeProperty; + } else { this.propertyName = propertyName; @@ -274,8 +280,9 @@ Object.assign( THREE.PropertyBinding.prototype, { // prototype, continued BindingType: { Direct: 0, - ArrayElement: 1, - HasFromToArray: 2 + EntireArray: 1, + ArrayElement: 2, + HasFromToArray: 3 }, Versioning: { @@ -292,6 +299,18 @@ Object.assign( THREE.PropertyBinding.prototype, { // prototype, continued }, + function getValue_array( buffer, offset ) { + + var source = this.node[ this.propertyName ]; + + for ( var i = 0, n = source.length; i !== n; ++ i ) { + + buffer[ offset ++ ] = source[ i ]; + + } + + }, + function getValue_arrayElement( buffer, offset ) { buffer[ offset ] = this.resolvedProperty[ this.propertyIndex ]; @@ -331,6 +350,50 @@ Object.assign( THREE.PropertyBinding.prototype, { // prototype, continued } + ], [ + + // EntireArray + + function setValue_array( buffer, offset ) { + + var dest = this.resolvedProperty; + + for ( var i = 0, n = dest.length; i !== n; ++ i ) { + + dest[ i ] = buffer[ offset ++ ]; + + } + + }, + + function setValue_array_setNeedsUpdate( buffer, offset ) { + + var dest = this.resolvedProperty; + + for ( var i = 0, n = dest.length; i !== n; ++ i ) { + + dest[ i ] = buffer[ offset ++ ]; + + } + + this.targetObject.needsUpdate = true; + + }, + + function setValue_array_setMatrixWorldNeedsUpdate( buffer, offset ) { + + var dest = this.resolvedProperty; + + for ( var i = 0, n = dest.length; i !== n; ++ i ) { + + dest[ i ] = buffer[ offset ++ ]; + + } + + this.targetObject.matrixWorldNeedsUpdate = true; + + } + ], [ // ArrayElement