Browse Source

Merge pull request #11033 from takahirox/FixEffectiveWeight

Enable to update AnimationAction._effectiveWeight by mixer even if its .enabled is false
Mr.doob 8 years ago
parent
commit
6776a15b0f
2 changed files with 14 additions and 8 deletions
  1. 13 3
      src/animation/AnimationAction.js
  2. 1 5
      src/animation/AnimationMixer.js

+ 13 - 3
src/animation/AnimationAction.js

@@ -66,8 +66,8 @@ function AnimationAction( mixer, clip, localRoot ) {
 
 
 	this.repetitions = Infinity; 		// no. of repetitions when looping
 	this.repetitions = Infinity; 		// no. of repetitions when looping
 
 
-	this.paused = false;				// false -> zero effective time scale
-	this.enabled = true;				// true -> zero effective weight
+	this.paused = false;				// true -> zero effective time scale
+	this.enabled = true;				// false -> zero effective weight
 
 
 	this.clampWhenFinished 	= false;	// keep feeding the last frame?
 	this.clampWhenFinished 	= false;	// keep feeding the last frame?
 
 
@@ -220,7 +220,7 @@ Object.assign( AnimationAction.prototype, {
 
 
 	// Time Scale Control
 	// Time Scale Control
 
 
-	// set the weight stopping any scheduled warping
+	// set the time scale stopping any scheduled warping
 	// although .paused = true yields an effective time scale of zero, this
 	// although .paused = true yields an effective time scale of zero, this
 	// method does *not* change .paused, because it would be confusing
 	// method does *not* change .paused, because it would be confusing
 	setEffectiveTimeScale: function( timeScale ) {
 	setEffectiveTimeScale: function( timeScale ) {
@@ -327,8 +327,18 @@ Object.assign( AnimationAction.prototype, {
 	// Interna
 	// Interna
 
 
 	_update: function( time, deltaTime, timeDirection, accuIndex ) {
 	_update: function( time, deltaTime, timeDirection, accuIndex ) {
+
 		// called by the mixer
 		// called by the mixer
 
 
+		if ( ! this.enabled ) {
+
+			// call ._updateWeight() to update ._effectiveWeight
+
+			this._updateWeight( time );
+			return;
+
+		}
+
 		var startTime = this._startTime;
 		var startTime = this._startTime;
 
 
 		if ( startTime !== null ) {
 		if ( startTime !== null ) {

+ 1 - 5
src/animation/AnimationMixer.js

@@ -610,11 +610,7 @@ Object.assign( AnimationMixer.prototype, EventDispatcher.prototype, {
 
 
 			var action = actions[ i ];
 			var action = actions[ i ];
 
 
-			if ( action.enabled ) {
-
-				action._update( time, deltaTime, timeDirection, accuIndex );
-
-			}
+			action._update( time, deltaTime, timeDirection, accuIndex );
 
 
 		}
 		}