fix: make the character pipeline work end-to-end in Blender 5.1 + bundle CC0 animation library

Verified the full chain on a real Sketchfab model (Miku UID -> rigged ->
13 clips -> loads and animates in-engine, 24/24 smoke checks pass).

Fixes found while running it for real:
- sketchfab_import: read .sketchfab_token as UTF-16/BOM too (PowerShell's
  `echo >` writes UTF-16LE, which crashed the UTF-8 reader)
- autorig: rig to the animation library's OWN skeleton when _library.glb
  is present (zero retargeting); robust binding — fall back to rigid
  nearest-bone weights when Blender bone-heat fails on complex meshes
  (Miku's joined hair/clothing gave 0 weighted verts); export as
  parent_type=ARMATURE with no modifier (Blender 5.x only emits a glTF
  skin in that exact form — a lingering Armature modifier gave skins:0);
  export_apply=False (applying modifiers baked away the skin); flatten
  the Sketchfab empty hierarchy before binding
- merge_animations: support a single multi-clip library GLB via
  LIBRARY_CLIP_MAP; version-safe fcurve access for Blender 4.4+/5.x
  slotted actions (Action.fcurves was removed)

Assets/tooling:
- bundle assets/characters/animations/_library.glb — CC0 Quaternius
  Universal Animation Library (13 game clips), + .gdignore so Godot
  skips the pipeline-input folder
- requirements.txt (stdlib-only; documents Blender-python separation)
- pipeline docs updated for the bundled library + swap instructions

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Nicholas Butzke
2026-07-06 12:42:31 -04:00
co-authored by Claude Fable 5
parent d05477c135
commit 64bbbf93c6
11 changed files with 385 additions and 90 deletions
+8 -2
View File
@@ -43,8 +43,14 @@ def get_token(cli_token: str | None) -> str:
return tok
token_file = os.path.join(PROJECT_ROOT, ".sketchfab_token")
if os.path.exists(token_file):
with open(token_file, "r", encoding="utf-8") as f:
tok = f.read().strip()
with open(token_file, "rb") as f:
raw = f.read()
# PowerShell's `echo`/`>` write UTF-16 with a BOM by default on
# Windows; tolerate that as well as plain UTF-8.
if raw.startswith(b"\xff\xfe") or raw.startswith(b"\xfe\xff"):
tok = raw.decode("utf-16").strip()
else:
tok = raw.decode("utf-8-sig").strip()
if tok:
return tok
print("ERROR: no Sketchfab API token found.")