Skip to content

Commit 13dc528

Browse files
committed
clean up unit test
1 parent a4e2159 commit 13dc528

File tree

1 file changed

+9
-47
lines changed

1 file changed

+9
-47
lines changed

Assets/FbxExporters/Editor/UnitTests/ModelExporterTest.cs

Lines changed: 9 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,9 @@ private void CompareCameraValues(Camera camera, Camera fbxCamera, float delta=0.
380380

381381
[Test]
382382
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";
384386

385387
// add fbx to scene
386388
GameObject originalFbxObj = AssetDatabase.LoadMainAssetAtPath("Assets/" + fbxPath) as GameObject;
@@ -414,21 +416,15 @@ public void TestSkinnedMeshExport(){
414416

415417
Assert.AreEqual (originalBones.Length, exportedBones.Length);
416418

417-
Debug.Log ("bone count: " + originalBones.Length);
418-
419419
for(int i = 0; i < originalBones.Length; i++){
420420
var originalBone = originalBones [i];
421421
var exportedBone = exportedBones [i];
422422

423423
Assert.AreEqual (originalBone.name, exportedBone.name);
424424
Assert.AreEqual (originalBone.parent, exportedBone.parent);
425425

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.
432428
}
433429

434430
// compare bind poses
@@ -448,55 +444,21 @@ public void TestSkinnedMeshExport(){
448444
var origBp = origBindposes [i];
449445
var expBp = exportedBindposes [i];
450446

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-
479447
for (int j = 0; j < 4; j++) {
480448
for (int k = 0; k < 4; k++) {
481449
Assert.AreEqual (origBp.GetColumn (j)[k], expBp.GetColumn (j)[k], 0.001);
482450
}
483451
}
484452
}
485453

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.
487458
var origWeights = origMesh.boneWeights;
488459
Assert.IsNotNull (origWeights);
489460
var expWeights = exportedMesh.boneWeights;
490461
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-
}*/
500462
}
501463
}
502464
}

0 commit comments

Comments
 (0)