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

Merged
xel1uz merged 1 commit from upstream-pr/1490 into main 2026-11-29 02:15:22 +00:00
xel1uz commented 2026-11-25 01:41:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by xel1uz on 2026-11-25T01:41:00Z.


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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5483468959 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1490). Originally posted by [xel1uz](https://github.com/xel1uz) on 2026-11-25T01:41:00Z. --- Claimed in the coordination issue as: [STUDIO-RESET-CAMERA-FIT](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7149690617) ### 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.
ytsodacan commented 2026-11-25 03:35:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ytsodacan on 2026-11-25T03:35:57Z.


[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.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152064099 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1490#issuecomment-7152064099). Originally posted by [ytsodacan](https://github.com/ytsodacan) on 2026-11-25T03:35:57Z. --- **[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.
kirigayakazima commented 2026-11-28 04:02:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-28T04:02:00Z.


#1490 | head 662f8c3df4 | node --test tests/test_viewer_studio.cjs | red: 13 tests, 12 passed, 1 failed (AssertionError: Reset Camera returns to the fitted view of the currently loaded model; expected [30, 24, 36], actual [0, 2, 5]) | green: 13 tests, 13 passed, 0 failed (148.7ms) | full suite: same as main (514/521 standalone stdlib tests passed, 0 new failures vs main 02f71ccfe7; compileall=0; node --test tests/test_viewer_streaming.cjs=0) | Windows 11, Python 3.14.7, Node v24.19.0, no game files | AI-assisted: yes, Antigravity (Gemini)

  • Clean merge onto main 02f71ccfe7; scripts/check_no_game_data.py passed (0).
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7233617449 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1490#issuecomment-7233617449). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-28T04:02:00Z. --- #1490 | head 662f8c3df41ae3ab611f245836c6eedb578fe5a6 | node --test tests/test_viewer_studio.cjs | red: 13 tests, 12 passed, 1 failed (AssertionError: Reset Camera returns to the fitted view of the currently loaded model; expected [30, 24, 36], actual [0, 2, 5]) | green: 13 tests, 13 passed, 0 failed (148.7ms) | full suite: same as main (514/521 standalone stdlib tests passed, 0 new failures vs main 02f71ccfe7; compileall=0; node --test tests/test_viewer_streaming.cjs=0) | Windows 11, Python 3.14.7, Node v24.19.0, no game files | AI-assisted: yes, Antigravity (Gemini) - Clean merge onto `main` `02f71ccfe7`; `scripts/check_no_game_data.py` passed (`0`).
zmasi commented 2026-11-29 01:07:51 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:07:51Z.


Independent verification on Windows 11 (10.0.26200, x64, Node.js v24.16.0, Python 3.12.10) with 662f8c3df4 merged onto origin/main (aa52446f7d, 0 merge conflicts):

  • Red (origin/main viewer/studio.html + #1490 tests/test_viewer_studio.cjs):
    • node --test tests/test_viewer_studio.cjs: rc=1 (12/13 passed, 1 failed in Reset Camera returns to the fitted view of the currently loaded model: actual: [0, 2, 5] vs expected: [30, 24, 36]).
  • Green (662f8c3df4 merged onto origin/main):
    • node --test tests/test_viewer_studio.cjs: 13/13 passed (241.3 ms).
    • Full .cjs viewer test run (tests/test_viewer_streaming.cjs + tests/test_viewer_studio.cjs): 70/70 passed (544.1 ms).
  • Hygiene: git diff --check, python -I scripts/check_no_game_data.py viewer/studio.html tests/test_viewer_studio.cjs, and python -I tests/test_text_write_line_endings.py (3/3) all exited 0.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248579655 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1490#issuecomment-7248579655). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T01:07:51Z. --- Independent verification on Windows 11 (`10.0.26200`, x64, `Node.js v24.16.0`, `Python 3.12.10`) with `662f8c3df4` merged onto `origin/main` (`aa52446f7d`, `0` merge conflicts): - **Red (`origin/main` `viewer/studio.html` + `#1490` `tests/test_viewer_studio.cjs`)**: - `node --test tests/test_viewer_studio.cjs`: `rc=1` (`12/13` passed, `1` failed in `Reset Camera returns to the fitted view of the currently loaded model`: `actual: [0, 2, 5]` vs `expected: [30, 24, 36]`). - **Green (`662f8c3df4` merged onto `origin/main`)**: - `node --test tests/test_viewer_studio.cjs`: `13/13` passed (`241.3 ms`). - Full `.cjs` viewer test run (`tests/test_viewer_streaming.cjs` + `tests/test_viewer_studio.cjs`): `70/70` passed (`544.1 ms`). - **Hygiene**: `git diff --check`, `python -I scripts/check_no_game_data.py viewer/studio.html tests/test_viewer_studio.cjs`, and `python -I tests/test_text_write_line_endings.py` (`3/3`) all exited `0`. AI-assisted.
OreoFR commented 2026-11-29 01:58:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T01:58:17Z.


Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Node v26.7.0, main 59e65849b, PR head 662f8c3df : red 1 failure / green 13 OK

node --test tests/test_viewer_studio.cjs:

  • Red (main + only this PR's test file): 13 tests (incl. subtests), 1 failed:
    • Reset Camera returns to the fitted view of the currently loaded model
  • Green (main + merge): 13/13 OK.
  • (MEASURED n=3) each failing test rerun alone 3 times: red 3/3 fail, green 3/3 pass.
  • Skipped: none (skip 0, todo 0). No npm dependencies (CI runs node --test tests/test_*.cjs).
  • Merge: clean (git merge --no-ff onto main). The PR's test file is not older than main's, so the red run is the plain one.

Verdict: READY

AI-assisted: Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249129038 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1490#issuecomment-7249129038). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T01:58:17Z. --- Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Node v26.7.0, main 59e65849b, PR head 662f8c3df : red 1 failure / green 13 OK `node --test tests/test_viewer_studio.cjs`: - **Red** (main + only this PR's test file): 13 tests (incl. subtests), 1 failed: - `Reset Camera returns to the fitted view of the currently loaded model` - **Green** (main + merge): 13/13 OK. - (MEASURED n=3) each failing test rerun alone 3 times: red 3/3 fail, green 3/3 pass. - Skipped: none (skip 0, todo 0). No npm dependencies (CI runs `node --test tests/test_*.cjs`). - Merge: clean (`git merge --no-ff` onto main). The PR's test file is not older than main's, so the red run is the plain one. **Verdict: READY** AI-assisted: Claude Code
MoonEyes commented 2026-11-29 02:15:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T02:15:25Z.


Merged after OreoFR's red/green check (check) (macOS 27.2.1, Apple M5) and a local re-check here. Merged after local re-verification: this PR merged onto main b44eece29 without conflict, and its test file(s) (tests/test_viewer_studio.cjs) pass there. Earlier today the same tests failed on main without the PR (red/green) and a bundle with other open PRs showed no new failures. check_no_game_data.py is clean. Windows 11, Python 3.14; no GPU needed for these tests.

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249310529 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1490#issuecomment-7249310529). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T02:15:25Z. --- Merged after **OreoFR**'s red/green check ([check](https://github.com/ProjectLeonida/mandy/pull/1490#issuecomment-7249129038)) (macOS 27.2.1, Apple M5) and a local re-check here. Merged after local re-verification: this PR merged onto `main` b44eece29 without conflict, and its test file(s) (`tests/test_viewer_studio.cjs`) pass there. Earlier today the same tests failed on `main` without the PR (red/green) and a bundle with other open PRs showed no new failures. `check_no_game_data.py` is clean. Windows 11, Python 3.14; no GPU needed for these tests. _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
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!1490
No description provided.