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

Open
github-bot wants to merge 1 commit from github-bot/gh-2335 into main AGit
Owner

@⁠syfyra on GitHub · 2026-11-26 14:01 UTC · original
syfyra:feat/studio-model-details → main · +170 −0 · 2 files · 1 commits · draft

Claimed in the coordination issue as: STUDIO-MODEL-DETAILS (#1608)

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

**@⁠syfyra** on GitHub · 2026-11-26 14:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2335) `syfyra:feat/studio-model-details` → `main` · +170 −0 · 2 files · 1 commits · draft Claimed in the coordination issue as: STUDIO-MODEL-DETAILS (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### 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)
The studio's stats panel gave a model's triangles, vertices and file
size. Checking an export needs the next layer too: how big the model is,
how many meshes and materials it has, and which textures each material
uses at what size. Add that to the panel, read from the loaded glTF
alone:

- the bounding-box size in metres (glTF units), three significant
  digits, so a ring and a building both read sensibly;
- meshes / materials / textures (GLTFLoader makes one mesh per glTF
  primitive; a texture used in two slots counts once);
- a collapsible list of the materials, each with the meshes using it
  and its texture slots with their sizes. A material with neither a
  texture nor vertex colours is marked "no texture", the flat-colour
  look of a texture the export lost.

In clay and normals mode the list keeps the model's own materials.
Names are escaped, the new labels follow the RU/EU switch, and a failed
or stale download leaves the shown model's details in place.

Tested: three new node tests in tests/test_viewer_studio.cjs (fail
before the change, pass after); in a browser with tools/gallery.py and
a synthetic .glb (two meshes sharing a textured material, an untextured
one, a vertex-coloured one).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:08:02 +00:00
Author
Owner

@⁠lixonik on GitHub · 2026-11-26 15:43 UTC · original · reviewed

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.

**@⁠lixonik** on GitHub · 2026-11-26 15:43 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2335#pullrequestreview-6076963694) · **reviewed** 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.
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/2335/head:github-bot/gh-2335'
git switch 'github-bot/gh-2335'

Merge

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