BLOBBO/lanes/LANE-J-workshop-editor.md
type-two cabc60def8 Workshop plan + lane docs I (asset runtime) and J (editor)
Custom-GLB drop-in system: manifest/registry with procedural fallbacks,
IndexedDB override layer for zero-deploy playtesting, and a three-panel
in-browser fitting editor. Physics/visual decoupling makes every mesh
swappable; blob.body is the one paintable special case (UV requirements).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 15:30:09 +10:00

60 lines
3.5 KiB
Markdown

# Lane J — Workshop editor (drop-in asset fitting + export)
**Owns:** `src/editor/`, `editor.html` (repo root, sibling of index.html),
`demos/lane-j.html`, `src/demo/lane-j.ts`.
**Never touches:** contracts, world, game, main, package.json, other lanes'
dirs. Depends on Lane I's `src/assets/` API (manifest.ts, registry.ts) — it
runs in a parallel worktree, so code against the INTERFACES specified in
lanes/LANE-I-asset-runtime.md §Deliverables 1-2 exactly; integration reconciles.
No new deps (GLTFLoader ships inside three).
## Mission
A browser page where John drags his own GLB files onto game-object slots, fits
them (offset/rotation/scale), sees them ON the real course, saves them locally
so the LIVE game uses them instantly, and exports a manifest for committing.
docs/WORKSHOP-PLAN.md is the product spec — read it first.
## Deliverables
1. `editor.html` + `src/editor/main.ts` — three-panel layout (CSS grid, no framework):
- **Slots panel (left):** every slot from the plan's table with status
(procedural / custom / override-active). Click selects.
- **Stage (center):** the greybox course + idle machine visuals (import the
real builders; physics optional — a static scene is fine, but reuse real
meshes so fits are truthful). OrbitControls (three/examples/jsm). Selected
slot's object gets an outline/pulse. Camera-focus button per slot.
- **Fit panel (right):** for the selected slot — drop zone ("drop .glb"),
numeric inputs + sliders for offset xyz / rotation xyz / uniform scale,
reset-to-procedural button, and for `blob.body` the paintability report
(uvOk / tris / materials) with a red warning banner when uvOk=false.
2. Drag-drop flow: File API → store blob in IndexedDB (`blobbo-workshop`/`blobs`),
manifest entry url `idb:<key>` → registry hot-swaps the stage object live.
3. **Save locally** — writes the working manifest to the IndexedDB override the
game reads (Lane I load order). **Export** — downloads `manifest.json`
(idb urls flagged with a "commit the .glb files to assets/live/ and change
urls" note in the download's `_readme` field). **Clear overrides** button.
4. **Test drive** — button that opens `/blobbo/` in a new tab (overrides are in
IndexedDB, so the live game picks them up — say so in the UI).
5. Ship-it help card: Blender conventions from the plan doc + "to make it
permanent: assets/live/ + manifest.json + redeploy".
6. Demo `demos/lane-j.html`: the editor booted with a scripted fake-drop of
`assets/meshes/prop-spring-boot.glb` onto `machine.boot` (fetch → same code
path as a real drop), asserting the stage object swapped and the exported
manifest round-trips.
## Acceptance
- `npm run build` green (editor.html added to YOUR OWN vite input? NO — you
can't edit vite.config.ts; note it as friction, integration adds the input).
- Demo's scripted drop swaps the stage mesh and the export round-trips
(parse the downloaded JSON blob in-page and deep-equal it).
- Fit controls visibly transform the object; values persist through slot
switches; reset restores procedural.
- blob.body drop with the farm blobbo GLB shows the paintability report.
- Overrides survive reload (IndexedDB), and Clear removes them.
- Zero console errors on an empty session (no drops, all procedural).
## UX bar
This is John's tool: label everything in plain words, no dev jargon on screen.
It should feel like a toy, not an IDE — big drop targets, instant feedback,
one obvious happy path (pick slot → drop file → nudge sliders → Save locally →
Test drive).