studio: list the shown model's size, meshes, materials and textures (STUDIO-MODEL-DETAILS) #2335

Merged
syfyra merged 1 commit from upstream-pr/2335 into main 2026-12-01 15:19:07 +00:00
syfyra commented 2026-11-26 14:01:53 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by syfyra on 2026-11-26T14:01:53Z.


Claimed in the coordination issue as: STUDIO-MODEL-DETAILS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193990202)

What and why

A feature for the 3D studio (viewer/studio.html, served by tools/gallery.py). Its stats panel gave a model's triangles, vertices and file size. Checking an export needs the next layer too: how big the model came out, how many meshes and materials it has, and which textures each material uses at what size. The panel now shows that, read from the loaded glTF alone:

  • Size (W × H × D): the bounding box in metres (glTF units), three significant digits, so a ring reads 0.0215 m and a building 48.3 m. A wrong scale, or a model exported in centimetres, shows at once.
  • Meshes / materials / textures: GLTFLoader makes one mesh per glTF primitive, so the first number is the draw-call count; a texture used in two slots counts once.
  • Materials and textures (collapsible, scrolls when long): each material with the number of meshes using it and every texture slot it fills with that texture's size (map 1024×512, normalMap 512×512). A material with neither a texture nor vertex colours is marked no texture in the accent colour: that flat-colour look is often a texture the export lost. Vertex-coloured materials say so instead.

Details:

  • In clay and normals mode the list keeps the model's own materials (from userData.origMaterial, as disposeModel does), not the studio clay.
  • Material names come from the file and are escaped, like the model and texture names.
  • The new labels follow the RU/EU switch. (The five existing labels of the panel are hard-coded Russian and do not follow it; that is a separate fix.)
  • A failed or stale download leaves the shown model and its details in place, as it does for the other stats.
  • The new lines in loadModel sit next to the other stats, so this merges cleanly with the open studio PRs that edit the camera fit (#1490, #2136) and the others on this file (#1138, #2100, #2250).

Tested

Windows 11, Node 26.12.1, Chromium (app browser pane). No game files:

  • node --test tests/test_viewer_studio.cjs: 15 pass. Three new tests on synthetic objects: the size, counts and per-material texture list of a model with a shared textured material, an untextured one, a vertex-coloured one, a texture without an image (?) and a non-mesh node, loaded in clay mode; hostile material names render as text and the details follow setLanguage('eu'); the panel before any model, after a stale load, after a failed load (unchanged) and for an empty model (list hidden). The three fail on main (the panel has no such fields); the 12 existing tests pass. tests/test_viewer_streaming.cjs, tests/test_gallery.py and tests/test_viewer_cdn_integrity.py also pass.
  • In the browser: python -I tools/gallery.py --models-dir <dir> with a synthetic 2.9 KB .glb written by a stdlib script (three glTF meshes, one with two primitives; materials Body with a 64×32 base colour and a 32×32 normal texture on two meshes, an unnamed flat one, Decals<b> with COLOR_0). The panel showed 4.5 × 1.4 × 0.0215 m, 4 / 3 / 2 and the three materials as expected in RU and EU, with the name escaped; no console errors besides the existing /vendor/ 404s that fall back to the CDN.
  • scripts/check_no_game_data.py on both files.

GPUs tested: n/a (no GPU-specific code; WebGL in the browser pane)

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5511415139 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2335). Originally posted by [syfyra](https://github.com/syfyra) on 2026-11-26T14:01:53Z. --- Claimed in the coordination issue as: STUDIO-MODEL-DETAILS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193990202) ### What and why A feature for the 3D studio (`viewer/studio.html`, served by `tools/gallery.py`). Its stats panel gave a model's triangles, vertices and file size. Checking an export needs the next layer too: how big the model came out, how many meshes and materials it has, and which textures each material uses at what size. The panel now shows that, read from the loaded glTF alone: - **Size (W × H × D)**: the bounding box in metres (glTF units), three significant digits, so a ring reads `0.0215 m` and a building `48.3 m`. A wrong scale, or a model exported in centimetres, shows at once. - **Meshes / materials / textures**: GLTFLoader makes one mesh per glTF primitive, so the first number is the draw-call count; a texture used in two slots counts once. - **Materials and textures** (collapsible, scrolls when long): each material with the number of meshes using it and every texture slot it fills with that texture's size (`map 1024×512`, `normalMap 512×512`). A material with neither a texture nor vertex colours is marked **no texture** in the accent colour: that flat-colour look is often a texture the export lost. Vertex-coloured materials say so instead. Details: - In clay and normals mode the list keeps the model's own materials (from `userData.origMaterial`, as `disposeModel` does), not the studio clay. - Material names come from the file and are escaped, like the model and texture names. - The new labels follow the RU/EU switch. (The five existing labels of the panel are hard-coded Russian and do not follow it; that is a separate fix.) - A failed or stale download leaves the shown model and its details in place, as it does for the other stats. - The new lines in `loadModel` sit next to the other stats, so this merges cleanly with the open studio PRs that edit the camera fit (#1490, #2136) and the others on this file (#1138, #2100, #2250). ### Tested Windows 11, Node 26.12.1, Chromium (app browser pane). No game files: - `node --test tests/test_viewer_studio.cjs`: 15 pass. Three new tests on synthetic objects: the size, counts and per-material texture list of a model with a shared textured material, an untextured one, a vertex-coloured one, a texture without an image (`?`) and a non-mesh node, loaded in clay mode; hostile material names render as text and the details follow `setLanguage('eu')`; the panel before any model, after a stale load, after a failed load (unchanged) and for an empty model (list hidden). The three fail on `main` (the panel has no such fields); the 12 existing tests pass. `tests/test_viewer_streaming.cjs`, `tests/test_gallery.py` and `tests/test_viewer_cdn_integrity.py` also pass. - In the browser: `python -I tools/gallery.py --models-dir <dir>` with a synthetic 2.9 KB `.glb` written by a stdlib script (three glTF meshes, one with two primitives; materials `Body` with a 64×32 base colour and a 32×32 normal texture on two meshes, an unnamed flat one, `Decals<b>` with `COLOR_0`). The panel showed `4.5 × 1.4 × 0.0215 m`, `4 / 3 / 2` and the three materials as expected in RU and EU, with the name escaped; no console errors besides the existing `/vendor/` 404s that fall back to the CDN. - `scripts/check_no_game_data.py` on both files. GPUs tested: n/a (no GPU-specific code; WebGL in the browser pane) AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
lixonik commented 2026-11-26 15:43:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T15:43:57Z.

Review: COMMENTED


Windows 11/Node: 15/15 Studio tests passed, including details following the displayed model, failed loads preserving it and empty material lists being hidden. No findings.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6076963694 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2335#pullrequestreview-6076963694). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T15:43:57Z. **Review:** COMMENTED --- Windows 11/Node: 15/15 Studio tests passed, including details following the displayed model, failed loads preserving it and empty material lists being hidden. No findings. AI-assisted.
aslan2142 commented 2026-12-01 11:50:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:50:58Z.

Review: COMMENTED


Draft review note: STUDIO-MODEL-DETAILS (viewer/studio.html, tests/test_viewer_studio.cjs) is cleanly scoped, mergeable on main, and passed independent Node studio testing, but remains a draft with no CI run. Please run CI to green and mark ready for review when ready.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130676007 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2335#pullrequestreview-6130676007). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:50:58Z. **Review:** COMMENTED --- Draft review note: `STUDIO-MODEL-DETAILS` (`viewer/studio.html`, `tests/test_viewer_studio.cjs`) is cleanly scoped, mergeable on `main`, and passed independent Node studio testing, but remains a draft with no CI run. Please run CI to green and mark ready for review when ready. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 12:29:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:29:13Z.


Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7311200040 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2335#issuecomment-7311200040). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:29:13Z. --- Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 commented 2026-12-01 13:05:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T13:05:32Z.

Review: APPROVED


Now ready for review and MERGEABLE. Clean-room verified: displaying model bounding dimensions, mesh/material/texture counts, and escaped material details in viewer/studio.html with Node tests in tests/test_viewer_studio.cjs is clean and verified (@lixonik).

Approving — ready to merge once CI runs green on current main.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6131817855 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2335#pullrequestreview-6131817855). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T13:05:32Z. **Review:** APPROVED --- Now ready for review and `MERGEABLE`. Clean-room verified: displaying model bounding dimensions, mesh/material/texture counts, and escaped material details in `viewer/studio.html` with Node tests in `tests/test_viewer_studio.cjs` is clean and verified (`@lixonik`). Approving — ready to merge once CI runs green on current `main`. *(AI-assisted review.)*
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!2335
No description provided.