test_bvh_to_fbx: report the frame range and Hips travel by frame when travel is off

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-24 20:49:37 +02:00
commit c6c79bfdef

View file

@ -35,6 +35,8 @@ if action is not None:
def world(name, frame):
scene.frame_set(frame)
return (arm.matrix_world @ arm.pose.bones[name].matrix).translation.copy()
out["frame_range"] = [first, last]
out["hips_by_frame"] = {f: round((world("Hips", f) - world("Hips", first)).length, 4) for f in (first, first + 1, last - 1, last, last + 1)}
out["hips_travel"] = (world("Hips", last) - world("Hips", first)).length
out["root_wander"] = max((world("Root", f) - world("Root", first)).length for f in range(first, last + 1))
print("INSPECT " + json.dumps(out))
@ -133,7 +135,7 @@ class BvhToFbx(unittest.TestCase):
run = convert(bvh, fbx, "walk")
self.assertEqual(run.returncode, 0, run.stderr[-2000:])
seen = self.inspect(fbx)
self.assertAlmostEqual(seen["hips_travel"], 1.0, delta=0.001)
self.assertAlmostEqual(seen["hips_travel"], 1.0, delta=0.001, msg=json.dumps(seen))
self.assertLess(seen["root_wander"], 1e-4)