Browse Source

Addressing feedback from CR

Christine Morten 5 years ago
parent
commit
c9f2e5e2f1

+ 16 - 3
src/animation/AnimationAction.js

@@ -375,10 +375,23 @@ Object.assign( AnimationAction.prototype, {
 			var interpolants = this._interpolants;
 			var interpolants = this._interpolants;
 			var propertyMixers = this._propertyBindings;
 			var propertyMixers = this._propertyBindings;
 
 
-			for ( var j = 0, m = interpolants.length; j !== m; ++ j ) {
+			if ( this.isAdditive ) {
 
 
-				interpolants[ j ].evaluate( clipTime );
-				propertyMixers[ j ].accumulate( accuIndex, weight, this.isAdditive );
+				for ( var j = 0, m = interpolants.length; j !== m; ++ j ) {
+
+					interpolants[ j ].evaluate( clipTime );
+					propertyMixers[ j ].accumulateAdditive( weight );
+
+				}
+
+			} else {
+
+				for ( var j = 0, m = interpolants.length; j !== m; ++ j ) {
+
+					interpolants[ j ].evaluate( clipTime );
+					propertyMixers[ j ].accumulate( accuIndex, weight, this.isAdditive );
+
+				}
 
 
 			}
 			}
 
 

+ 4 - 4
src/animation/AnimationUtils.js

@@ -246,11 +246,11 @@ var AnimationUtils = {
 		}
 		}
 		const numTracks = clip.tracks.length;
 		const numTracks = clip.tracks.length;
 
 
-		fps = fps || 30;
+		fps = fps > 0 ? fps : 30;
 		const referenceTime = referenceFrame / fps;
 		const referenceTime = referenceFrame / fps;
 
 
 		// Make each track's values relative to the values at the reference frame
 		// Make each track's values relative to the values at the reference frame
-		for ( let i = 0; i !== numTracks; ++ i ) {
+		for ( let i = 0; i < numTracks; ++ i ) {
 
 
 			const track = clip.tracks[ i ];
 			const track = clip.tracks[ i ];
 			const trackType = track.ValueTypeName;
 			const trackType = track.ValueTypeName;
@@ -299,7 +299,7 @@ var AnimationUtils = {
 
 
 			// Subtract the reference value from all of the track values
 			// Subtract the reference value from all of the track values
 
 
-			for ( let j = 0; j !== numTimes; ++ j ) {
+			for ( let j = 0; j < numTimes; ++ j ) {
 
 
 				const valueStart = j * valueSize;
 				const valueStart = j * valueSize;
 
 
@@ -318,7 +318,7 @@ var AnimationUtils = {
 				} else {
 				} else {
 
 
 					// Subtract each value for all other numeric track types
 					// Subtract each value for all other numeric track types
-					for ( let k = 0; k !== valueSize; ++ k ) {
+					for ( let k = 0; k < valueSize; ++ k ) {
 
 
 						track.values[ valueStart + k ] -= referenceValue[ k ];
 						track.values[ valueStart + k ] -= referenceValue[ k ];
 
 

+ 2 - 1
src/animation/PropertyMixer.d.ts

@@ -10,7 +10,8 @@ export class PropertyMixer {
 	useCount: number;
 	useCount: number;
 	referenceCount: number;
 	referenceCount: number;
 
 
-	accumulate( accuIndex: number, weight: number, isAdditive?: boolean ): void;
+	accumulate( accuIndex: number, weight: number ): void;
+	accumulateAdditive( weight: number ): void;
 	apply( accuIndex: number ): void;
 	apply( accuIndex: number ): void;
 	saveOriginalState(): void;
 	saveOriginalState(): void;
 	restoreOriginalState(): void;
 	restoreOriginalState(): void;

+ 2 - 10
src/animation/PropertyMixer.js

@@ -84,16 +84,8 @@ function PropertyMixer( binding, typeName, valueSize ) {
 
 
 Object.assign( PropertyMixer.prototype, {
 Object.assign( PropertyMixer.prototype, {
 
 
-	accumulate: function ( accuIndex, weight, isAdditive = false ) {
-
-		if ( isAdditive ) this._accumulateAdditive( weight );
-
-		else this._accumulate( accuIndex, weight );
-
-	},
-
 	// accumulate data in the 'incoming' region into 'accu<i>'
 	// accumulate data in the 'incoming' region into 'accu<i>'
-	_accumulate: function ( accuIndex, weight ) {
+	accumulate: function ( accuIndex, weight ) {
 
 
 		// note: happily accumulating nothing when weight = 0, the caller knows
 		// note: happily accumulating nothing when weight = 0, the caller knows
 		// the weight and shouldn't have made the call in the first place
 		// the weight and shouldn't have made the call in the first place
@@ -131,7 +123,7 @@ Object.assign( PropertyMixer.prototype, {
 	},
 	},
 
 
 	// accumulate data in the 'incoming' region into 'add'
 	// accumulate data in the 'incoming' region into 'add'
-	_accumulateAdditive: function ( weight ) {
+	accumulateAdditive: function ( weight ) {
 
 
 		var buffer = this.buffer,
 		var buffer = this.buffer,
 			stride = this.valueSize,
 			stride = this.valueSize,