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

Open
opened 2026-11-26 20:17:37 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/308
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: old-pr/10043


📝 Commits (1)

  • a3cccb6 anim_glb: bind weighted bones outside the skeleton as extra rest-pose joints

📊 Changes

3 files changed (+95 additions, -5 deletions)

View changed files

📝 docs/character_skeleton.md (+7 -2)
📝 tests/test_anim_glb.py (+57 -0)
📝 tools/anim_glb.py (+31 -3)

📄 Description

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/308 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-pr/10043` --- ### 📝 Commits (1) - [`a3cccb6`](https://github.com/ubiquitarianism/leonida/commit/a3cccb632b4683b5534e866d0b5d59b683cfdf2c) anim_glb: bind weighted bones outside the skeleton as extra rest-pose joints ### 📊 Changes **3 files changed** (+95 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `docs/character_skeleton.md` (+7 -2) 📝 `tests/test_anim_glb.py` (+57 -0) 📝 `tools/anim_glb.py` (+31 -3) </details> ### 📄 Description > 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#360
No description provided.