studio: reset the camera to the current model's fitted view #1490
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1490"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
mainthe 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
viewer/studio.htmlat5a5df8e0b6. 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.(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 --checkandpython -I scripts/check_no_game_data.py viewer/studio.html tests/test_viewer_studio.cjspassed.GPUs tested: Chrome used ANGLE/Vulkan SwiftShader (software rendering) on Windows. No physical GPU tested.
AI-assisted: Yes.
Checklist
mainat5a5df8e0b6.Imported from ubiquitarianism/leonida. Originally posted by ytsodacan on 2026-11-25T03:35:57Z.
[KEEP]
viewer/studio.htmladdscontrols.saveState()after the model-fit camera/target update, so Reset Camera returns to the fitted view.tests/test_viewer_studio.cjsadds a regression covering two consecutive model loads.gh pr checksreports no checks onfix/studio-reset-cameraand the merge state is UNSTABLE, so CI has not confirmed the author's reported local results (70 node tests, semantic suite).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 main02f71ccfe7; 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)main02f71ccfe7;scripts/check_no_game_data.pypassed (0).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) with662f8c3df4merged ontoorigin/main(aa52446f7d,0merge conflicts):origin/mainviewer/studio.html+#1490tests/test_viewer_studio.cjs):node --test tests/test_viewer_studio.cjs:rc=1(12/13passed,1failed inReset Camera returns to the fitted view of the currently loaded model:actual: [0, 2, 5]vsexpected: [30, 24, 36]).662f8c3df4merged ontoorigin/main):node --test tests/test_viewer_studio.cjs:13/13passed (241.3 ms)..cjsviewer test run (tests/test_viewer_streaming.cjs+tests/test_viewer_studio.cjs):70/70passed (544.1 ms).git diff --check,python -I scripts/check_no_game_data.py viewer/studio.html tests/test_viewer_studio.cjs, andpython -I tests/test_text_write_line_endings.py(3/3) all exited0.AI-assisted.
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 head662f8c3df: red 1 failure / green 13 OKnode --test tests/test_viewer_studio.cjs:Reset Camera returns to the fitted view of the currently loaded modelnode --test tests/test_*.cjs).git merge --no-ffonto 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
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
mainb44eece29without conflict, and its test file(s) (tests/test_viewer_studio.cjs) pass there. Earlier today the same tests failed onmainwithout the PR (red/green) and a bundle with other open PRs showed no new failures.check_no_game_data.pyis clean. Windows 11, Python 3.14; no GPU needed for these tests.AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.