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

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2335
Author: @syfyra
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: feat/studio-model-details


📝 Commits (1)

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

📊 Changes

2 files changed (+170 additions, -0 deletions)

View changed files

📝 tests/test_viewer_studio.cjs (+81 -0)
📝 viewer/studio.html (+89 -0)

📄 Description

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


🔄 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/2335 **Author:** [@syfyra](https://github.com/syfyra) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/studio-model-details` --- ### 📝 Commits (1) - [`d83cee9`](https://github.com/ubiquitarianism/leonida/commit/d83cee900cfc2bb65ab303b2f22d8713bde5a7a8) studio: list the shown model's size, meshes, materials and textures (STUDIO-MODEL-DETAILS) ### 📊 Changes **2 files changed** (+170 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_viewer_studio.cjs` (+81 -0) 📝 `viewer/studio.html` (+89 -0) </details> ### 📄 Description 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) --- <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#2339
No description provided.