Browse Source

Revert "SkeletonUtils: Fix retargetClip() final keyframe (#25589)" (#25809)

This reverts commit 40a903bbd7bd75dde47c05332ea3305b8e798f1c.
Michael Herzog 2 years ago
parent
commit
a5aa3b75bc
1 changed files with 5 additions and 45 deletions
  1. 5 45
      examples/jsm/utils/SkeletonUtils.js

+ 5 - 45
examples/jsm/utils/SkeletonUtils.js

@@ -246,8 +246,8 @@ function retargetClip( target, source, clip, options = {} ) {
 					if ( ! boneData.pos ) {
 
 						boneData.pos = {
-							times: new Float32Array( numFrames + 1 ),
-							values: new Float32Array( ( numFrames + 1 ) * 3 )
+							times: new Float32Array( numFrames ),
+							values: new Float32Array( numFrames * 3 )
 						};
 
 					}
@@ -272,10 +272,9 @@ function retargetClip( target, source, clip, options = {} ) {
 
 				if ( ! boneData.quat ) {
 
-					// `numFrames + 1` accomodate final keyframe
 					boneData.quat = {
-						times: new Float32Array( numFrames + 1 ),
-						values: new Float32Array( ( numFrames + 1 ) * 4 )
+						times: new Float32Array( numFrames ),
+						values: new Float32Array( numFrames * 4 )
 					};
 
 				}
@@ -288,51 +287,12 @@ function retargetClip( target, source, clip, options = {} ) {
 
 		}
 
-		// check for final keyframe
-		if ( i === numFrames - 1 ) {
-
-			mixer.update( Math.max( clip.duration - mixer.time, 0 ) );
-
-		} else {
-
-			mixer.update( delta );
-
-		}
+		mixer.update( delta );
 
 		source.updateMatrixWorld();
 
 	}
 
-	retarget( target, source, options );
-
-	// add boneData at final keyframe
-	for ( let j = 0; j < boneDatas.length; ++ j ) {
-
-		boneData = boneDatas[ j ];
-
-		if ( boneData ) {
-
-			if ( boneData.pos ) {
-
-				boneData.pos.times[ numFrames ] = clip.duration;
-
-				bone.position.toArray( boneData.pos.values, numFrames * 3 );
-
-			}
-
-			if ( boneData.quat ) {
-
-				boneData.quat.times[ numFrames ] = clip.duration;
-
-				bone.position.toArray( boneData.quat.values, numFrames * 4 );
-
-			}
-
-		}
-
-	}
-
-
 	for ( let i = 0; i < boneDatas.length; ++ i ) {
 
 		boneData = boneDatas[ i ];