[PR #1486] glb_inspect: count animation weights per mesh morph target #1515

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1486
Author: @xel1uz
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/glb-inspect-morph-weight-count


📝 Commits (2)

  • 1548519 glb_inspect: count animation weights per mesh morph target
  • 89b4e9e Merge branch 'ubiquitarianism:main' into fix/glb-inspect-morph-weight-count

📊 Changes

2 files changed (+103 additions, -7 deletions)

View changed files

📝 tests/test_glb_inspect.py (+68 -0)
📝 tools/glb_inspect.py (+35 -7)

📄 Description

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.

🔄 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/1486 **Author:** [@xel1uz](https://github.com/xel1uz) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/glb-inspect-morph-weight-count` --- ### 📝 Commits (2) - [`1548519`](https://github.com/ubiquitarianism/leonida/commit/1548519aee782ec75868625d58b54f04152220bb) glb_inspect: count animation weights per mesh morph target - [`89b4e9e`](https://github.com/ubiquitarianism/leonida/commit/89b4e9edf28ff76e0ed57dae8e2adbc4a00f381d) Merge branch 'ubiquitarianism:main' into fix/glb-inspect-morph-weight-count ### 📊 Changes **2 files changed** (+103 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_glb_inspect.py` (+68 -0) 📝 `tools/glb_inspect.py` (+35 -7) </details> ### 📄 Description 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. --- <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#1515
No description provided.