@@ -380,7 +380,9 @@ private void CompareCameraValues(Camera camera, Camera fbxCamera, float delta=0.
380
380
381
381
[ Test ]
382
382
public void TestSkinnedMeshExport ( ) {
383
- var fbxPath = "Cowboy/3D assets/Cowboy/cowboyMidPoly(riged).fbx" ; //"DefaultMale.fbx";
383
+ // for now use this cowboy taken from the asset store as the test file
384
+ // TODO: find a better/simpler test file
385
+ var fbxPath = "Cowboy/3D assets/Cowboy/cowboyMidPoly(riged).fbx" ;
384
386
385
387
// add fbx to scene
386
388
GameObject originalFbxObj = AssetDatabase . LoadMainAssetAtPath ( "Assets/" + fbxPath ) as GameObject ;
@@ -414,21 +416,15 @@ public void TestSkinnedMeshExport(){
414
416
415
417
Assert . AreEqual ( originalBones . Length , exportedBones . Length ) ;
416
418
417
- Debug . Log ( "bone count: " + originalBones . Length ) ;
418
-
419
419
for ( int i = 0 ; i < originalBones . Length ; i ++ ) {
420
420
var originalBone = originalBones [ i ] ;
421
421
var exportedBone = exportedBones [ i ] ;
422
422
423
423
Assert . AreEqual ( originalBone . name , exportedBone . name ) ;
424
424
Assert . AreEqual ( originalBone . parent , exportedBone . parent ) ;
425
425
426
- Debug . Log ( "bone name: " + originalBone . name ) ;
427
-
428
- // compare transforms
429
- /*Assert.AreEqual(originalBone.localPosition, exportedBone.localPosition);
430
- Assert.AreEqual (originalBone.localRotation, exportedBone.localRotation);
431
- Assert.AreEqual (originalBone.localScale, exportedBone.localScale);*/
426
+ // NOTE: not comparing transforms as the exported transforms are taken from
427
+ // the bind pose whereas the originals are not necessarily.
432
428
}
433
429
434
430
// compare bind poses
@@ -448,55 +444,21 @@ public void TestSkinnedMeshExport(){
448
444
var origBp = origBindposes [ i ] ;
449
445
var expBp = exportedBindposes [ i ] ;
450
446
451
-
452
- Debug . Log ( "bind pose bone: " + originalBones [ i ] . name ) ;
453
-
454
- Vector3 origPos = origBp . GetColumn ( 3 ) ;
455
- var origQ = Quaternion . LookRotation (
456
- origBp . GetColumn ( 2 ) ,
457
- origBp . GetColumn ( 1 )
458
- ) ;
459
- Vector3 origS = new Vector3 (
460
- origBp . GetColumn ( 0 ) . magnitude ,
461
- origBp . GetColumn ( 1 ) . magnitude ,
462
- origBp . GetColumn ( 2 ) . magnitude
463
- ) ;
464
-
465
- Vector3 expPos = expBp . GetColumn ( 3 ) ;
466
- var expQ = Quaternion . LookRotation (
467
- expBp . GetColumn ( 2 ) ,
468
- expBp . GetColumn ( 1 )
469
- ) ;
470
- Vector3 expS = new Vector3 (
471
- expBp . GetColumn ( 0 ) . magnitude ,
472
- expBp . GetColumn ( 1 ) . magnitude ,
473
- expBp . GetColumn ( 2 ) . magnitude
474
- ) ;
475
-
476
- Debug . Log ( "original TRS: " + origPos + ", " + origQ . eulerAngles + ", " + origS ) ;
477
- Debug . Log ( "exported TRS: " + expPos + ", " + expQ . eulerAngles + ", " + expS ) ;
478
-
479
447
for ( int j = 0 ; j < 4 ; j ++ ) {
480
448
for ( int k = 0 ; k < 4 ; k ++ ) {
481
449
Assert . AreEqual ( origBp . GetColumn ( j ) [ k ] , expBp . GetColumn ( j ) [ k ] , 0.001 ) ;
482
450
}
483
451
}
484
452
}
485
453
486
- // compare bone weights
454
+ // TODO: find a way to compare bone weights.
455
+ // The boneweights are by vertex, and duplicate vertices
456
+ // are removed on export so the lists are not necessarily
457
+ // the same length or order.
487
458
var origWeights = origMesh . boneWeights ;
488
459
Assert . IsNotNull ( origWeights ) ;
489
460
var expWeights = exportedMesh . boneWeights ;
490
461
Assert . IsNotNull ( expWeights ) ;
491
-
492
- Debug . Log ( "orig mesh vertices: " + origMesh . vertexCount ) ;
493
- Debug . Log ( "exp mesh vertices: " + exportedMesh . vertexCount ) ;
494
-
495
- //Assert.AreEqual (origWeights.Length, expWeights.Length);
496
-
497
- /*for (int i = 0, n = Mathf.Min(origWeights.Length, expWeights.Length); i < n; i++) {
498
- Assert.AreEqual (origWeights [i], expWeights [i]);
499
- }*/
500
462
}
501
463
}
502
464
}
0 commit comments