|
@@ -476,6 +476,8 @@ THREE.SEA3D.Animator.prototype.update = function( dt ) {
|
|
|
|
|
|
if ( ! this.currentAnimationAction.enabled && ! this.currentAnimationData.completed ) {
|
|
|
|
|
|
+ this.pause();
|
|
|
+
|
|
|
this.currentAnimationData.completed = true;
|
|
|
|
|
|
if ( this.currentAnimationData.onComplete ) this.currentAnimationData.onComplete( this );
|
|
@@ -495,7 +497,7 @@ THREE.SEA3D.Animator.prototype.updateAnimations = function( mixer ) {
|
|
|
this.relative = false;
|
|
|
this.playing = false;
|
|
|
|
|
|
- this.setTimeScale( 1 );
|
|
|
+ this.timeScale = 1;
|
|
|
|
|
|
this.animations = [];
|
|
|
this.animationsData = {};
|
|
@@ -551,15 +553,21 @@ THREE.SEA3D.Animator.prototype.resume = function() {
|
|
|
|
|
|
THREE.SEA3D.Animator.prototype.setTimeScale = function( val ) {
|
|
|
|
|
|
- this.mixer._timeScale = val;
|
|
|
+ this.timeScale = val;
|
|
|
|
|
|
- this.mixer.timeScale = val * ( this.currentAnimation ? this.currentAnimation.timeScale : 1 );
|
|
|
+ if ( this.currentAnimationAction ) this.updateTimeScale();
|
|
|
|
|
|
};
|
|
|
|
|
|
THREE.SEA3D.Animator.prototype.getTimeScale = function() {
|
|
|
|
|
|
- return this.mixer._timeScale;
|
|
|
+ return this.timeScale;
|
|
|
+
|
|
|
+};
|
|
|
+
|
|
|
+THREE.SEA3D.Animator.prototype.updateTimeScale = function() {
|
|
|
+
|
|
|
+ this.currentAnimationAction.setEffectiveTimeScale( this.timeScale * ( this.currentAnimation ? this.currentAnimation.timeScale : 1 ) );
|
|
|
|
|
|
};
|
|
|
|
|
@@ -576,6 +584,7 @@ THREE.SEA3D.Animator.prototype.play = function( name, crossfade, offset, weight
|
|
|
|
|
|
this.previousAnimationAction = this.currentAnimationAction;
|
|
|
this.currentAnimationAction = this.mixer.clipAction( animation ).setLoop( animation.loop ? THREE.LoopRepeat : THREE.LoopOnce, Infinity ).reset();
|
|
|
+ this.currentAnimationAction.clampWhenFinished = true;
|
|
|
|
|
|
this.previousAnimationData = this.currentAnimationData;
|
|
|
this.currentAnimationData = this.animationsData[ name ];
|
|
@@ -584,9 +593,9 @@ THREE.SEA3D.Animator.prototype.play = function( name, crossfade, offset, weight
|
|
|
|
|
|
if ( weight !== undefined ) this.currentAnimationAction.setEffectiveWeight( weight );
|
|
|
|
|
|
- this.currentAnimationAction.play();
|
|
|
+ this.updateTimeScale();
|
|
|
|
|
|
- this.mixer.timeScale = this.mixer._timeScale * this.currentAnimation.timeScale;
|
|
|
+ this.currentAnimationAction.play();
|
|
|
|
|
|
if ( ! this.playing ) this.mixer.update( 0 );
|
|
|
|
|
@@ -659,9 +668,9 @@ THREE.SEA3D.Object3DAnimator.prototype.stop = function() {
|
|
|
|
|
|
if ( this.currentAnimation ) {
|
|
|
|
|
|
- if ( this instanceof THREE.SEA3D.Object3DAnimator ) {
|
|
|
+ var animate = this.object3d.animate;
|
|
|
|
|
|
- var animate = this.object3d.animate;
|
|
|
+ if ( animate && this instanceof THREE.SEA3D.Object3DAnimator ) {
|
|
|
|
|
|
animate.position.set( 0, 0, 0 );
|
|
|
animate.quaternion.set( 0, 0, 0, 1 );
|
|
@@ -1450,13 +1459,13 @@ THREE.SEA3D.prototype.readAnimation = function( sea ) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- var clip = new THREE.AnimationClip( seq.name, - 1, tracks );
|
|
|
- clip.loop = seq.repeat;
|
|
|
- clip.timeScale = 1;
|
|
|
+ }
|
|
|
|
|
|
- clips.push( clip );
|
|
|
+ var clip = new THREE.AnimationClip( seq.name, - 1, tracks );
|
|
|
+ clip.loop = seq.repeat;
|
|
|
+ clip.timeScale = 1;
|
|
|
|
|
|
- }
|
|
|
+ clips.push( clip );
|
|
|
|
|
|
}
|
|
|
|