Skip to content

Commit

Permalink
Merge pull request mrdoob#11033 from takahirox/FixEffectiveWeight
Browse files Browse the repository at this point in the history
Enable to update AnimationAction._effectiveWeight by mixer even if its .enabled is false
  • Loading branch information
mrdoob authored Mar 22, 2017
2 parents 7871fbe + f99ce24 commit 6776a15
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
16 changes: 13 additions & 3 deletions src/animation/AnimationAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ function AnimationAction( mixer, clip, localRoot ) {

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?

Expand Down Expand Up @@ -220,7 +220,7 @@ Object.assign( AnimationAction.prototype, {

// 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
// method does *not* change .paused, because it would be confusing
setEffectiveTimeScale: function( timeScale ) {
Expand Down Expand Up @@ -327,8 +327,18 @@ Object.assign( AnimationAction.prototype, {
// Interna

_update: function( time, deltaTime, timeDirection, accuIndex ) {

// called by the mixer

if ( ! this.enabled ) {

// call ._updateWeight() to update ._effectiveWeight

this._updateWeight( time );
return;

}

var startTime = this._startTime;

if ( startTime !== null ) {
Expand Down
6 changes: 1 addition & 5 deletions src/animation/AnimationMixer.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,7 @@ Object.assign( AnimationMixer.prototype, EventDispatcher.prototype, {

var action = actions[ i ];

if ( action.enabled ) {

action._update( time, deltaTime, timeDirection, accuIndex );

}
action._update( time, deltaTime, timeDirection, accuIndex );

}

Expand Down

0 comments on commit 6776a15

Please sign in to comment.