Skip to content

Editor: a page to select, move, turn and scale a scene's entities, with undo, driven by people or agents - #80

Merged
SamG-Coder merged 2 commits into
mainfrom
claude/editor-page
Nov 12, 2026
Merged

SamG-Coder merged 2 commits into
mainfrom
claude/editor-page

Conversation

@SamG-Coder

Copy link
Copy Markdown
Owner

What and why

The first working slice of the in-browser editor (docs/editor.md, phase 1). editor.html?scene=NAME opens a baked scene together with its project, and lets a person, or an agent through window.solstice, select, move, turn and scale what is in it, with undo.

  • Viewport. It uses Unreal's controls:
    • right-drag with WASD/QE flies, and the wheel while flying sets the fly speed;
    • Alt-drag orbits, middle-drag pans, the wheel zooms, and F frames the selection.
  • Picking. A click selects the exact object under the cursor. A new one-thread GPU pass (solstice-render/src/pick.rs, shaders/editor/pick.wgsl) reads it from the visibility buffer after the frame resolves. The pass is created on the first pick and recorded only on frames that ask, so the viewer pays nothing for it. Ctrl or Shift adds to the selection.
  • Gizmo. Move (arrows and planes), rotate (rings) and scale, on W, E and R:
    • world or local axes;
    • grid and angle snapping, with Ctrl reversing it while held;
    • several selected entities move together;
    • a drag shows as motion, then becomes one undo step;
    • the dragged instances are movable only during the drag, so cached shadows and GI redraw once at the end.
  • Panels.
    • The outliner shows the project's folders and entities, with search, hide and frame on double-click.
    • The details panel shows name, id, note, a transform with scrubbable fields, and the entity's component.
    • Below them are an output log and a status bar showing fps and frame time.
  • Saving.
    • Every change is one undo step (Ctrl+Z, Ctrl+Y), marked as made by the user or an agent.
    • A draft is kept in the browser (OPFS), and offered back on the next visit.
    • Ctrl+S saves the .scene through the File System Access API, or as a download.
    • The editor's JSON writer produces the same bytes as the Rust crate, so saving without an edit changes nothing.
  • Agent API.
    • window.solstice.call(name, args) returns { ok, result | error } and never throws.
    • help() gives every command's JSON Schema.
    • The 23 commands cover the scene, objects, selection, camera, pick, history, environment, stats, log, wait, project and gizmo.
    • Where the browser has WebMCP (navigator.modelContext), each command is also registered as a tool.
    • The reference is docs/editor-api.md.
  • Engine.
    • The scene file's SRCE map now also holds where the bake placed each entity, so the editor can move a model seated on the ground, or an actor, exactly. SRCE first merged in Editor projects: a JSON project format, and one build for scene text and projects #76 and no published scene carries it yet, so its layout is free to change.
    • The viewer's loader moved out of index.html into loader.js, which both pages use.
    • The editor is a third wasm build (feature editor) that only editor.html loads.
    • build-web.sh builds the editor and copies any assets/*.scene, and CI builds and lints the editor's wasm and runs its tests.
  • Design. The phases in docs/editor.md are reordered, as the user asked, around building scenes and games from blank terrain: a blank scene with an in-browser bake comes next, then trees, water and weather, then placing things, then scripting and play, then sculpting. Every tool is also an agent command.

No scene is converted or published here. The site's scenes carry no project yet, so on the site the editor lists each instance alone and can't save. Converting Cove and republishing it waits for the user.

Verified

Checked in Chrome on the RTX 5080, on Cove baked locally from its converted project (91 entities, 3,180 instances):

  • The editor draws Cove at about 210 fps (4.8 ms a frame) with no GPU errors. The viewer still loads and streams through the shared loader at 207 fps.
  • Through window.solstice, as an agent would:
    • find the statue, select it, frame it, move it 3 m, turn it 45°, read the stats, and undo;
    • a misspelt argument, an unknown id, a scale below 0.0001 and a position out of range each return a clear error.
  • With the mouse:
    • dragging the X arrow moved the statue along X only, snapped to the 0.5 m grid, as one undo step marked as the user's;
    • Ctrl+Z undid it;
    • clicking a wall selected it, showed it in the outliner and listed its two instances;
    • clicking the ground cleared the selection.
  • A seated boulder: moving it drops its seat for its baked height, and undo brings the seat back, with the saved text byte-identical.
  • In a hidden tab, pick fails after 5 s with not_drawing instead of hanging.

Tests:

  • node apps/viewer/web/editor/test.mjs (20 checks, also in CI):
    • the JS writer matches the Rust crate on a fixture with every kind of entity;
    • Euler angles round-trip, a pure yaw stays pure, and the rotation matches glam's;
    • the gizmo's arrow, ring and scale drags, driven by real camera rays;
    • argument checking and history.
  • solstice-project/tests/fixture.rs: the crate re-writes the same fixture unchanged.
  • The GPU test a_pick_finds_the_instance_under_a_point picks the left, middle and right balls and the sky, and checks the depth, on the 5080.
  • Workspace tests, clippy (workspace, and the editor's wasm build) and fmt all pass, rebased on Bake: one place for plants' materials; the circuit's grass and woods sway; circuit refuses land of its own #78.

Authorship

Written by: Claude Opus 5.5 through Claude Code

Reviewed by: Claude Sonnet 5.5. Nothing blocks merging. It verified:

  • the pick read-back can't wedge and copes with resizes;
  • the preview and undo snapshots;
  • the bake's range, owner and placement alignment;
  • no innerHTML anywhere, with every name, note and log line going in as text;
  • the editor adds nothing to the viewer's build;
  • the loader refactor keeps every query parameter and progress message.

Fixed from its points:

  • An edit tidied fields it didn't change.
  • A scale or position the renderer refuses was kept in the project anyway.
  • A pick answered late could be given to the next caller.
  • Undo was possible mid-drag.
  • Restoring a draft dropped names and notes.
  • The pick read assumed alignment.

Noted, not changed:

  • Moving a seated model sideways keeps its old height, as both editors do. Dropping it onto the ground (End) comes with the terrain tools.

  • Euler angles lose a fraction of a degree within 0.3° of straight up or down.

  • The JSON writer's exponent form differs from serde_json below 1e-5 and above 1e16, numbers the editor never makes.

  • A multi-selection turns and scales each entity about its own pivot.

  • All code, text and comments in this pull request were written by a frontier AI model, with no human-written code, and will be reviewed by a frontier AI model before merging, as the Code of Conduct requires.

🤖 Generated with Claude Code

SamG-Coder and others added 2 commits November 13, 2026 08:35
…th undo, driven by people or agents

editor.html opens a scene and its project. Its viewport flies, orbits and pans
as Unreal's does; a click picks the exact object under it, read from the GPU's
visibility buffer by a one-thread pass made only when the editor asks; a gizmo
moves, turns and scales with grid and angle snapping, in world or local axes;
the outliner and details panel follow the selection; every change is one undo
step; drafts are kept in the browser and the scene saved to a file, written
byte for byte as the bake writes it.

Every action is a command in one registry, which the panels, keyboard and
gizmo use and which agents call through window.solstice (and WebMCP where the
browser has it): docs/editor-api.md.

The scene file's map of entities now holds where the bake placed each, so the
editor moves a seated model or an actor exactly. The viewer's page and the
editor's share one loader, loader.js. The editor is its own wasm build, so the
viewer pays nothing for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tch late picks safely

From the review: an edit tidies only the fields it changed, so the rest are
saved as the file had them; a scale below 0.0001 or a position beyond
10 000 km is refused instead of drifting from what is drawn; a pick answered
after its caller gave up is dropped rather than given to the next; undo waits
for a drag to end; restoring a draft brings back names and notes too; the pick
is read back without assuming alignment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SamG-Coder
SamG-Coder merged commit 05fc704 into main Nov 12, 2026
1 check passed
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.

1 participant