studio: reset the camera to the current model's fitted view #1490

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

@⁠xel1uz on GitHub · 2026-11-25 01:41 UTC · original
xel1uz:fix/studio-reset-camera → main · +36 −6 · 2 files · 1 commits · open

Claimed in the coordination issue as: STUDIO-RESET-CAMERA-FIT

What and why

Load a large model in Studio, orbit or pan away, then click Reset Camera. On main the camera returns to the position captured when Studio initialized. With a 20-unit cube, the model initially fits at (30, 24, 36) but Reset moves the camera to (0, 2, 5), inside the cube.

Save the OrbitControls state after a successful model load fits the camera and updates its target. Reset now returns to the fitted view of the displayed model, including after switching models.

Tested

  • Ran the new regression against the original viewer/studio.html at 5a5df8e0b6. It failed at the first reset (expected the fitted view, got the startup position). With this change the test restores both the camera position and the orbit target after each of two model loads.
  • Clicked the toolbar button in headless Chrome 158 on Windows using the pinned Three.js r128 and real GLTFLoader. After moving the camera and panning, Reset restored the 20-unit GLB cube to (30, 24, 36) and the 6-unit cube to (9, 7.2, 10.8), both looking at the origin. On the original page the same clicks returned both cubes to (0, 2, 5). Both GLBs were generated locally.
  • node --test "tests/test_*.cjs" (Node 24.18.0): 70 passed, including all 13 Studio tests.
  • python -I scripts/run_semantic_tests.py tests/semantic -j 12: 6,223 tests across 476 files, zero failing files (396 s).
  • git diff --check and python -I scripts/check_no_game_data.py viewer/studio.html tests/test_viewer_studio.cjs passed.

GPUs tested: Chrome used ANGLE/Vulkan SwiftShader (software rendering) on Windows. No physical GPU tested.
AI-assisted: Yes.

Checklist

  • Based on upstream main at 5a5df8e0b6.
  • One topic.
  • No game data, keys or decryption.
  • Translator contract table: N/A. This changes the Studio camera.
**@⁠xel1uz** on GitHub · 2026-11-25 01:41 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1490) `xel1uz:fix/studio-reset-camera` → `main` · +36 −6 · 2 files · 1 commits · open Claimed in the coordination issue as: [STUDIO-RESET-CAMERA-FIT](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why Load a large model in Studio, orbit or pan away, then click **Reset Camera**. On `main` the camera returns to the position captured when Studio initialized. With a 20-unit cube, the model initially fits at `(30, 24, 36)` but Reset moves the camera to `(0, 2, 5)`, inside the cube. Save the OrbitControls state after a successful model load fits the camera and updates its target. Reset now returns to the fitted view of the displayed model, including after switching models. ### Tested - Ran the new regression against the original `viewer/studio.html` at `5a5df8e0b6`. It failed at the first reset (expected the fitted view, got the startup position). With this change the test restores both the camera position and the orbit target after each of two model loads. - Clicked the toolbar button in headless Chrome 158 on Windows using the pinned Three.js r128 and real GLTFLoader. After moving the camera and panning, Reset restored the 20-unit GLB cube to `(30, 24, 36)` and the 6-unit cube to `(9, 7.2, 10.8)`, both looking at the origin. On the original page the same clicks returned both cubes to `(0, 2, 5)`. Both GLBs were generated locally. - `node --test "tests/test_*.cjs"` (Node 24.18.0): 70 passed, including all 13 Studio tests. - `python -I scripts/run_semantic_tests.py tests/semantic -j 12`: 6,223 tests across 476 files, zero failing files (396 s). - `git diff --check` and `python -I scripts/check_no_game_data.py viewer/studio.html tests/test_viewer_studio.cjs` passed. GPUs tested: Chrome used ANGLE/Vulkan SwiftShader (software rendering) on Windows. No physical GPU tested. AI-assisted: Yes. ### Checklist - [x] Based on upstream `main` at `5a5df8e0b6`. - [x] One topic. - [x] No game data, keys or decryption. - Translator contract table: N/A. This changes the Studio camera.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:53:51 +00:00
Author
Owner

@⁠ytsodacan on GitHub · 2026-11-25 03:35 UTC · original · edited 2026-11-25 03:43 UTC

[KEEP]

  • The fix is small and plausible: viewer/studio.html adds controls.saveState() after the model-fit camera/target update, so Reset Camera returns to the fitted view. tests/test_viewer_studio.cjs adds a regression covering two consecutive model loads.
  • gh pr checks reports no checks on fix/studio-reset-camera and the merge state is UNSTABLE, so CI has not confirmed the author's reported local results (70 node tests, semantic suite).
  • No duplicate PR found. Re-triage once CI runs green; this looks mergeable after that.
**@⁠ytsodacan** on GitHub · 2026-11-25 03:35 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1490#issuecomment-7152064099) · edited 2026-11-25 03:43 UTC **[KEEP]** - The fix is small and plausible: `viewer/studio.html` adds `controls.saveState()` after the model-fit camera/target update, so Reset Camera returns to the fitted view. `tests/test_viewer_studio.cjs` adds a regression covering two consecutive model loads. - `gh pr checks` reports no checks on `fix/studio-reset-camera` and the merge state is UNSTABLE, so CI has not confirmed the author's reported local results (70 node tests, semantic suite). - No duplicate PR found. Re-triage once CI runs green; this looks mergeable after that.
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/1490/head:github-bot/gh-1490'
git switch 'github-bot/gh-1490'

Merge

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