anim_glb: bind weighted bones outside the skeleton as extra rest-pose joints #308

Closed
Andretuta wants to merge 1 commit from upstream-pr/308 into main
Andretuta commented 2026-11-24 03:05:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T03:05:42Z.


Carried over from old PR 10043 by tedin7 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10043, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
tedin7: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

@ItsNotRexed: an exe PR, as you asked.

What

tools/anim_glb.py no longer refuses a clothing part whose weighted bones are not in the skeleton. New extend_joints adds one joint per weighted unknown bone hash, named bone_0x<hash>, as a child of the skeleton's first root with identity local transform and the root's inverse bind matrix. The export loop extends the joint list part by part (several parts share one joint per hash; earlier indices do not move). bind_part itself is unchanged and still refuses a hash the skeleton lists twice. Docs and module docstring updated.

Why

docs/character_skeleton.md measures 3,212 of 9,571 skinned part drawables that use bones outside both skeletons (mostly clothing cloth bones), and the exporter raised "weighted bones not in the skeleton" for all of them. The part has no skeleton of its own, so nothing about those bones can be read; the extra joint is the same bone_0x........ naming and parent-fallback skinned_glb.py already uses, and the root's inverse bind keeps every vertex at its stored rest position. No game data is used.

Tested

  • python3 -I -m pytest tests/test_anim_glb.py: 38 passed (2 new: extend_joints unit test, ~21 lines; two-part CLI export with a shared and an own cloth bone, ~38 lines, which also runs tools/glb_skinning.py on the output: exit 0).
  • Negative control: same tests against origin/main tool: 2 failed ("weighted bones not in the skeleton: 0x12345678"), 36 passed.
  • tests/test_skinned_glb.py + tests/test_glb_skinning.py: 55 passed, 1 skipped.
  • Not done: reading a part's own skeleton (docs say these drawables have none); extra joints are all attached to the root, no name-based parent guess since only hashes are known.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465308993 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/308). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T03:05:42Z. --- > Carried over from **old PR 10043** by `tedin7` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10043`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `tedin7`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): `@ItsNotRexed`: an exe PR, as you asked. ## What `tools/anim_glb.py` no longer refuses a clothing part whose weighted bones are not in the skeleton. New `extend_joints` adds one joint per weighted unknown bone hash, named `bone_0x<hash>`, as a child of the skeleton's first root with identity local transform and the root's inverse bind matrix. The export loop extends the joint list part by part (several parts share one joint per hash; earlier indices do not move). `bind_part` itself is unchanged and still refuses a hash the skeleton lists twice. Docs and module docstring updated. ## Why `docs/character_skeleton.md` measures 3,212 of 9,571 skinned part drawables that use bones outside both skeletons (mostly clothing cloth bones), and the exporter raised "weighted bones not in the skeleton" for all of them. The part has no skeleton of its own, so nothing about those bones can be read; the extra joint is the same `bone_0x........` naming and parent-fallback skinned_glb.py already uses, and the root's inverse bind keeps every vertex at its stored rest position. No game data is used. ## Tested - `python3 -I -m pytest tests/test_anim_glb.py`: 38 passed (2 new: `extend_joints` unit test, ~21 lines; two-part CLI export with a shared and an own cloth bone, ~38 lines, which also runs tools/glb_skinning.py on the output: exit 0). - Negative control: same tests against origin/main tool: 2 failed ("weighted bones not in the skeleton: 0x12345678"), 36 passed. - tests/test_skinned_glb.py + tests/test_glb_skinning.py: 55 passed, 1 skipped. - Not done: reading a part's own skeleton (docs say these drawables have none); extra joints are all attached to the root, no name-based parent guess since only hashes are known.
MoonEyes commented 2026-11-27 19:44:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T19:44:08Z.


Thanks a lot for carrying this over, @Andretuta. The same change is in #1221: it carries tedin7's commit from old-pr/10043 with the same diff to tools/anim_glb.py, tests/test_anim_glb.py and docs/character_skeleton.md, and it was claimed in #14 as OLD-10043.

I am closing this draft so the review happens in one place. Please continue the discussion on #1221, or reopen this one if you see something it misses.

AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7226819324 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/308#issuecomment-7226819324). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-27T19:44:08Z. --- Thanks a lot for carrying this over, @Andretuta. The same change is in #1221: it carries tedin7's commit from `old-pr/10043` with the same diff to `tools/anim_glb.py`, `tests/test_anim_glb.py` and `docs/character_skeleton.md`, and it was claimed in #14 as OLD-10043. I am closing this draft so the review happens in one place. Please continue the discussion on #1221, or reopen this one if you see something it misses. AI-assisted (Claude Code, Claude Opus 5.5)

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!308
No description provided.