glb_inspect: count animation weights per mesh morph target #1486

Open
github-bot wants to merge 2 commits from github-bot/gh-1486 into main AGit
Owner

@⁠xel1uz on GitHub · 2026-11-25 01:28 UTC · original
xel1uz:fix/glb-inspect-morph-weight-count → main · +103 −7 · 2 files · 2 commits · open

Claimed in the coordination issue as: GLB-INSPECT-MORPH-WEIGHT-COUNT

What and why

Running python -I tools/glb_inspect.py AnimatedMorphCube.glb --json report.json on the Khronos sample reports a count error on upstream b4b7756e8c64. The animation has 127 keys and two morph targets, so all 254 scalar weights belong there. The old check also accepts an underfilled stream when its length happens to match what a single target would need.

The inspector now resolves each weight channel's target mesh and checks the packed scalar count against its morph target count. LINEAR and STEP store one weight per target per key. CUBICSPLINE stores three per target per key. Checking the channel also identifies which mesh is incompatible when a sampler is shared. glTF 2.0 animation spec

Tested

  • Repeated the sample command above with the same GLB before and after. Both runs exited 0. The only JSON change was removal of the incorrect entry in the animation's issues array.
  • python -I tests/test_glb_inspect.py -k test_morph_weight exercises eight CLI cases. All eight failed their assertions on the original implementation and passed after the fix. The fixtures cover valid and short streams for all three interpolation modes, a shared sampler, and a mesh with a static primitive before the animated one.
  • Khronos glTF Validator independently accepted all three correctly sized fixtures and reported ANIMATION_SAMPLER_OUTPUT_ACCESSOR_INVALID_COUNT for all three underfilled fixtures.
  • python -I tests/test_glb_inspect.py -v on Windows and Ubuntu (WSL). Each ran 39 tests with one platform-specific skip and no failures.
  • python -I scripts/check_no_game_data.py tools/glb_inspect.py tests/test_glb_inspect.py and git diff --check passed.
  • python -I scripts/run_semantic_tests.py tests/semantic -j 12 ran 6,223 tests across 476 files in 407 s with zero failing files.

GPUs tested: N/A (CPU-only GLB inspection).
AI-assisted: Yes.

Checklist

  • Based on upstream main (cc22b7d4fd).
  • One topic.
  • No game data, keys or decryption. The committed fixtures are generated in memory.
  • Translator contract table: N/A. No translator rule changed.
**@⁠xel1uz** on GitHub · 2026-11-25 01:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1486) `xel1uz:fix/glb-inspect-morph-weight-count` → `main` · +103 −7 · 2 files · 2 commits · open Claimed in the coordination issue as: [GLB-INSPECT-MORPH-WEIGHT-COUNT](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why Running `python -I tools/glb_inspect.py AnimatedMorphCube.glb --json report.json` on the [Khronos sample](https://github.com/KhronosGroup/glTF-Sample-Assets/tree/e124e8d8d7330a5372bc2b4d00d39a4a9d7997ea/Models/AnimatedMorphCube) reports a count error on upstream `b4b7756e8c64`. The animation has 127 keys and two morph targets, so all 254 scalar weights belong there. The old check also accepts an underfilled stream when its length happens to match what a single target would need. The inspector now resolves each weight channel's target mesh and checks the packed scalar count against its morph target count. LINEAR and STEP store one weight per target per key. CUBICSPLINE stores three per target per key. Checking the channel also identifies which mesh is incompatible when a sampler is shared. [glTF 2.0 animation spec](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#animations) ### Tested - Repeated the sample command above with the same GLB before and after. Both runs exited 0. The only JSON change was removal of the incorrect entry in the animation's `issues` array. - `python -I tests/test_glb_inspect.py -k test_morph_weight` exercises eight CLI cases. All eight failed their assertions on the original implementation and passed after the fix. The fixtures cover valid and short streams for all three interpolation modes, a shared sampler, and a mesh with a static primitive before the animated one. - Khronos glTF Validator independently accepted all three correctly sized fixtures and reported `ANIMATION_SAMPLER_OUTPUT_ACCESSOR_INVALID_COUNT` for all three underfilled fixtures. - `python -I tests/test_glb_inspect.py -v` on Windows and Ubuntu (WSL). Each ran 39 tests with one platform-specific skip and no failures. - `python -I scripts/check_no_game_data.py tools/glb_inspect.py tests/test_glb_inspect.py` and `git diff --check` passed. - `python -I scripts/run_semantic_tests.py tests/semantic -j 12` ran 6,223 tests across 476 files in 407 s with zero failing files. GPUs tested: N/A (CPU-only GLB inspection). AI-assisted: Yes. ### Checklist - [x] Based on upstream `main` (`cc22b7d4fd`). - [x] One topic. - [x] No game data, keys or decryption. The committed fixtures are generated in memory. - Translator contract table: N/A. No translator rule changed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:53:42 +00:00
Author
Owner

@⁠ytsodacan on GitHub · 2026-11-25 03:36 UTC · original · edited 2026-11-25 03:43 UTC

[KEEP]

  • The fix looks correct and scoped: tools/glb_inspect.py resolves each weights channel's target mesh and checks scalar counts against morph target count (x3 for CUBICSPLINE), with 3 new tests in tests/test_glb_inspect.py covering shared samplers and static-first primitives.
  • No CI checks are reported for the branch, and the state is UNSTABLE. The checks it cites were run locally. I couldn't confirm a green run, so I'm not marking it MERGE.
  • No conflicts (MERGEABLE) and no duplicate open PRs for this fix.
  • Suggest merging once CI has run green, or a maintainer re-triggers it.
**@⁠ytsodacan** on GitHub · 2026-11-25 03:36 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1486#issuecomment-7152065914) · edited 2026-11-25 03:43 UTC **[KEEP]** - The fix looks correct and scoped: `tools/glb_inspect.py` resolves each weights channel's target mesh and checks scalar counts against morph target count (x3 for CUBICSPLINE), with 3 new tests in `tests/test_glb_inspect.py` covering shared samplers and static-first primitives. - No CI checks are reported for the branch, and the state is UNSTABLE. The checks it cites were run locally. I couldn't confirm a green run, so I'm not marking it MERGE. - No conflicts (`MERGEABLE`) and no duplicate open PRs for this fix. - Suggest merging once CI has run green, or a maintainer re-triggers it.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1486/head:github-bot/gh-1486'
git switch 'github-bot/gh-1486'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1486'
git switch 'github-bot/gh-1486'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1486'
git switch 'github-bot/gh-1486'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1486'
git switch 'main'
git merge --squash 'github-bot/gh-1486'
git switch 'main'
git merge --ff-only 'github-bot/gh-1486'
git switch 'main'
git merge 'github-bot/gh-1486'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.