@@ -502,13 +502,13 @@ THREE.SEA3D.Animator.prototype.updateAnimations = function( mixer ) {
502
502
this . animations = [ ] ;
503
503
this . animationsData = { } ;
504
504
505
- var animations = this instanceof THREE . SEA3D . Animator ? this . clips : this . geometry . animations ;
505
+ this . clips = this instanceof THREE . SEA3D . Animator ? this . clips : this . geometry . animations ;
506
506
507
- for ( var i = 0 ; i < animations . length ; i ++ ) {
507
+ for ( var i = 0 , clips = this . clips ; i < clips . length ; i ++ ) {
508
508
509
- var name = animations [ i ] . name ;
509
+ var name = clips [ i ] . name ;
510
510
511
- this . animations [ name ] = this . animations [ i ] = animations [ i ] ;
511
+ this . animations [ name ] = this . animations [ i ] = clips [ i ] ;
512
512
this . animationsData [ name ] = this . animationsData [ i ] = { } ;
513
513
514
514
}
@@ -579,7 +579,9 @@ THREE.SEA3D.Animator.prototype.play = function( name, crossfade, offset, weight
579
579
580
580
if ( animation == this . currentAnimation ) {
581
581
582
- if ( offset !== undefined || ! animation . loop ) this . currentAnimationAction . time = offset !== undefined ? offset : 0 ;
582
+ if ( offset !== undefined || ! animation . loop ) this . currentAnimationAction . time = offset !== undefined ? offset :
583
+ ( this . currentAnimationAction . timeScale >= 0 ? 0 : this . currentAnimation . duration ) ;
584
+
583
585
this . currentAnimationAction . setEffectiveWeight ( weight !== undefined ? weight : 1 ) ;
584
586
this . currentAnimationAction . paused = false ;
585
587
@@ -594,15 +596,17 @@ THREE.SEA3D.Animator.prototype.play = function( name, crossfade, offset, weight
594
596
595
597
this . previousAnimationAction = this . currentAnimationAction ;
596
598
this . currentAnimationAction = this . mixer . clipAction ( animation ) . setLoop ( animation . loop ? THREE . LoopRepeat : THREE . LoopOnce , Infinity ) . reset ( ) ;
597
- this . currentAnimationAction . clampWhenFinished = true ;
599
+ this . currentAnimationAction . clampWhenFinished = ! animation . loop ;
598
600
this . currentAnimationAction . paused = false ;
599
601
600
602
this . previousAnimationData = this . currentAnimationData ;
601
603
this . currentAnimationData = this . animationsData [ name ] ;
602
604
603
605
this . updateTimeScale ( ) ;
604
606
605
- if ( offset !== undefined || ! animation . loop ) this . currentAnimationAction . time = offset !== undefined ? offset : 0 ;
607
+ if ( offset !== undefined || ! animation . loop ) this . currentAnimationAction . time = offset !== undefined ? offset :
608
+ ( this . currentAnimationAction . timeScale >= 0 ? 0 : this . currentAnimation . duration ) ;
609
+
606
610
this . currentAnimationAction . setEffectiveWeight ( weight !== undefined ? weight : 1 ) ;
607
611
608
612
this . currentAnimationAction . play ( ) ;
@@ -857,7 +861,7 @@ THREE.SEA3D.Dummy.prototype.copy = function( source ) {
857
861
this . props = source . props ;
858
862
this . scripts = source . scripts ;
859
863
860
- if ( this . animation ) this . animation = source . animation . clone ( this ) ;
864
+ if ( this . animator ) this . animator = source . animator . clone ( this ) ;
861
865
862
866
return this ;
863
867
@@ -903,7 +907,7 @@ THREE.SEA3D.Mesh.prototype.copy = function( source ) {
903
907
this . props = source . props ;
904
908
this . scripts = source . scripts ;
905
909
906
- if ( this . animation ) this . animation = source . animation . clone ( this ) ;
910
+ if ( this . animator ) this . animator = source . animator . clone ( this ) ;
907
911
908
912
return this ;
909
913
@@ -948,7 +952,7 @@ THREE.SEA3D.SkinnedMesh.prototype.copy = function( source ) {
948
952
this . props = source . props ;
949
953
this . scripts = source . scripts ;
950
954
951
- if ( this . animation ) this . animation = source . animation . clone ( this ) ;
955
+ if ( this . animator ) this . animator = source . animator . clone ( this ) ;
952
956
953
957
return this ;
954
958
@@ -982,7 +986,7 @@ THREE.SEA3D.VertexAnimationMesh.prototype.copy = function( source ) {
982
986
this . props = source . props ;
983
987
this . scripts = source . scripts ;
984
988
985
- if ( this . animation ) this . animation = source . animation . clone ( this ) ;
989
+ if ( this . animator ) this . animator = source . animator . clone ( this ) ;
986
990
987
991
return this ;
988
992
@@ -1010,7 +1014,7 @@ THREE.SEA3D.Camera.prototype.copy = function( source ) {
1010
1014
this . props = source . props ;
1011
1015
this . scripts = source . scripts ;
1012
1016
1013
- if ( this . animation ) this . animation = source . animation . clone ( this ) ;
1017
+ if ( this . animator ) this . animator = source . animator . clone ( this ) ;
1014
1018
1015
1019
return this ;
1016
1020
@@ -1038,7 +1042,7 @@ THREE.SEA3D.OrthographicCamera.prototype.copy = function( source ) {
1038
1042
this . props = source . props ;
1039
1043
this . scripts = source . scripts ;
1040
1044
1041
- if ( this . animation ) this . animation = source . animation . clone ( this ) ;
1045
+ if ( this . animator ) this . animator = source . animator . clone ( this ) ;
1042
1046
1043
1047
return this ;
1044
1048
@@ -1066,7 +1070,7 @@ THREE.SEA3D.PointLight.prototype.copy = function( source ) {
1066
1070
this . props = source . props ;
1067
1071
this . scripts = source . scripts ;
1068
1072
1069
- if ( this . animation ) this . animation = source . animation . clone ( this ) ;
1073
+ if ( this . animator ) this . animator = source . animator . clone ( this ) ;
1070
1074
1071
1075
return this ;
1072
1076
@@ -1339,16 +1343,16 @@ THREE.SEA3D.prototype.applyDefaultAnimation = function( sea, animatorClass ) {
1339
1343
1340
1344
switch ( anm . tag . type ) {
1341
1345
case SEA3D . Animation . prototype . type :
1342
- obj . animation = new animatorClass ( anm . tag . tag , obj ) ;
1343
- obj . animation . setRelative ( anm . relative ) ;
1346
+ obj . animator = new animatorClass ( anm . tag . tag , obj ) ;
1347
+ obj . animator . setRelative ( anm . relative ) ;
1344
1348
1345
1349
if ( this . config . autoPlay ) {
1346
1350
1347
- obj . animation . play ( 0 ) ;
1351
+ obj . animator . play ( 0 ) ;
1348
1352
1349
1353
}
1350
1354
1351
- return obj . animation ;
1355
+ return obj . animator ;
1352
1356
break ;
1353
1357
}
1354
1358
@@ -2371,7 +2375,7 @@ THREE.SEA3D.PointSound.prototype.copy = function( source ) {
2371
2375
this . props = source . props ;
2372
2376
this . scripts = source . scripts ;
2373
2377
2374
- if ( this . animation ) this . animation = source . animation . clone ( this ) ;
2378
+ if ( this . animator ) this . animator = source . animator . clone ( this ) ;
2375
2379
2376
2380
return this ;
2377
2381
0 commit comments