"""Regenerate hand-poses/canonical_rest.json — the canonical Quaternius finger-bone REST rotations, taken from the Kevin pack the hand poses were harvested against. The runtime needs this to apply a pose REST-RELATIVE on rigs whose finger rest differs from canonical (Mako's *_01 knuckles sit 11.5 deg off, so applying a canonical pose directly rotates his knuckles away from his own rest and tears the palm/wrist boundary): delta = canonical_rest^-1 * pose target = body_rest * delta usage: make_canonical_rest.py [kevin.glb] [out.json] """ import json, struct, sys from pathlib import Path REPO = Path(__file__).resolve().parents[1] GAME = REPO.parent / "ariki-game" src = Path(sys.argv[1]) if len(sys.argv) > 1 else \ GAME / "assets/quaternius/kevin/kevin_female_combat.glb" out = Path(sys.argv[2]) if len(sys.argv) > 2 else REPO / "hand-poses/canonical_rest.json" d = src.read_bytes() jl = struct.unpack_from("