@@ -303,72 +303,6 @@ public virtual int Compare(Keyframe a, Keyframe b)
303
303
}
304
304
}
305
305
306
- public class KeyTangentComparer : IComparer < Keyframe >
307
- {
308
- AnimationCurve curveA = null ;
309
- AnimationCurve curveB = null ;
310
- Dictionary < Keyframe , int > keyFrameToIndexA ;
311
- Dictionary < Keyframe , int > keyFrameToIndexB ;
312
-
313
- public int CompareKeyTangents ( Keyframe a , Keyframe b )
314
- {
315
- bool result = true ;
316
-
317
- result &= a . time . Equals ( b . time ) ;
318
- #if DEBUG_UNITTEST
319
- Debug . Log ( string . Format ( "{2} a.time: {0}, b.time: {1}" , a . time , b . time , result ) ) ;
320
- #endif
321
-
322
- result &= ( AnimationUtility . GetKeyLeftTangentMode ( curveA , keyFrameToIndexA [ a ] ) == AnimationUtility . GetKeyLeftTangentMode ( curveB , keyFrameToIndexB [ b ] ) ) ;
323
- result &= ( AnimationUtility . GetKeyRightTangentMode ( curveA , keyFrameToIndexA [ a ] ) == AnimationUtility . GetKeyRightTangentMode ( curveB , keyFrameToIndexB [ b ] ) ) ;
324
- #if DEBUG_UNITTEST
325
- Debug . Log ( string . Format ( "comparison result = {0}\n " +
326
- "keyframe a left tangent mode = {1}\n " +
327
- "keyframe b left tangent mode = {2}\n " +
328
- "keyframe a right tangent mode = {3}\n " +
329
- "keyframe b right tangent mode = {4}\n " ,
330
- result ,
331
- ( ( AnimationUtility . TangentMode ) AnimationUtility . GetKeyLeftTangentMode ( curveA , keyFrameToIndexA [ a ] ) ) . ToString ( ) ,
332
- ( ( AnimationUtility . TangentMode ) AnimationUtility . GetKeyLeftTangentMode ( curveB , keyFrameToIndexB [ b ] ) ) . ToString ( ) ,
333
- ( ( AnimationUtility . TangentMode ) AnimationUtility . GetKeyRightTangentMode ( curveA , keyFrameToIndexA [ a ] ) ) . ToString ( ) ,
334
- ( ( AnimationUtility . TangentMode ) AnimationUtility . GetKeyRightTangentMode ( curveB , keyFrameToIndexB [ b ] ) ) . ToString ( ) ) ) ;
335
- #endif
336
- return result ? 0 : 1 ;
337
- }
338
-
339
- public int Compare ( Keyframe a , Keyframe b )
340
- {
341
- if ( curveA == null || curveB == null )
342
- {
343
- #if DEBUG_UNITTEST
344
- Debug . Log ( string . Format ( "The animation curves were not set for this KeyTangentComparer});
345
- #endif
346
-
347
- return 1 ;
348
- }
349
- return CompareKeyTangents ( a , b ) ;
350
- }
351
-
352
- public void SetAnimationCurves ( AnimationCurve a , AnimationCurve b )
353
- {
354
- curveA = a;
355
- curveB = b;
356
-
357
- // Keep a dictionary of Keyframe->index for both curves
358
- keyFrameToIndexA = new Dictionary < Keyframe , int > ( ) ;
359
- foreach ( int index in Enumerable . Range ( 0 , a . keys . Length ) )
360
- {
361
- keyFrameToIndexA [ a . keys [ index ] ] = index ;
362
- }
363
-
364
- keyFrameToIndexB = new Dictionary < Keyframe , int > ( ) ;
365
- foreach ( int index in Enumerable . Range ( 0 , b . keys . Length ) )
366
- {
367
- keyFrameToIndexB [ b . keys [ index ] ] = index ;
368
- }
369
- }
370
- }
371
-
372
306
public class AnimTester
373
307
{
374
308
public FbxAnimationTest . KeyData keyData ;
@@ -591,13 +525,6 @@ public static void KeysTest (AnimationCurve expectedAnimCurve, AnimationCurve ac
591
525
Assert . That ( actualAnimCurve . length , Is . EqualTo ( expectedAnimCurve . length ) , string . Format ( "{0} number of keys doesn't match" , message ) ) ;
592
526
593
527
Assert . That ( actualAnimCurve . keys , Is . EqualTo ( expectedAnimCurve . keys ) . Using < Keyframe > ( keyComparer ) , string . Format ( "{0} key doesn't match" , message ) ) ;
594
-
595
- // Setup our tangent comparer if it is the one we are using
596
- var tangentComparer = keyComparer as KeyTangentComparer ;
597
- if ( tangentComparer != null )
598
- {
599
- tangentComparer . SetAnimationCurves ( actualAnimCurve , expectedAnimCurve ) ;
600
- }
601
528
}
602
529
603
530
public static void KeysTest ( float [ ] expectedKeyTimes , float [ ] expectedKeyValues , AnimationCurve actualAnimCurve , string message , IComparer < Keyframe > keyComparer = null )
@@ -820,7 +747,7 @@ public int KeyTangentsAnimTest (float [] keyTimesInSeconds, Vector3 [] keyPosVal
820
747
821
748
KeyData keyData = new TransformKeyData { RotationType = rotCurveType , propertyNames = propertyNames , componentType = componentType , keyTimes = keyTimesInSeconds , keyPosValues = keyPosValues , keyEulerValues = keyRotValues } ;
822
749
823
- var tester = new AnimTester { keyData = keyData , testName = testName , path = GetRandomFbxFilePath ( ) , keyComparer = new KeyTangentComparer ( ) } ;
750
+ var tester = new AnimTester { keyData = keyData , testName = testName , path = GetRandomFbxFilePath ( ) } ;
824
751
return tester . DoIt ( ) ;
825
752
}
826
753
0 commit comments