diff --git a/scripts/test_bvh_to_fbx.py b/scripts/test_bvh_to_fbx.py index 195bc5a..a297d46 100644 --- a/scripts/test_bvh_to_fbx.py +++ b/scripts/test_bvh_to_fbx.py @@ -35,10 +35,10 @@ 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)) + # The importer starts the take a frame late, so its range ends before the last key: read two frames past it. + frames = range(first, last + 3) + out["hips_travel"] = max((world("Hips", f) - world("Hips", first)).length for f in frames) + out["root_wander"] = max((world("Root", f) - world("Root", first)).length for f in frames) print("INSPECT " + json.dumps(out)) '''