Skip to content

studio: the Textures tab shows the texture gallery (the models panel was never hidden) - #8170

Closed
Jun2028 wants to merge 1 commit into
ItsNotRexed:mainfrom
Jun2028:studio-textures-tab
Closed

Jun2028 wants to merge 1 commit into
ItsNotRexed:mainfrom
Jun2028:studio-textures-tab

Conversation

@Jun2028

@Jun2028 Jun2028 commented Nov 23, 2026

Copy link
Copy Markdown

Claim: #8047 (comment) (new Studio item, not on the list)

Problem

In viewer/studio.html (served by tools/gallery.py) the Textures tab never shows the texture gallery. The tab button lights up, /api/textures and the previews load, and the page keeps showing the model list and the 3D view.

switchTab hides a panel by removing its active class, relying on .view-panel { display: none; }. But #models-view { ...; display: flex; } is an ID selector and outranks that class rule, so the models panel is never hidden. Both panels are width: 100% in a flex row with overflow: hidden, so the gallery is laid out to the right of the page.

Measured on main dde82f2 in Chromium (Windows 11), python -I tools/gallery.py --models-dir … --textures-dir … with hand-made files (6 one-triangle glTF/GLB models, 3 8×8 PNGs), viewport 1025 px, after clicking the tab:

#models-view #textures-view
main display: flex, x = 0, width 1025 display: flex, x = 1025, width 48 (3 cards loaded, off-screen)
this PR display: none display: flex, x = 0, width 1025 (3 cards visible)

Switching back to 3D Модели on this PR: models panel flex at full width, gallery none, canvas 685×699 (the existing onWindowResize() call in switchTab).

Change

One declaration: display: flex is removed from #models-view. The panel already has class="view-panel active", so .view-panel.active { display: flex; } gives it the same layout when its tab is active.

Tests

  • tests/test_viewer_studio.cjs: new case that reads the page's <style> block and checks that .view-panel is display: none, .view-panel.active is display: flex, and that no #<panel id> rule of a view-panel section sets display. It fails on main (#models-view must not set display) and passes here.
  • node --test tests/test_viewer_studio.cjs: 10 of 10 pass. python -I tests/test_gallery.py: OK.
  • In a real browser, as in the table above. For that run the three.js files were placed in an untracked viewer/vendor/ (a checkout without them shows no models at all, which is Studio: load the CDN copy of three.js while parsing, so a checkout without viewer/vendor shows its models #7681's subject, not this PR's).
  • python -I scripts/check_no_game_data.py on both files: clean.

Windows 11, Node 22.20, Python 3.13. CPU only; no game files (RTX 3080 in the machine, used only by the browser's WebGL). Not run: the other Python suites, runtime/CMake and GPU tests — none read these files.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

#models-view set display: flex with an ID selector, which outranks
.view-panel { display: none }, so the models panel stayed visible when
another tab was active and the gallery was laid out beside it, off-screen.
The panel now follows .view-panel / .active like the textures panel.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

@devnull34 devnull34 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified via Tier 2 Free Cloud (Groq gpt-oss-120b): Adjusting CSS specificity so #models-view respects .view-panel.active allows the Textures tab to hide the models view panel cleanly without pushing the gallery off-screen.

@Jun2028

Jun2028 commented Nov 23, 2026

Copy link
Copy Markdown
Author

Correction: this overlaps #6432 (@Racurs156, opened about four hours earlier), which removes the same display: flex from #models-view and also guards the resize handler against a zero-size canvas. My search before claiming missed it, so the line "No open PR touches that rule" in the claim was wrong. #6432 was first and covers more; if it merges, this one should be closed. What this PR adds over it is only the real-browser measurement (the gallery at x=1025, 48 px wide at a 1025 px viewport) and a CSS-level test, either of which #6432 is welcome to take. AI-assisted (Claude Code).

@Jun2028

Jun2028 commented Nov 23, 2026

Copy link
Copy Markdown
Author

Closing in favour of #6432, which made the same change first and also guards the resize handler. The CSS-level test and the browser measurements here are free to reuse there. AI-assisted (Claude Code).

@Jun2028 Jun2028 closed this Nov 23, 2026
@Atomic258

Copy link
Copy Markdown
Contributor

Tested 53261d4a on Windows Server 2022, CPython 3.13.12 / Node 24: pass

  • node --test tests/test_viewer_studio.cjs -> 10 tests, 10 pass

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. AI-assisted (Devin).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants