glb_inspect: count animation weights per mesh morph target #1486

Merged
xel1uz merged 2 commits from upstream-pr/1486 into main 2026-11-29 00:45:06 +00:00
xel1uz commented 2026-11-25 01:28:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by xel1uz on 2026-11-25T01:28:37Z.


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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5483339641 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1486). Originally posted by [xel1uz](https://github.com/xel1uz) on 2026-11-25T01:28:37Z. --- Claimed in the coordination issue as: [GLB-INSPECT-MORPH-WEIGHT-COUNT](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7149426063) ### 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.
ytsodacan commented 2026-11-25 03:36:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ytsodacan on 2026-11-25T03:36:03Z.


[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.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152065914 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1486#issuecomment-7152065914). Originally posted by [ytsodacan](https://github.com/ytsodacan) on 2026-11-25T03:36:03Z. --- **[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.
zmasi commented 2026-11-28 20:43:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T20:43:24Z.


#1486 | head 89b4e9edf2 (merged cleanly with main 1bc055e6c2) | python -I tests/test_glb_inspect.py | red on main: FAILED (failures=8, skipped=6) (flagged valid multi-target LINEAR/STEP/CUBICSPLINE morph-weight outputs as mismatched, missed half-width outputs, missed shared-sampler width mismatches across meshes, and skipped primitives without targets on index 0) | green on PR+main: 45 ran, OK (skipped=6) (39/39 Windows-applicable tests OK) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yes

Audited tools/glb_inspect.py and tests/test_glb_inspect.py on Windows 11, verifying _morph_target_count across primitives, channel-scoped _check_output_count (keys * target_count * (3 if CUBICSPLINE else 1)) for SCALAR weights channels (including shared samplers across meshes with different morph-target counts and nodes lacking morph targets), plus tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), and scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245492851 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1486#issuecomment-7245492851). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T20:43:24Z. --- #1486 | head 89b4e9edf28ff76e0ed57dae8e2adbc4a00f381d (merged cleanly with main 1bc055e6c2) | `python -I tests/test_glb_inspect.py` | red on main: `FAILED (failures=8, skipped=6)` (flagged valid multi-target `LINEAR`/`STEP`/`CUBICSPLINE` morph-weight outputs as mismatched, missed half-width outputs, missed shared-sampler width mismatches across meshes, and skipped primitives without `targets` on index 0) | green on PR+main: `45 ran, OK (skipped=6)` (`39/39` Windows-applicable tests `OK`) | Windows 11 (`10.0.26200.9974`), Python 3.12.10 | AI-assisted: yes Audited `tools/glb_inspect.py` and `tests/test_glb_inspect.py` on Windows 11, verifying `_morph_target_count` across primitives, channel-scoped `_check_output_count` (`keys * target_count * (3 if CUBICSPLINE else 1)`) for `SCALAR` `weights` channels (including shared samplers across meshes with different morph-target counts and nodes lacking morph targets), plus `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), and `scripts/check_no_game_data.py`.
TheGeogeo commented 2026-11-29 00:17:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T00:17:26Z.


Tested 89b4e9edf merged (no commit) with main 829530dbd: Python 3.12.4, Windows 11 10.0.26300, CPU only. check_no_game_data.py is clean.

  • Green: tests/test_glb_inspect.py, 45 tests pass (1 skipped).
  • Red: with tools/glb_inspect.py back to main, 8 failures (e.g. 'channel[1]' not found in 'sampler[0] has 4 output values for 2 keys with LINEAR interpolation').

No blocker from my side.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248009161 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1486#issuecomment-7248009161). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T00:17:26Z. --- Tested `89b4e9edf` merged (no commit) with `main` `829530dbd`: Python 3.12.4, Windows 11 10.0.26300, CPU only. `check_no_game_data.py` is clean. - Green: `tests/test_glb_inspect.py`, 45 tests pass (1 skipped). - Red: with `tools/glb_inspect.py` back to `main`, 8 failures (e.g. `'channel[1]' not found in 'sampler[0] has 4 output values for 2 keys with LINEAR interpolation'`). No blocker from my side. AI-assisted (Claude Code).
MoonEyes commented 2026-11-29 00:45:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T00:45:08Z.


Merged after TheGeogeo's red/green check (check) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto main 8a35304fb without conflict, and its test file(s) (tests/test_glb_inspect.py) pass there. Earlier today the same tests failed on main without the PR (red/green) and a bundle with other open PRs showed no new failures. check_no_game_data.py is clean. Windows 11, Python 3.14; no GPU needed for these tests.

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248326542 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1486#issuecomment-7248326542). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T00:45:08Z. --- Merged after **TheGeogeo**'s red/green check ([check](https://github.com/ProjectLeonida/mandy/pull/1486#issuecomment-7248009161)) (Windows, Python tests, no GPU needed) and a local re-check here. Merged after local re-verification: this PR merged onto `main` 8a35304fb without conflict, and its test file(s) (`tests/test_glb_inspect.py`) pass there. Earlier today the same tests failed on `main` without the PR (red/green) and a bundle with other open PRs showed no new failures. `check_no_game_data.py` is clean. Windows 11, Python 3.14; no GPU needed for these tests. _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
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!1486
No description provided.