Stair exposes three paintable slots — treads / body / railing (railing only
when railingMode != none) — on node.slots. The 2-material-index body mesh
maps materialIndex 0->treads, 1->body via userData.slotIds; railing meshes
tag userData.slotId='railing'. Per-slot resolution layers over the viewer's
base body/railing materials only in textures-on mode: node.slots ref ->
legacy per-part field (preserved) -> declared default (treads wood-woodplank48,
body wood-woodfine2, railing metal-steel). A custom preview swaps the targeted
body material-array index and whole-mesh railing materials. Monochrome
unchanged. Stops using DEFAULT_STAIR_MATERIAL.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fence joins the node.slots paint model with one paintable 'surface' slot
(merged post/base/rail geometry is a single mesh). Resolution order matches
slab: textures-off joinery role -> node.slots.surface ref -> legacy inline
material/preset -> declared default (library:wood-finewood27). Tags the mesh
userData.slotId='surface' and wires capabilities.slots + paint. Stops
borrowing DEFAULT_STAIR_MATERIAL.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the flat #e5e5e5 placeholder on the roof shingle surface (material
index 3) with the catalog roof-weatheredshingles finish via
resolveSlotDefaultMaterial. Wall/trim, deck, and interior surfaces and the
textures-off role array are unchanged. Roof keeps its existing per-segment
role material system (no node.slots migration).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pre-adds the unified slot-ref field (Record<slotId, MaterialRef>) to the
four kinds being migrated onto the paint-slot model, so per-kind work can
proceed in parallel worktrees without cross-package core edits.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Remove height/displacement/mask/mortar/joint texture files the material
schema never samples (it reads only albedo/normal/roughness/ao/metalness).
Computed as present-on-disk minus catalog-referenced in material-library.ts.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the editor-only EditorEnvironment wrapper with a SceneEnvironment
component exported from @pascal-app/viewer, mounted as an opt-in <Viewer>
child (still not baked into the Viewer component). One source of truth the
editor and the community public viewer both inject; embed/thumbnail
surfaces simply don't mount it. Sunset preset at environmentIntensity 0.6.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Inject an EditorEnvironment wrapper (drei prefiltered sunset HDRI at
environmentIntensity 0.6) as a child of the editor Viewer, not baked into
the Viewer component, so read-only/embed viewers stay lightweight. This
gives PBR metals their reflections and lifts lighting on vertical walls
that flat directional + hemisphere lights cannot.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Builds on the explicit per-mesh slot tagging (currentDoorSlot/currentWindowSlot):
- Per-part painting: door = panel/frame/glass/hardware, window = frame/glass,
each independently paintable. The recessed door/window body sits behind the
wall, so the proud invisible cutout wins the scene raycast over the wall and
the shared resolveSlotByReRaycast() re-raycasts the kind's own subtree to pick
the exact part under the cursor (panel↔frame↔glass↔hardware). Hover tracks the
cursor via a re-eval (idempotent, no flicker).
- Door frame is its own slot (separate frameMaterial); hardware = new flat
'metal-chrome'.
- Library defaults (generic): panel/frame -> library:preset-softwhite, glass ->
library:preset-glass (flipped preset-glass to FrontSide — DoubleSide poisons
the WebGPU MRT pass; it's the only glass we use).
- Catalog: add flat (non-PBR) 'metal-chrome' + 'metal-brass'; drop metal
metalness 1 -> 0.6 so metals are lit by existing lights (no env needed).
- World-scale UVs (1 unit = 1m) on door/window box meshes via shared box-uv.ts,
so finishes tile at real-world scale instead of stretching.
- PaintResolveArgs gains an optional for subtree re-raycasting.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The real interceptor was the 'cutout' mesh, not the hitbox: it's a 1m-deep CSG
helper whose front face sits 0.5m proud of the glass, and current three.js
raycasts invisible meshes — so every paint/hover ray resolved to 'cutout'
(no slotId → role null). Disable its raycast; combined with the hitbox noop,
paint/hover rays now land on the tagged frame/glass (panel/glass) children.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- post-processing: hoverHighlightMode was a dependency of the pipeline-build
effect, so every hover rebuilt the entire pipeline. The hover style is already
pushed to uniforms in a separate effect, so the rebuild was pure waste —
removed it from the deps (and the build log).
- selection-manager: temporary [paint-debug] logs for window/door hover to trace
why their paint dispatch drops (to be removed once diagnosed).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The window/door root is an invisible hitbox the system gives full-depth
BoxGeometry; its front face intercepted every paint/hover ray, so the hit
resolved to the hitbox (no slotId) → role null → paint silently disabled.
Disable the hitbox's own raycast in the visual path so R3F's recursive
intersect returns the tagged frame/glass (panel/glass) children instead;
selection still works because those child hits bubble to the root's event
handlers. Restored to the default raycast each build, and kept for 'opening'
windows/doors (no visuals to paint, still need a selectable hitbox). The
'cutout' child is visible=false so the raycaster already skips it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Windows and doors build all visuals in their viewer systems from module-global
materials, so this threads per-node slot materials + userData.slotId tags
through those builders without restructuring them:
- window: 'frame' + 'glass' slots. door: 'panel' (body = casing + leaf) +
'glass'; the opening reveal keeps its own material.
- Each system captures per-frame viewer state, then updateWindow/DoorMesh points
the builder-facing base/glass materials at the node's resolved slot override
(recomputed per node, so the next node resets without a restore). Meshes are
auto-tagged in the shared addBox/addShape helpers by which material they got.
- Textures-off still collapses to the role material (escape hatch); a slot
override only applies in colored mode.
- Editing a referenced scene material re-dirties the window/door (these systems
aren't covered by GeometrySystem's scene-material re-dirty).
- New paint capabilities (resolve role from userData.slotId, preview by
userData.slotId) + capabilities.slots; window/door dropped from the paint
disabled list. Shared previewSlotByUserData helper.
Defaults unchanged: unpainted windows/doors render exactly as before (the slot
fallback is the existing frame/glass material), so no visual regression.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Brings slab, ceiling, and wall onto the unified slot contract the shelf
established, so each declares its paintable slots with a declarative default and
(slab/ceiling) is painted through the registry capabilities.paint dispatch.
- Shared helper packages/nodes/src/shared/slot-paint.ts: a node.slots-based
PaintCapability factory (commit/resolve/effective generic; preview injected).
Distinct from surface-paint.ts, which writes the legacy inline node.material.
- slab: schema slots; def.geometry resolves node.slots.surface -> legacy
material -> declared default, tags the mesh userData.slotId; slabPaint +
capabilities.slots. Retires DEFAULT_SLAB_MATERIAL in the slab path.
- ceiling: schema slots; material builders extracted to ceiling/materials.ts
(shared by renderer + paint preview, built BackSide so the hover preview is
visible from below); renderer resolves the slot; ceilingPaint + slots.
- wall: WALL_SLOT_DEFAULT in core; the viewer's getMaterialsForWall renders an
unpainted face with its declared default instead of the themed wall role;
capabilities.slots (interior/exterior). wallPaint's inline interior/exterior
fields are unchanged (node.slots migration is a later step).
- selection-manager + material-paint: drop slab/ceiling from the legacy
single-surface arms (now registry-driven).
Behavior change (intended, matches the shelf precedent + the phase-5 plan):
colored-mode UNPAINTED slab/ceiling/wall surfaces now render their fixed slot
default (#e5e5e5 / #f5f5dc / #ffffff) instead of the theme role colour. The
textures-off (monochrome) role collapse is unchanged — the escape hatch.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wire KTX2 into the catalog finish path and add 15 textured finishes across four
new families, all as GPU-compressed KTX2 (512px) + a webp picker thumbnail.
- Shared `ktx2-loader.ts`: one KTX2Loader (Basis transcoder) used by both the
GLB loader and catalog textures; `ensureKtx2Support(renderer)` runs once at
viewer init (GPUDeviceWatcher) so `.ktx2` finishes load even with no GLB in
the scene. `use-gltf-ktx2` now reuses the shared instance.
- `materials.ts`: texture loaders pick the KTX2 loader for `.ktx2` urls, the
image loader otherwise (all three load paths).
- `material-library.ts`: 15 entries (fabric ×6, leather ×2, concrete ×4,
metal ×3). Neutral albedo for tinting, `flipY: false` (compressed textures
can't flip), `repeat` per real-world tile size, metals `metalness: 1`.
Normals encoded UASTC, data maps ETC1S/linear.
Assets generated from raw sources via the new community
`scripts/build-material-textures.ts`. 1024/256 tiers + raws kept out of git.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Cubby without a bottom board: the lowest cell opens onto the floor, but its
column divider still started at the (missing) bottom board's top, leaving it
floating ~thickness above the floor. Anchor it at y=0 when there's no bottom.
- Bookshelf full-height divider: it crosses the continuous shelves, so it can't
share their depth plane (proud at the front, coplanar with the back panel —
z-fighting down the centre back). Recess its depth to sit fully INSIDE the
boards' depth: embedded at each shelf crossing (board occludes it) and tucked
inside the back panel.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The cubby column divider was full-depth while the boards are depth-recessed,
so it (a) sat proud of the shelf fronts — the earlier Y-tuck then made it poke
past the top/bottom boards — and (b) shared the back panel's rear plane,
z-fighting down the centre of the back.
Give the divider the same depth recess as the boards (via boardGeometry) and
drop the Y-tuck: it now sits flush with the shelf fronts and its back tucks
inside the back panel. Flush top/bottom is fine — those board faces are
back-to-back, not co-facing, so they don't fight.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cubby per-cell dividers landed exactly flush on the board below and under the
board above — coplanar faces that shimmer and read as merged into the shelf.
Extend each divider 1mm into both boards (centre unchanged) so it tucks under
the top board and onto the bottom board with a solid, seam-free join.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two follow-ups to the plate-recess fix:
- Top surface: full-height frame members that pass UNDER the top board
(back panel, bookshelf column dividers, corner posts) had their top face at
unitHeight — coplanar with the top board's top — so they z-fought through it
(the seam on the top). Drop their top 1mm (cappedFrameY); bottoms stay on the
floor so nothing floats.
- Plate width: the previous pass recessed every board's width, which opened a
1mm gap where boards ABUT the side panels (cubby / bookshelf-with-sides).
Width is now recessed only where boards span OVER posts (open-rack /
no-sides bookshelf); abutting boards keep full width and meet the sides
flush. Depth stays recessed everywhere (gap-free, fixes the back-panel fight).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Open-rack / no-sides shelves span their boards across the full footprint, so a
board's end / front / back faces land exactly on the corner posts' outer faces
(and, with a back panel, on its rear face). Coplanar surfaces the depth buffer
can't order flicker as z-fighting (visible as seams where plates meet posts).
Recess every board 1mm on width + depth via a `boardGeometry` helper so each
plate sits just inside the frame — the meshes still overlap (no visible gap),
but no two faces are coplanar. Frame parts (posts/sides/back/dividers/brackets)
keep their full size as the silhouette.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Proves the unified (nodeId, slotId) slot contract on a procedural generator,
beyond items and walls. A shelf now exposes three paintable slots — shelves /
frame / back — painted through the same PaintCapability dispatch and the same
node.slots: Record<slotId, MaterialRef> shape items use.
Foundation (shared, reusable by future procedural kinds):
- core: SlotDeclaration type + capabilities.slots(node) registry declaration;
GeometryContext gains `materials` so a pure builder can resolve scene:<id>
slot refs without importing useScene.
- viewer GeometrySystem: threads the scene material library into every builder
ctx, and re-dirties (bypassing the geometryKey skip) any geometry node that
references a scene material when that material changes — so editing a custom
colour propagates to every shelf using it, matching items.
Shelf:
- schema: slots: Record<string, MaterialRef> (mirrors ItemNode).
- geometry: per-slot material resolution (slot override -> legacy whole-shelf
-> declared default colour); every mesh stamped with userData.slotId;
DEFAULT_SHELF_MATERIAL retired (declared default gives identical off-white).
- paint.ts: PaintCapability (resolveRole from userData.slotId, scene-material
commit for one-off colours, preview restricted to __fromGeometry meshes so
hosted items aren't ghosted, getEffectiveMaterial incl. legacy fallback).
- definition: paint + slots capabilities; slots folded into geometryKey.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pool slabs (generatePoolGeometry) were the one procedural surface emitting
normalized [0..1] floor UVs, so a textured finish stretched to fit the pool
instead of tiling at real-world scale like every other surface. Switch the
floor to shape-space metres (x, -z) — the same mapping generatePositiveSlab-
Geometry already uses for its caps. Pool walls were already in metres.
Also document the contract in wiki/architecture/materials-and-themes.md: every
procedural surface generates UVs in metres (1 UV unit = 1 m), GLB slots follow
the same ~1 unit/m authoring convention, and a catalog material's `repeat` is
therefore a per-material world-scale setting (tiles per metre), identical for
every surface that uses it — never per-item.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The textures axis had no UI control. Add Colored (textures on — show item
materials, textures, vertex colours) / Monochrome (textures off — flat clay
by surface role) options to the Render dropdown, wired to useViewer.textures.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
In colored mode (textures on), every item now renders its authored material
— textures, vertex colours, and default colours — instead of being stripped
to the uniform off-white baseMaterial. AI-generated and vertex-coloured items
show their real appearance; slot resolution (override -> curated -> authored)
is unchanged. Monochrome (textures off) still collapses to the furnishing
clay role colour (the escape hatch). Drops the now-unused isAuthored marker.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Insert the plan's middle resolution step for item slots: a curated
default baked into the GLB as a per-material 'pascal_material' extra
(three's GLTFLoader copies material extras to userData). Resolution per
slot is now: node.slots[slotId] override -> pascal_material curated
default -> authored GLB material. Bare ids resolve as library:<id>;
unresolved refs fall through. Runtime reads only the GLB (no DB).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The editor autosave/load is the single source of truth for what travels
with a scene. Include document-level state (collections, materials) so it
survives reload in every embedder (community cloud save + standalone
localStorage):
- SceneGraph carries optional collections + materials.
- useAutoSave triggers on collections/materials reference changes (not just
nodes) and writes them into the saved graph + the unload flush.
- applySceneGraphToEditor restores them via setScene's extras arg on load.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Phase 3 paint UI.
- Extract reusable MaterialPropertiesEditor (shared by the custom active-
paint editor and the scene-material editor).
- Curated Colors swatch row in the picker; catalog presets fork-on-tweak
by seeding a custom material from the entry's previewColor.
- Scene materials section in MaterialPaintPanel (shown once any exist):
list with swatch, inline rename, 'used by N parts', paint-with,
edit (live-propagates to every referencing part via the renderer's
sceneMaterials dep), duplicate, delete.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* chore: sync bun.lock with 0.9.1 workspace versions
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(viewer): stop interactive overlays from starving frames and flickering the UI
Every interactive item mounted a drei <Html occlude> overlay
unconditionally — invisible (opacity 0) when no zone was selected, but
still alive. With `occlude` as a bare boolean, drei raycasts the entire
scene per overlay on every camera-move frame, and rewrites each
element's z-index while toggling display when the occlusion flips. On
scenes with hundreds of interactive items (recessed lights, ceiling
fans) this starved the frame budget and made the whole DOM UI blink
during camera moves while the WebGPU canvas stayed healthy.
Overlays now mount only while a zone is selected and the item sits
inside its polygon, fade in/out over 300ms (the child components stay
rendered so the exit transition can play before the <Html> unmounts),
and drop `occlude` entirely. eps=-1 works around a drei mount bug: its
mount path writes the element transform without the distanceFactor
scale, and with a static camera the eps guard never re-applies it, so
freshly mounted overlays stayed mis-scaled until the camera moved.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(viewer): break down dirty nodes by kind in the perf overlay
DIRTY now reads e.g. "29 (12 wall, 9 ceiling, 8 item)" — sorted by
count, only non-zero kinds, with a "missing" bucket for dirty ids whose
node no longer exists. Makes dirty-mark leaks attributable at a glance.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* perf(core): skip dirty marks for kinds with no dirty consumer
dirtyNodes is consumed by GeometrySystem (def.geometry),
FloorElevationSystem (capabilities.floorPlaced), and the legacy
per-kind viewer systems. Site, building, level, zone, and guide match
none of those, so their marks were never cleared: they accumulated for
the whole session (every child create/delete dirties its parent),
permanently defeated every consumer's empty-set early exit each frame,
and polluted the perf overlay's DIRTY readout.
NodeDefinition gains an explicit dirtyTracking?: boolean opt-out
(default tracked — no derivable predicate exists since wall's dirty
consumption lives in the viewer while zone/guide/level declare
def.system for unrelated per-frame work). markDirty consults the
registry; the five structural kinds opt out.
Also fixes a second leak: deleteNodesAction never removed deleted ids
from the dirty set, and every consumer skips missing nodes without
clearing them, so marks on deleted nodes lived forever.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* style: replace concise-arrow forEach with for...of in deleteNodesAction
biome's useIterableCallbackReturn rejects forEach callbacks that
implicitly return a value (Set.add / clearDirty).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix: zone grid snapping, shelf position panel, deselect on item placement
- Zone tool reads the editor's gridSnapStep (0.5/0.25/0.1/0.05) instead
of a hardcoded 0.5 for both cursor move and click snapping.
- Shelf inspector gains a Position group (vec3 X/Y/Z sliders), matching
the item panel.
- Item catalog clears the viewer selection before arming placement so
shortcuts (rotate & co) don't hit both the ghost and the selected node.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* refactor: move level display naming into @pascal-app/core
getDefaultLevelName / getLevelDisplayName ("Ground Floor" / "Floor N" /
"Basement N") lived in packages/editor's internal lib, so viewer-only
surfaces couldn't reach them and fell back to hand-rolled "Level N"
labels. The helpers are pure domain logic, so they move to core and
export from its barrel; the editor package's seven call sites now import
them from there.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix: guard preset placement against double commit from duplicate click events
A single physical click reaches commitAtCursor twice: node clicks are
synthesized on pointerup (use-node-events) while grid:click rides the
native click event from a canvas DOM listener (use-grid-events) that
deliberately ignores stopPropagation. The second pass found the fresh
draft already deleted and took the orphan re-create path, minting a
hidden ghost copy, replaying the placement SFX, and abandoning the
re-armed clone as a second ghost.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat: show the compass in all view modes via the viewer-area container
The floorplan compass now portals onto the always-visible viewer area
instead of living inside the (display:none in 3D) floorplan pane. The
2D/3D navigation poses already sync through navigationSyncPose, so the
needle and align-to-north stay correct in 2d, 3d, and split alike.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* Allow template forks to preserve scans
* Add room preset save trigger
* Show room preset action for selected zones
* Use standard inspector for selected zones
* Support room preset editor workflows
* Preview room clear-underneath items
* fix: update site labels after camera swaps
* fix: gate scene display until viewer is ready
* fix: render scene loader on first paint
* fix: keep loader during pending scene graph
* feat: add wasd camera panning
* feat: add x delete mode shortcut
* feat: add floorplan north compass
* fix: move floorplan compass to lower corner
* fix: progressively rebuild heavy scene geometry
* fix: simplify noisy ifc wall output
* fix(editor): shelf deletion plays item-delete SFX; refresh delete sounds
Shelves are furniture-like placeable objects, so deleting one should use
the lighter item-delete cue instead of the structure-delete one. Add a
shared emitDeleteSFX(nodeType) helper that maps item-like node types
(item, shelf) to item-delete and everything else to structure-delete,
and route the three delete sites (sledgehammer, floating action menu,
keyboard) through it.
Also refresh the item_delete/structure_delete audio assets and reduce
their pan jitter for a steadier delete cue.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(editor): update item_delete SFX asset
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* wip sfx
* wip audios
* feat(editor): structure build-start/end cues + menu hover/click SFX
Sound design pass for the build/items experience:
- Split structure-build into a start cue (draft begins) and end cue
(commit). Wall/fence fire start on the first click; slab/ceiling/zone
tick start on every non-closing vertex; roof on the first corner.
- Doors and windows now use the structure-end cue on place + move;
shelves use item-place instead.
- New menu_hover (round-robin retired in favour of a single sample) and
menu_click cues wired to the Build/Items main categories, item-catalog
tiles, the icon rail / tab bar, and the bottom action menu (via the
shared ActionButton).
- Refresh item_pick / item_place / item_rotate samples; drop the
now-unused numbered menu_hover variations.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(editor): silence forEach return lint in updateSFXVolumes
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(editor): convert SFX wavs to mp3 to shrink assets
Re-encode all SFX samples as 128kbps mp3 (~94% smaller, transparent for
short UI cues) and point the player at the .mp3 sources. Drops the .wav
originals; the freshly converted item_pick/place/rotate.mp3 override the
older committed mp3s.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Two invariants weren't captured by the wiki or the review-architecture
skill, so a PR could break them and pass review:
- node-schemas.md documented no backward-compat rule, even though
migrateNodes() runs at load. Add a Schema Evolution section (new
fields need a Zod default; renames/removals/retypes need a
migrateNodes entry) plus a Rules bullet.
- review-architecture skill only checked the narrow host-children
case for migrations and had no editor-layer check at all. Add a
general schema-migration item (§B) and an editor-overlay-layer
item (§E, overlay meshes must set EDITOR_LAYER or they leak into
thumbnails/snapshots and the ink/SSGI buffers).
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* fix(nodes,viewer): window preset live wall preview + shaped-cutout move tracking
MoveWindowTool marked the moving window `isTransient` unconditionally, but
WindowSystem only rebuilds the host wall's cutout for non-transient windows —
so a window *preset* (isNew) showed no live hole on the wall and couldn't be
placed consecutively without leaving/re-entering. Guard the transient mark on
`!isNew`, matching MoveDoorTool.
Separately, shaped openings (arch / rounded / `opening`) rebuild their cutout
brush from `node.position`, which a same-wall move doesn't write (it mutates the
mesh directly and publishes to `useLiveTransforms`). The wall-system's
`getEffectiveNode` only merges `useLiveNodeOverrides` (resize arrows), so shaped
cutouts lagged the move while rectangular ones (rebuilt from the live mesh
matrixWorld) tracked. Fold `useLiveTransforms` into door/window children before
collecting cutouts so shaped holes follow the live move too.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(editor,viewer,nodes): smooth item placement on shelves
Three issues made hosting an item on a shelf janky (item-on-item was already
smooth because plain items have no `def.geometry` to rebuild):
- Jitter: the draft mesh intercepted the cursor ray, so the shelf-row hit was
re-derived from the moving item each frame. Disable raycasting on the draft
during placement (incl. async GLB children, reconciled per frame) so the ray
passes through to the surface beneath — mirrors MoveRegistryNodeTool.
- Reparent/vanish at the edges: `onShelfLeave` flipped state to floor without
reparenting the draft off the shelf, so the floor strategy's level-local
position rendered compounded with the shelf transform. The grid handler now
owns the shelf→floor transition.
- In/out oscillation: reparenting the draft onto the shelf dirtied the shelf,
and GeometrySystem disposed+rebuilt its boards, making r3f fire a spurious
shelf:leave→enter that thrashed placement between the row and the floor. Add
an opt-in `def.geometryKey` so GeometrySystem skips the rebuild when geometry
inputs are unchanged (shelf boards don't depend on hosted children). Keep the
item sticky by testing the cursor ray against the shelf's bounding box: a ray
that slips through a gap and lands on the floor behind the shelf still counts
as "on the shelf"; only a ray that misses the shelf detaches to the floor.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat(editor-app): add Shelf to the standalone editor Build tab
The shelf kind is fully wired (def.tool, presentation icon, StructureTool id)
but was absent from the standalone editor's Build palette. Add it between
Column and Spawn Point. Community has its own build-tab and is left untouched.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore(mcp): biome-format coordinate-conventions-demo.json
The committed example violated Biome formatting (expanded polygon arrays),
which broke the `mcp-ci` Biome check on main (#356) and every branch since.
Format it so CI is green. Pure formatting — no content change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* feat(editor): shelf placement validity box + sync tool for positioned presets
Give the generic move tool a green/red footprint box for shelf placement,
matching the GLB item cursor, and drop the vertical-arrow CursorSphere for
shelves. Box colour comes from canPlaceOnFloor; an invalid (red) drop is
refused unless Shift forces it, and R/T play the rotate sfx. Re-sync the box
transform on node change so a re-armed clone isn't left at the previous
rotation/position.
Extract the box wireframe geometry helpers into a shared
placement-box-geometry module reused by the item coordinator and the new
declarative PlacementBox component. Export the Tool type so host apps can set
the active tool for a positioned preset.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: apply biome formatting + ignore generated next-env.d.ts
Format files that predate the current biome config (lineWidth 100, single
quotes, semicolons as-needed) so they stop showing as dirty on every checkout.
Formatting only — no behavior change.
Also exclude **/next-env.d.ts from biome: Next regenerates it (double quotes +
semicolon) on every build, so biome kept reformatting it into a perpetual dirty
diff. Ignoring it lets Next own the file.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Editor-package side of the hosted editor UI pass:
- Add `workspaceMode` ('edit' | 'studio') to `useEditor`. Studio forces a
3D-only view, clears selection, and the canvas hides the bottom action bar,
inspector, selection manager, handles and tools (kept level selector, view
toggles and camera toolbars).
- Inspector panel (`PanelWrapper`): collapses to its header by default with a
single-click toggle, is draggable from the header via a centered grip, and is
clamped to the viewer column (`data-viewer-bounds`) so it can't slide under
the sidebar or top bar.
- Lower the floating action menu / building menu / arrow-handle `zIndexRange`
below the chrome overlay so the inspector sits above scene HTML helpers.
- Merge the bottom bar's separate Scans + Guides toggles into a single
References split-button + popover with per-type sections.
- Export `WorkspaceMode`.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Bring the open-source standalone editor closer to the community editor's
v2 sidebar without pulling in any preset/catalog infrastructure.
- Add a preset-less Build tab (apps/editor) that mirrors the community
Build sidebar: wall, fence, slab, ceiling, roof, stair, elevator,
door, window, column, spawn, plus the material-paint panel. Clicking a
type activates the raw structure tool drawn with the kind's defaults.
- Wire the Build tab into both editor mount points (local + saved scene)
and give the left rail proper image icons (Scene/Build/Items/Settings)
instead of letter fallbacks.
- Gate the ItemsPanel Library/Community/Mine source chips and tag filter
rows behind `showSourceFilter` / `showTagFilters` props (default true,
so community and external consumers are unchanged). The standalone
editor passes both off, leaving plain category tabs + full-width search.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
These tests had never run in CI (the editor repo's own CI only runs
mcp-ci); they surfaced when the private-editor monorepo runs
`@pascal-app/nodes` tests via turbo. Four independent issues, all
test-side except one skip that flags a real bug:
- index.test.ts: the AnyNode-discriminator drift check read the literal
via the zod-v3 `option.shape.type.value` getter, which is gone in
zod v4 (and the field is ZodDefault-wrapped). Unwrap to the innermost
def and read `_zod.def.values[0]`.
- spawn/parity.test.ts: the spawn palette icon is `{kind:'url'}` now
(registered kinds point at palette assets); the test still asserted
'iconify'. Update to 'url'.
- solar-panel/geometry.test.ts: `getSurfaceY` / `getAnalyticalNormal`
moved to `../../shared/roof-surface`; fix the stale import path.
- shelf/geometry.test.ts: skip "user-set material is applied" — it
catches a real bug (cloning a MeshStandardNodeMaterial drops
color/roughness/metalness, so painted shelves/slabs render white).
The clone is required; the fix belongs in the viewer material layer
and is tracked separately.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
The registry-driven selectable branch in `collectNodeIdsInBounds` called
`objectBoundsIntersectsBounds(node.id, bounds)` directly, but `bounds` is
`Bounds | null` (null = select-all / no rectangle). Every other branch
guards with `!bounds ||`; this one didn't, so `tsc --build` failed in
consumers (`@pascal-app/nodes`) with TS2345 "Bounds | null not assignable
to Bounds". Add the same guard, which also restores correct select-all
behavior for registry-selectable kinds.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Two unit-test groups had drifted from intentional implementation changes
and have been failing CI on main since before they were noticed:
- registry: re-registering a node kind is now HMR-aware — it warns and
replaces in dev/test and only throws in production (registry._register,
introduced in the in-world-selection work). `bun test` runs with
NODE_ENV=test, so the duplicate-kind tests took the dev (warn) path and
no longer threw. Pin NODE_ENV to 'production' for the throw-path
assertions via an `inProduction` helper, and add explicit dev/HMR
coverage for the warn-and-replace path.
- stair-opening-sync: the straight-flight opening geometry was
deliberately enlarged ("increase stair opening buffer constraints",
treadDepth*10 / length*0.8 / 3.0, openingOffset default 0.15). The
enlarged opening now spans nearly the full slab depth, so the manual
hole fixtures (which must *contain* the auto opening to suppress it) no
longer covered it. Enlarge the manual-opening fixtures to genuinely
cover the current opening, preserving each test's intent.
No production code changed — only test fixtures/assertions.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* feat(editor): preset placement polish — params, move tool, shadows
- wall/slab/ceiling/roof create paths consume `toolDefaults` so template
presets build with their saved params; cleared on tool unmount
- wall draw preview reflects the preset's height/thickness (+ HUD labels)
- box-select picks up registry-selectable kinds (shelf) via bbox
- registry + column move tools: snap to the active grid step, R/T rotation,
and ignore the stray trailing click that armed the move (no double-place)
- shelf geometry casts + receives shadows like fence/slab
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat(viewer): expose isIsolationActive() for isolation-aware consumers
Tracks whether an isolation filter is currently applied and exposes it so
hosts can avoid acting on the partial view — e.g. skipping project-thumbnail
autosave while a single subtree is isolated (preset capture).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
* feat(editor): preset-system polish — paint panel, slim action bar, icon rail
- Export `MaterialPaintPanel` so embedders host the paint material picker in
their own panel (community docks it in the Build sidebar) instead of the
bottom action bar.
- ActionMenu: drop the build / material-paint / furnish modes and the
structure-tools palette row + paint tray (the host's Build sidebar owns
building now). Reduce `structure-tools` to the shared `tools` lookup still
used by cursor/floorplan indicators; remove the orphaned `useContextualTools`.
- MaterialPicker: swatches wrap into a fluid `auto-fill` grid that fills width.
- IconRail (tab-bar): bigger icons, grayscale-when-idle, Radix tooltip, w-14
rail; sync `RAIL_WIDTH` to 56.
- Inspector footer: hand the host `footer` to kind-owned custom panels via
`InspectorFooterContext` so the save button renders without per-kind wiring.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* chore: biome format pass
Whole-repo formatter normalization (line wrap/unwrap only, no logic changes)
surfaced by the format-on-edit hook against prior drift. Kept separate from the
feature commit so the preset-system diff stays reviewable.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Replace the v2 left column's horizontal tab bar with an always-visible
vertical icon rail. Clicking the active icon collapses the panel (rail
stays); clicking any icon while collapsed reopens it at the persisted
width (clamped to the minimum). Resizer-drag collapse is preserved.
Add an `inspectorFooter` slot to <Editor> (v2), threaded through
PanelManager → ParametricInspector → PanelWrapper, so embedders can dock
an affordance (e.g. "save as preset") below the node inspector.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Render the function-tree category roots as a Build-style square-tile grid
(icon when available, otherwise a two-letter abbreviation) with a hover
tooltip for the full name, so the Items and Build panels read the same.
Share one TooltipProvider with disableHoverableContent + the icon-grid
tooltip class to avoid the flicker when moving between adjacent tiles.
Legacy fallback panel category bar wraps instead of scrolling horizontally.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Following the camera look-at broke when zoomed out (fixed ±50 frustum
too small to cover the scene) and when zoomed into an empty corner
(frustum centred on nothing). Instead, fit the directional light's ortho
shadow camera to the building: union the registered scene-node bounds
(excluding the site/ground plane), fit a sphere, and size + place the
shadow camera to cover that sphere plus a margin. Bounds are refreshed on
a short interval since they only change while editing.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
The directional shadow light was placed at focus + theme offset (only
~17-32 units), while the ortho shadow camera ran near=1/far=100. That
left the focus near the front of a long frustum whose far end swung
around as the look-at moved, so shadows appeared not to follow the view.
Park the light at a fixed distance along its (preserved) direction and
bracket near/far around that distance so the focus stays centered in the
frustum depth.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
* feat(editor): tool-defaults seeding + drawTool capability; fence consumes it
Adds a generic, transient `useEditor.toolDefaults` slice keyed by tool, set
via `setToolDefaults(tool, params)`. A draw tool's create path merges its
entry when minting a node and clears it on deactivation, so a host app can
prime the next-drawn node's parameters — placing a saved preset of a drawn
kind, or a future "small / medium / large" dimension picker for
wall / slab / ceiling.
Marks the kind with `capabilities.drawTool` (helper `isDrawnViaTool`) so host
apps know to route placement through `setToolDefaults(type) + setTool(type)`
instead of cloning a finished instance.
Wires fence end-to-end: it declares `drawTool: true`, its create path merges
`toolDefaults.fence`, and the draft preview (bar geometry, cursor, HUD label
heights) reflects the seeded height/thickness so the ghost matches what will
be built. The tool clears its own defaults on unmount.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* fix(editor): restore dropped useEditor import in fence tool
The toolDefaults-seeding commit lost the `useEditor` import (formatter
stripped it), shipping a runtime ReferenceError when FenceTool mounts.
Re-add it.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
* feat(editor): hierarchical function-tree Items browse
Add an optional DB-driven taxonomy browse to the Items panel. When the
embedder supplies a `functionTree`, the panel renders roots as category
tabs and child tags as a secondary chip row, filtering items by the
selected node and any descendant slug; otherwise it falls back to the
legacy hardcoded category path untouched.
Adds `AssetInput.functionTags` so items can carry their function-axis
tag slugs, and exports `FunctionTreeNode` for embedders to type the tree.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* chore(editor): sync bun.lock (@pascal-app/mcp 0.3.0)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Tunes the auto-framing and camera clamps used by `setCaptureMode({ mode:
'preset', isolated })`:
- Frame from a 3/4 view of the node's *front* face. Reads the isolated
root's yaw, picks `+Z` (local forward, the face authored for catalog
shots), offsets the camera by 35° to the side so both the front and
one adjacent face are visible. 25° elevation keeps the top visible
without going isometric. Multi-isolate falls back to world `+Z`.
- Bump the bounds-fit multiplier from 1.6 → 2.4 (floor 3 → 4) so the
subject lands with ~25-30% padding inside the locked square crop —
the user can recompose without immediately needing to zoom out.
- Relax `minDistance` from 10 → 0.5 while in preset capture mode (a
0.3–2m preset can't be framed close-in against the editor's general
10m floor). Reverts to 10 on exit so general editing keeps the
looser navigation guardrails.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Retires the door/window-only `PresetsPopover`, its `presets-context`
adapter, and the `PresetThumbnailGenerator` ahead of the unified preset
system landing via the items catalog. Drops the public exports
(`PresetsPopover`, `PresetsAdapter`, `PresetsTab`, `PresetsProvider`,
`usePresetsAdapter`) and the matching `presetsAdapter` prop / provider
wrappers on `<Editor>`, plus the `preset:generate-thumbnail` /
`preset:thumbnail-updated` event types in core. Door and window panels
now render the regular parametric inspector with no popover trigger;
`materialPreset` stays untouched.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(editor): preset-system primitives — presettable, sceneApi subtree round-trip, isolate + setCaptureMode enum, headless exports
Per pascalorg/editor#340 (redesigned: single live canvas, no Viewer scene prop).
Core
- `capabilities.presettable` on `NodeDefinition` + `isPresettable` /
`isPresettableKind` helpers. Explicit `false` on level / building /
site / zone / spawn / guide / scan / item; implicit `true` for any
kind with `def.parametrics`.
- `sceneApi.getSubtreeSnapshot(rootId)` + `materializeSubtree(subtree,
position, parentId?)` for round-tripping a node subtree through
catalog storage. Strips id / parentId / absolute root position /
host refs (`wallId`, `wallT`); fresh IDs minted at materialize time;
child ordering preserved (FIFO walk).
Viewer
- `<Viewer isolate>` prop + `ViewerHandle.setIsolated(ids | null)`.
Walks `sceneRegistry`, hides every registered group not in the
isolated set's ancestor + descendant closure. Building block for
preset capture + future focus-mode UX.
Editor
- `useEditor.captureMode: CaptureMode` discriminated union
(`idle` | `standard` | `preset`). `isCaptureMode` stays as a derived
boolean for the existing read sites; `setCaptureMode` accepts both
the boolean shape (back-compat) and the enum.
- `preset` capture mode in `SnapshotCaptureOverlay`: drag locked to a
square, mode-picker hidden, transparent flag forwarded through the
`camera-controls:generate-thumbnail` emitter event.
- Headless exports: `Inspector` (alias of `ParametricInspector`),
`FloatingMenu` (alias of `FloatingActionMenu`), `ToolbarLeft` /
`ToolbarRight` (aliases of `ViewerToolbarLeft` / `ViewerToolbarRight`),
`useSelection` hook returning `{selectedIds, selectedNode, building/
level/zone}`, plus re-exports of `useScene` / `useViewer` from core /
viewer so consumer shells (community, embedders) need only one import.
Out of scope by design (see issue #340 "Out of scope"): a separate
offscreen Viewer rendering an arbitrary subtree. The unified preset
modal captures inside the live canvas via isolation + the existing
snapshot pipeline — no `useScene` factory / React context refactor.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor(editor): split snapshot/materialize into pure getSubtree + cloneNodesInto; add def.hostRefFields; auto-stage preset capture square
Per pascalorg/editor#340 redesign discussion: the editor's scene API
should expose *pure* primitives and let the host (community modal,
embedders) own storage shape, position stripping, and host-ref
re-derivation policy.
Editor API delta
- `sceneApi.getSubtreeSnapshot(rootId)` → `sceneApi.getSubtree(rootId)`
Returns the live subtree verbatim (BFS via `children[]`, no clones,
no stripping). Callers deep-clone if they need persistence.
- `sceneApi.materializeSubtree(subtree, pos, parent?)`
→ `sceneApi.cloneNodesInto(nodes, { rootId, parentId?, position? })`
Generic clone-and-insert. Deep-clones via JSON, mints fresh ids
preserving the prefix, rewires parent/children, stamps position +
parent if supplied. Host-ref-agnostic — `wallId`/`wallT` etc are
preserved verbatim.
- New `capabilities.hostRefFields?: string[]` on `NodeDefinition`.
Declares per kind which schema fields are placement-derived so the
host strips them at preset-save time. Declared on door (`['wallId']`),
window (`['wallId']`), item (`['wallId', 'wallT']`).
- New `getHostRefFields(def)` exported from `@pascal-app/core`.
Removed the intermediate token-based payload format (`NodeSubtree`,
`buildSubtreeSnapshot`, `materializeSubtree`, `SubtreeNode`).
UX polish
- `<SnapshotCaptureOverlay>` in `preset` mode now auto-stages a centered
square crop sized to ~75% of the shorter viewport dimension. The
user can pan / move / resize within square-aspect, but doesn't have
to drag from scratch — clicking the capture button works
immediately on entry.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(editor): lock preset capture frame; allow item presets
- SnapshotCaptureOverlay: in `preset` mode, the auto-staged centered
square is now fully locked — corner handles hidden, the dim layer is
click-through (no drag-to-move, no drag-to-resize). The user just
adjusts the camera (orbit / pan / zoom) and clicks capture. The
letterbox + dashed border stay visible as a cosmetic frame.
- `item.capabilities.presettable` removed (implicit `true` via
`def.parametrics`). Enables compositions like "table-with-plants",
"shelf-with-books" where the preset root may be an item and other
items ride along as descendants. The GLB-kind item catalog is
unchanged; presets become siblings of GLB rows under the same
`items` table.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(editor): auto-frame camera on preset capture entry; restore on exit
`<CustomCameraControls>` now watches `useEditor.captureMode` and, when
preset capture mode begins, flies the camera to a pose that fits the
union bounds of the isolated subtree inside the locked square crop —
no more hunting for the subject after opening the modal. The
pre-capture pose is stashed and restored on exit so the user lands
exactly where they were.
The user can still pan / orbit / zoom from the auto-staged pose if
they want a different angle before snapping.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add bullets to §4.B for surfaces that landed after the 2026-05-20
skill update:
- def.capabilities.paint (PaintCapability dispatch for paint mode)
- def.capabilities.floorPlaced (generic FloorElevationSystem)
- def.surfaceRole (Solid/Rendered/Clay render-mode pipeline)
Also add a verb-not-host-kind rule and mark capabilities.roofAccessory
as documented tech debt — extending the *Accessory / *Hosted shape is
now a blocker rather than a precedent.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
initSpaceDetectionSync subscribes to every scene mutation and auto-derives
slabs/ceilings from wall topology. When a host app drives explicit
slab/ceiling creation (e.g. the community editor's AI create_room flow),
the auto-sync races those nodes and the polygon-signature de-dupe is
fragile enough that duplicates leak through.
Expose pauseSpaceDetection / resumeSpaceDetection / isSpaceDetectionPaused
mirroring the existing pauseSceneHistory refcount in store/history-control.
While paused, the subscriber rolls previousSnapshots forward so resume
does NOT trigger a backfill that would re-introduce the very duplicates
the host paused to avoid.
No behavior change for callers that don't touch the new functions.
apps/ifc-converter/app/page.tsx pointed at
github.com/pascalorg/editor/apps/ifc-converter which 404s. The
canonical path includes /tree/main/. Same URL is reused by the
forthcoming community /ifc page (in pascalorg/private-editor) so
keeping them consistent matters.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: add Phase 1 render-modes foundation (shading/textures/colorPreset state, defaultRender prop, SSGI gating)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: Phase 2 render-modes material-class switch (Lambert in solid, Standard in rendered)
Shading-aware material factories (cached per class), reactive selection in
renderers via the useViewer(shading) pattern, and dirty-rebuild on toggle for
geometry/door systems. Rendered mode output unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: Phase 3a render-modes surface roles + clay palette foundation
Adds surfaceRole token to core NodeDefinition, per-kind default roles,
ColorPreset palettes + resolveSurfaceColor/createSurfaceRoleMaterial (glazing
stays translucent), and the textures-off recolor path for def.geometry kinds
(slab/fence/shelf via GeometrySystem.applyDefaultSurfaceRole) + wall. Renderer-
based kinds (roof/window/stair/item/column/door/ceiling/elevator) wired in 3b.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: Phase 3b render-modes textures-off recoloring for renderer/system kinds
Wires clay role coloring (textures=off) for roof/roof-segment, window, stair/
stair-segment, door, item, column, ceiling, elevator via createSurfaceRoleMaterial,
reactive on textures/colorPreset. Per-surface roles: roof top+edge=roof /
underside=ceiling; window frame=joinery / glass=glazing; stair+door+elevator=
joinery; ceiling=ceiling; column=wall; item=furnishing. textures=on unchanged.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* editor: Phase 4a render-modes UI — Solid/Rendered toggle + per-context persistence
Per-context shading via renderContext discriminator + shadingByContext (persisted);
<Viewer> renderContext prop seeds per-context on mount. Solid/Rendered toggle in the
editor action bar + standalone toolbar + command palette. Editor mounts default to
renderContext=editor / shading=solid.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: fix window-system glassMaterial type to allow clay glazing reassignment
The let was inferred as MeshLambertNodeMaterial from the imported glass constant,
so reassigning createSurfaceRoleMaterial('glazing') (returns THREE.Material) failed
under tsc --build. Widen the annotation to THREE.Material. Surfaced by the build
(check-types had replayed a stale turbo cache).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: Phase 5 lighting — add theme-driven hemisphere light, trim fill directionals 3->2
Adds a sky/ground hemisphere fill (theme-lerped) and drops the second fill
directional; the hemisphere covers the shadow-side fill it provided, at one
fewer per-fragment directional term (shared by Solid + Rendered). Ambient lowered
since the hemisphere now carries soft fill. Intensities are a starting point —
tune visually on the gpu-perf overlay.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: tune Solid lighting for more form — stronger hemisphere sky/ground contrast, lower ambient
Darker hemisphere ground (#d8d6cf -> #aaa49a) + higher hemisphere intensity and
lower ambient so directional shading reads as form and undersides ground without
AO. Keeps Solid free of any post-processing pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore: biome format render-mode files (lefthook pre-commit)
Formatting-only — import wrapping, dep-array wrapping, single-line ternaries —
across Phase 2-4a files that weren't biome-clean. No logic changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: scene-theme system — named environment themes (studio/paper/sunset/night/...)
New SceneTheme registry (lib/scene-themes.ts) drives lights, background, and tone
mapping; lights.tsx refactored data-driven (N directionals + hemisphere + ambient).
sceneTheme state (persisted) + cycle-button picker in editor bar + standalone
toolbar, importing the registry from the viewer barrel (single source). Default
'studio' reproduces the prior look exactly; app light/dark 'theme' untouched.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* editor: Phase 7 — popover-dropdown pickers for render mode + scene theme (editor bar)
Replace the shading + scene-theme cycle buttons in viewer-overlay.tsx with
DropdownMenu pickers: render mode shows 2 rows (Solid/Rendered) with one-line
detail; scene theme lists all themes with a derived color-swatch strip + active
check. Imports the registry from the viewer barrel (single source).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* editor: Phase 7 — dropdown pickers in standalone toolbar + export DropdownMenu from barrel
Replicate the render-mode + scene-theme dropdown pickers (with swatch strip +
active check) to apps/editor's compact toolbar, matching viewer-overlay.tsx.
Export DropdownMenu* from the @pascal-app/editor barrel for the standalone app.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer+editor: Phase 8 — crisp geometry edge overlay (off/soft/strong/sketchy)
EdgeOverlaySystem draws EdgesGeometry LineSegments over node-backed building
meshes (scoped via sceneRegistry, skips zone-layer/hitbox/overlay meshes),
rebuilt on geometry-uuid or mode change, line color follows scene-theme
background luminance; sketchy = static TSL vertex jitter. New 'edges' state
(persisted, default off) + Edges dropdown in editor bar + standalone toolbar.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer+editor: edge overlay — thick lines via Line2, drop sketchy mode
Switch EdgeOverlaySystem from LineBasicNodeMaterial (1px hardware cap) to
LineSegments2 + Line2NodeMaterial so edges have real screen-space width
(soft 1.5px / strong 3px); resolution tracks viewport. EdgeMode is now
off/soft/strong (sketchy removed).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: fix edge overlay crash — webgpu Line2NodeMaterial has no settable resolution
material.resolution is undefined under WebGPU (the node material reads the
viewport internally); optional-chain the .set() call so it no-ops there instead
of throwing. Thickness still applies via linewidth.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: edge overlay — weld vertices to fix CSG spiderweb edges + lighter strong
Position-only mergeVertices before EdgesGeometry so coplanar triangles from
CSG-cut walls (doors/windows) share vertices and their interior edges are
suppressed — only opening outlines + silhouettes remain. Strong linewidth
3 -> 2px (was too heavy).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: edge overlay — crease-only extractor to fix CSG spiderweb
Replace EdgesGeometry (which always draws unpaired boundary/T-junction edges)
with buildCreaseEdges: weld positions, keep only edges shared by exactly two
faces whose dihedral exceeds the threshold, drop everything unpaired. CSG-cut
walls/slabs are watertight so real corners + opening outlines survive while the
interior triangulation fans (coplanar or T-junction) are removed. Open meshes
(bare ground plane, billboard leaves) shed their boundary clutter too.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: crease edges — coarser weld (0.1mm->1mm) to recover CSG/extrude seam edges
The cap<->side-wall top edge of ExtrudeGeometry walls drifts past 0.1mm after
CSG, so it stayed unpaired and was dropped. Weld at ~1mm to pair it into a real
crease while staying far below feature size (wall thickness, openings).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: replace geometry edge overlay with screen-space ink (SketchUp look)
Port the prototype's screen-space ink into the post-processing pipeline: depth +
normal Sobel reading the scene-pass MRT. Crease term (normalized normals,
center-vs-neighbour) + distance-independent depth-step term (raw Laplacian /
(1-d)² with a noise gate so flat ground stays clean). Topology-agnostic, so it
finally handles CSG-cut walls/openings without the spiderweb or missing-edge
problems of EdgesGeometry. Driven by the existing edges off/soft/strong mode;
MRT now builds when SSGI OR ink is on; ink colour tracks scene-theme luminance.
Removes EdgeOverlaySystem + crease-edges (geometry approach).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: soft/strong ink modes + keep editor overlays out of the ink
Two adjustments to the screen-space ink pass:
1. Soft vs strong now visibly differ. The edge masks saturate, so the old
`intensity` gain did nothing once a line was detected. Replace it with a
sample radius (line thickness) + opacity: soft = 1px / 50%, strong = 2px /
100%. `inkedEdges` takes `radius` + `opacity` instead of `intensity`.
2. Editor overlays (gizmos, move handles, tool previews, grid) no longer get
inked. The scene pass that feeds the depth/normal MRT now renders only
SCENE_LAYER; overlays render in a dedicated pass on OVERLAY_LAYER and are
composited on top after the ink + outlines, so they read as crisp UI and
never get inked or AO'd.
New OVERLAY_LAYER constant in viewer; editor's EDITOR_LAYER re-exports it so
the two stay in lockstep. Also moves WallMoveSideHandles (the wall/fence move
arrows) onto EDITOR_LAYER — it was the one overlay still on SCENE_LAYER.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: render the grid in the scene pass so geometry occludes it
The depth-gate fix couldn't help the grid: its material is depthWrite:false,
so it never wrote overlay-pass depth and the "didn't write depth -> keep on
top" term forced it on top — hence the floor grid bleeding through walls and
objects.
A full-floor plane can only be occluded correctly by living in the same depth
context as the scene, so move the grid onto its own GRID_LAYER which the scene
pass renders (alongside SCENE_LAYER). It's flat and depth-non-writing, so the
screen-space ink still ignores it; gizmos/handles stay on OVERLAY_LAYER. The
grid camera layer is enabled in custom-camera-controls and disabled on the
thumbnail camera so thumbnails stay grid-free, matching EDITOR_LAYER.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: strong ink — match soft's 1px thickness, differ by darkness only
Strong at radius 2 read too thick. Soft's 1px line is the nice one, so use it
for both modes and let strong distinguish itself purely by being fully solid
(opacity 1) vs soft's lighter 50%.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: shadow frustum follows the view + a shadows on/off setting
The directional light's ortho shadow camera only covers ±50 around the light
target, which was pinned at the origin — so zones far from origin received no
shadows no matter where the camera moved. Recentre each shadow-casting light
(position + target together, preserving direction) on the view focus every
frame: the orbit-controls target when available, else the camera's ground
projection. The shadow area now tracks wherever the user looks.
Also add a persisted `shadows` toggle (default on) to the viewer store and a
"Shadows" switch in the editor settings panel — the dedicated shadows control
the render-modes plan deferred. Lights gate castShadow on it.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* editor: shadows toggle in the standalone toolbar + a touch more shadow strength
The shadows switch I added only lived in the cloud settings panel's Visibility
section, which is hidden in the local/standalone editor (no projectId). Add a
ShadowsToggle button next to the grid toggle in the standalone toolbar so it's
reachable there, matching how Show Grid is exposed in both places.
Also push shadow strength partway toward the aesthetic prototype (which runs
near-black, no blur): bump the bright-key shadow-intensity cap 0.4 -> 0.55 and
tighten shadow-radius 2 -> 1.5. Still softer than aesthetic by design.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* nodes: site ground receives shadows (lit material instead of unlit Basic)
The site ground fill used MeshBasicMaterial — unlit, so it could never show
the directional shadow, and shadows visibly truncated at the slab edge. Swap it
for a lit MeshLambertNodeMaterial with receiveShadow on the mesh; the geometry
is the site polygon (slab footprints punched out), so shadows now extend across
the whole site and stop at its boundary, which is the desired bound.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* themes: per-theme clay palettes + 2x2 swatch in the theme pickers
Each scene theme now carries a clayTints map (wall/floor/ceiling/roof/glazing)
giving it a per-surface-role palette — e.g. Mediterranean's blue roof + warm
walls. The theme pickers (standalone toolbar + community overlay) now render the
aesthetic-style 2x2 swatch of those role tints over the theme background instead
of the old 3-colour strip.
Data + UI only; wiring the tints into the textures-off surface materials is a
separate change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* editor: slimmer theme switcher + cloud-sun icon
Shrink the scene-theme toolbar button (w-[8.5rem] -> w-28) so it stops reserving
space for "Mediterranean"; the label truncates when it overflows. Swap the
palette icon for cloud-sun (atmosphere/lighting, distinct from the app light/dark
Sun-Moon toggle) in both the standalone toolbar and the community overlay.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* editor: theme switcher icon -> swatch-book
Swap the scene-theme icon from cloud-sun to swatch-book in both the standalone
toolbar and the community overlay.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* themes: colour untextured building surfaces by the active scene theme
Untextured walls/roof/slab/ceiling now take the active theme's per-role colour
(theme.clayTints[role], falling back to the colour preset) in BOTH textures
modes. The textures toggle only governs surfaces that actually have an explicit
material/preset — those still show their texture when textures are on. This is
what makes e.g. Mediterranean read as a blue roof + warm walls instead of the
old hardcoded white/grey defaults.
- materials.ts: resolveSurfaceColor / createSurfaceRoleMaterial take an optional
sceneThemeId (theme tint ?? preset palette); theme folded into the cache key.
- wall-materials, roof-materials, slab/geometry, ceiling/renderer: the untextured
fallback now resolves to the themed role colour instead of white/grey, in both
modes; theme threaded into each builder + material cache key.
- wall-cutout: now reads textures/colorPreset/sceneTheme and re-applies wall
materials when any change (previously it ignored textures/colorPreset entirely).
- geometry-system: threads sceneTheme into the generic surface-role path + rebuild
effect. Renderers/preview call sites thread sceneTheme through.
Doors/windows/stairs/columns/items still use their existing defaults — a
follow-up pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(slab): recessed (negative-elevation) slabs extrude downward again
The registry geometry builder created the slab mesh at Y=0 without applying the
negative-elevation offset, so recessed slabs rendered above the floor plane
(pool geometry is built locally with its floor cap at Y=0 and walls rising to
Y=|elevation|, so the mesh must be shifted down by `elevation` to recess). The
runtime slab-system already did this; the static builder path didn't. Mirror it:
shift mesh.position.y by elevation when negative. Positive elevation unchanged.
Unrelated to render modes — bundled into this branch's PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(roof): legacy roofs render again — migration wrote invalid wallHeight 0
Legacy roof nodes (old format, no `children`) were migrated with a hardcoded
`wallHeight: 0`. With zero wall height the eave height (`wallHeight - autoDrop`)
went negative in getRoofSegmentBrushes, producing geometrically invalid brushes;
three-bvh-csg then spammed "TriangleClipper: Coplanar clip not handled" every
frame and emitted NaN positions, so the merged roof geometry failed
computeBoundingSphere and never rendered.
- core/use-scene migration: wallHeight 0 -> 0.5 (the RoofSegmentNode schema
default), so migrated segments have a valid wall height.
- roof-system: clamp eave height to >= 0.01 so an intentional wallHeight 0 can
never yield a negative eave, and guard updateMergedRoofGeometry so a CSG result
with NaN positions is discarded (keep the last good mesh, warn once per roof)
instead of poisoning the buffer + spamming the console.
Unrelated to render modes — bundled into this branch's PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(column): columns cast and receive shadows
Column meshes (box, beam, cylinder, sphere, torus) rendered without castShadow/
receiveShadow, so columns neither dropped a shadow nor caught one — unlike walls,
slabs and roofs. Set both on all column shape meshes.
Unrelated to render modes — bundled into this branch's PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* viewer: default edges to soft
Editor defaults are now solid shading / studio theme / soft edges / shadows on.
Shading (solid, via EDITOR_DEFAULT_RENDER), theme (studio) and shadows (on) were
already the defaults; edges was 'off' — make 'soft' the default.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* themes: fold light/dark into the scene theme (remove the separate toggle)
The viewer had two overlapping appearance controls: a light/dark `theme` toggle
AND scene themes (which already drive the 3D background + lights). They
conflicted — e.g. Night/Twilight are dark themes, but the light/dark toggle was
an independent axis still tinting the 2D scene chrome.
Unify on the scene theme: add an explicit `appearance: 'light' | 'dark'` to each
SceneTheme (twilight/night = dark, the rest = light) and drive everything the
old toggle drove off it — canvas backdrop, grid line colours, measurement-label/
cursor/site-edge contrast, the site ground fill, the ground occluder, and the
mobile viewer bg. The editor UI chrome is unaffected (always dark via a fixed
body class).
Removes the `theme`/`setTheme` store state (+ persistence) and every light/dark
toggle UI: the standalone toolbar Sun/Moon button, the community overlay theme
switch, the command-palette command, and the ifc-converter preview toolbar
button.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* themes: per-theme ground colour + add the "Verdant" nature theme
- Add a `ground` colour to every SceneTheme and drive the site ground fill +
the infinite ground-occluder off it (instead of the binary
isDark ? #1f2433 : #fafafa). Dark themes now get a lit mid-tone ground
(twilight #4a4566, night #2b3247) so the ground reads as ground rather than
going near-black.
- Add a new green/nature scene theme "Verdant": soft green sky + lit, with a
green roof clay tint and mossy ground.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* wiki: document the surface-colour / theme system
The colour-per-node/renderer/system model from the render-modes work was
undocumented. Add wiki/architecture/materials-and-themes.md covering surface
roles, colour presets, the textures axis, scene themes (appearance / ground /
clay tints), and the "untextured surfaces are theme-coloured in both modes"
invariant + where each kind wires it.
Also fix two pages that the same work made stale:
- node-definitions: geometry builders receive (shading, textures, colorPreset,
sceneTheme); document the `surfaceRole` token + applyDefaultSurfaceRole.
- layers: OVERLAY_LAYER (1, viewer) with EDITOR_LAYER now its alias, the new
GRID_LAYER (3, rendered in the scene pass for depth occlusion), and the
overlay pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* nodes: wire #330 roof-accessory kinds into the surface-role/theme colours
PR #330's new kinds (chimney, dormer, skylight, solar-panel, ridge-vent,
box-vent) use custom renderers, so the generic textures-off recolour path never
reached them — they fell back to hardcoded colours. Wire each renderer into the
render-modes system: read shading/textures/colorPreset/sceneTheme and resolve
untextured surfaces via createSurfaceRoleMaterial (and force the role colour when
textures are off), matching column/ceiling.
Roles: chimney body→wall / cap→roof; dormer wall→wall, roof→roof, glass→glazing,
frame→joinery; skylight glass→glazing / frame→joinery; ridge-vent + box-vent→roof;
solar-panel frame→roof (the dark product-specific cell face is left as-is). Each
definition also gets its dominant `surfaceRole` token.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(roof): legacy-roof migration must use a non-zero wallHeight
The render-modes/#330 merge left the legacy roof→roof-segment migration writing
`wallHeight: 0`. With #330's pitch model that builds a flat, zero-volume wall
CSG brush, which three-bvh-csg can't clip ("Coplanar clip not handled") and
yields NaN positions — so the migrated old roof never renders. Use the schema
default 0.5 (what new roofs use), giving a valid wall. The eave clamp + merged-
geometry NaN guard added earlier stay as defense-in-depth.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(roof): guard slope frame against missing/NaN pitch (no more NaN geometry)
getSegmentSlopeFrame used `pitch <= 0` to detect flat/zero-pitch, but an
undefined or NaN pitch (a segment from an older migration that set `roofHeight`
instead of `pitch`, or stale persisted data) slips past that check and computes
Math.tan(NaN) → NaN tanTheta/activeRh → NaN segment geometry → the merged-roof
CSG spews "Coplanar clip not handled" and NaN positions, so the roof never
renders. Use `!(pitch > 0)` so any non-positive/non-finite pitch resolves to the
flat frame. Self-heals bad data regardless of how the segment was produced.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(roof): migration guarantees a positive pitch for every roof-segment
Segments saved with neither a valid pitch nor a roofHeight (older/partial
saves, e.g. landing home-graph) fell through the legacy roofHeight->pitch
branch, leaving pitch undefined. The slope-frame guard then resolved them
to a flat frame, so the roof rendered as a slab instead of pitched. Branch
2b now normalises any segment lacking a valid pitch: derive from roofHeight
when present, else fall back to the schema default (40deg). The migration
result is cast (not zod-parsed), so this is the only place the default lands.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The package has no test files yet. `bun test` exits 1 ("No tests found!")
and fails CI; --pass-with-no-tests isn't honored by the bun 1.3.0 pinned
in CI. Match the convention used by @pascal-app/viewer (no test script):
turbo skips the test task for packages without one. The script comes back
when real tests land.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The package has no test files yet, so `bun test` exits 1 ("No tests
found!") and fails CI. Add --pass-with-no-tests so the task stays green
until real tests land, at which point they run normally.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two converter accuracy refinements:
- Recover plain IFCWALL height/thickness from geometry. These carry
Brep/mapped geometry that getBodyExtrusionData can't read, so measure
the mesh in the wall's own axis frame (along/across/vertical) — a
rotation-invariant projection rather than a world-space AABB (which
conflated a rotated wall's length and thickness). Gate on the measured
length matching the known wall length, and free web-ifc geometry
handles via try/finally on every path.
- Type columns from their IFC swept profile: IfcCircleProfileDef → round
+ radius, IfcRectangleProfileDef → rectangular + width/depth, falling
back to the width/depth ratio when the profile type is unknown.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Brings the IFC-to-Pascal converter into the monorepo as a pure-logic
package plus a Next.js app, replacing the standalone repo that consumed
published @pascal-app/* packages (and drifted from their schemas).
packages/ifc-converter — pure conversion. Parses IFC via web-ifc and
maps elements onto @pascal-app/core node schemas (workspace-linked, so
no more version drift). Builds doors/windows, walls, slabs, columns,
roofs, stairs, sites/buildings/levels. Validates each node via the real
Zod schemas at build time (tryParse) and strips undefined metadata.
apps/ifc-converter — the UI: drop zone, example picker, element search,
JSON download, and a 3D preview rendered through the real
@pascal-app/viewer (registry bootstrap + read-only scene) with a custom
toolbar (camera/level/wall/grid/theme), level selector with
camera-focus, auto-fit, and selection bridged to an inspector.
Conversion specifics worth noting:
- Door/window vertical centering (height/2; windows + sill).
- Nearest-wall hosting fallback for files lacking IFCRELFILLSELEMENT,
preferring walls long enough to contain the opening and clamping the
along-wall position so cutouts can't overflow and break wall CSG.
- Plain IFCWALL (Brep/mapped geometry) falls back to default
height/thickness instead of collapsing to zero-height slivers.
- Columns convert as plain structural shafts (no decorative
base/capital) sized from the IFC profile.
- Beams + items are skipped for now (no Pascal beam type; items need a
catalog asset) — counted in the conversion summary.
Large example IFCs are fetched from a public bucket at runtime; the four
small ones are committed. web-ifc.wasm is copied into public/ on
install/dev/build. README flags early-alpha + invites contributions.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Loading JSON previously called setScene blindly and crashed when
the file held schema-invalid nodes (e.g. items missing `asset`).
The new dialog parses the file, runs validateBuildJson in core,
and surfaces structure counts (site/building/levels/walls/doors/
windows/items/slabs/ceilings/zones/scans), floor area, and a
per-node Schema Details list grouped by type. Import is blocked
when any hard error exists.
Two schema bugs the validator surfaced are fixed here too:
- SiteNode.children is now an id array like every other node
(was a discriminatedUnion of full objects; three readers carried
a string-or-object ternary that's now dropped). migrateNodes
flattens legacy nested-object children on load. Default-scene
seed and photo-to-scene MCP builder updated to pass `building.id`.
- LevelNode.children now includes shelf — the editor allowed it
but the schema didn't. The schema-vs-registry-as-source-of-truth
discussion is captured in plans/editor-node-registry.md.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase 6 of the node-registry plan landed the @pascal-app/nodes package,
the three-checkbox composition model (def.geometry / def.renderer /
def.system), capability-driven move dispatch, and the deletion of
per-kind dispatch / per-kind files across viewer + editor. Update the
review skill so it catches reintroductions of those legacy patterns
and reviews registry-driven additions against the new contract.
- Add packages/nodes as the 4th layer in the package-boundary pass.
- Add a "Node registry & composition" checklist section.
- Require reviewers to read node-definitions.md and plugin-authoring.md.
- Flag new `case '<kind>':` clauses, kind-specific files in legacy
locations, framework imports of @pascal-app/nodes, force-routing
bespoke-move kinds through MoveRegistryNodeTool, useLiveTransforms-
driven drag motion, builders that import useScene, missing
`__fromGeometry` markers, and v1-plugin-surface overreach.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
251af2c added a `?.` on cursorRef in onGridClick but inadvertently
deleted the closing braces, the trailing reset block, and the
onKeyDown/onKeyUp/onCancel handlers — leaving onGridClick syntactically
unterminated and three undefined references at the emitter.on/off sites.
Restores the deleted block verbatim, keeping the optional-chaining null
guard on cursorRef.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The standalone editor app loaded `lib/bootstrap.ts` as a side-effect
import only from `components/scene-loader.tsx`. That worked for the
`/edit/[sceneId]` route but left every other page (homepage, settings,
viewer-only routes) hitting `<Viewer>` with an empty client-side
registry — node materials resolved to `null` and React surfaced a
`<html>`-level hydration mismatch on first paint.
Fix mirrors the community-app side that landed in pascalorg/private-
editor#27:
- New `app/client-bootstrap.tsx` — thin client wrapper that imports
`../lib/bootstrap` and renders children.
- `app/layout.tsx` mounts `<ClientBootstrap>` around `{children}` so
every page in the standalone editor gets the registry populated
before its first `<Viewer>` / `<Editor>` mounts.
- `lib/bootstrap.ts` switched to **synchronous** built-in registration
via `registerNode(def)` per kind instead of `await loadPlugin(...)`.
The previous async kick-off only resolved in a microtask, letting
the first SSR / hydration pass see an empty registry. External
plugin discovery (`discoverPlugins()`) stays async and runs via its
own `loadExternalPlugins()` path, gated by `externalsKickedOff` so
HMR doesn't re-fetch.
- `components/scene-loader.tsx` drops the per-page side-effect import
— the root provider handles it now.
`bun.lock` syncs `@pascal-app/editor` into `@pascal-app/nodes`'s
peerDependencies + devDependencies (already declared in
`packages/nodes/package.json`; only the lockfile lagged).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two follow-up fixes after the FloorElevationSystem landed:
- `viewer/src/components/viewer/index.tsx`: the auto-format hook
stripped the `FloorElevationSystem` import a second time, leaving
the JSX mount unresolved.
- `packages/nodes/src/column/definition.ts`: column stores Y rotation
as a scalar `number`, but `floorPlaced.footprint` types the rotation
field as the full Euler tuple. Wrap as `[0, column.rotation, 0]`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous commit's `floorPlaced` capability used `getScaledDimensions`
in `item/definition.ts` and `ColumnNodeType` in `column/definition.ts`,
but the editor's auto-format hook ran between the import edit and the
body edit and removed both as "unused" — breaking `bun dev`.
Re-add the imports.
Symptom: a shelf placed on a level with a raised slab underneath
visually clipped through it — `ItemSystem` lifted items onto slabs,
but shelves (and other floor-placed registry kinds) had no equivalent
path.
Fix: lift the slab-elevation logic out of `ItemSystem` into a generic
`<FloorElevationSystem>` keyed off a new `capabilities.floorPlaced`
config. Any kind that opts in declares a `footprint(node)` (dimensions
+ rotation used to query overlapping slabs) and an optional `applies`
predicate (skips items whose `asset.attachTo` is wall / ceiling).
The new system runs at frame priority 1 so its `mesh.position.y`
override lands before `ItemSystem` / `GeometrySystem` (priority 2)
clear the dirty mark. The spatial-grid sync's `markNodesOverlappingSlab`
also dropped its hardcoded `item` branch in favour of an iteration over
every registered kind that declares `floorPlaced` — so any new
floor-placed kind picks up slab-driven re-elevation automatically.
Tagged kinds:
- `item` — `footprint = getScaledDimensions`, `applies = !asset.attachTo`
- `shelf` — `footprint = (w, h, d)`
- `column` — `footprint = (w, h, d)`
- `spawn` — `footprint = (0.6, 1.8, 0.6)` (marker)
`ItemSystem` retains only the wall-side z-offset block (`mesh.position.z =
wallThickness / 2`). The elevation block + its `getScaledDimensions` /
`resolveLevelId` / `spatialGridManager` imports moved to the generic
system.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Final sweep after the layers, handlers, and state were dismantled —
pruning the remaining orphan types and constants that only the dead
code referenced.
Removed:
- 27 dead constants: `FLOORPLAN_*_HOVER_*_STROKE_WIDTH` for wall /
item / endpoint (consumed by the deleted legacy SVG layers),
`FLOORPLAN_WALL_OUTER_MEASUREMENT_*` + `FLOORPLAN_WALL_INNER_
MEASUREMENT_*` + `FLOORPLAN_OPENING_MEASUREMENT_*` palette
constants (no live measurement consumer), `FLOORPLAN_ITEM_
CLEARANCE_*` thresholds, `FLOORPLAN_MEASUREMENT_LABEL_*` / `LINE_
OUTLINE_*` + `FLOORPLAN_ACTION_MENU_OFFSET_Y` / `FLOORPLAN_NODE_
FOOTPRINT_*` / `FLOORPLAN_SPAWN_*` / `FLOORPLAN_TRACE_*_FILL_
OPACITY` + several `FLOORPLAN_WALL_*_STROKE_WIDTH` variants.
- Dead drag-state types: `SlabBoundaryDraft`, `SlabHoleBoundaryDraft`,
`SlabVertexDragState`, `SlabHoleVertexDragState`, `SlabHoleMoveDraft`,
`CeilingBoundaryDraft`, `CeilingVertexDragState`,
`CeilingHoleBoundaryDraft`, `CeilingHoleVertexDragState`,
`CeilingHoleMoveDraft`, `ZoneBoundaryDraft`, `ZoneVertexDragState`,
`WallFaceLine`.
- Dead helpers: `getWallMeasurementOverlay` + `getLinearMeasurementOverlay`
(both defined but never called now that the measurement layers are
gone).
Floor-plan panel: 9,006 → 8,651 lines (-355). Cumulative reduction
vs `main`: 17,913 → 8,651 (-9,262 lines, ~52%).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
After the legacy SVG layers and handler callbacks were dismantled, the
backing drag-state useStates, mirror useRefs, and watch-effects became
orphans, along with a handful of top-level math helpers whose callers
were already gone.
Removed:
- 12 dead `useState` declarations: `slabBoundaryDraft` /
`slabVertexDragState` / `slabHoleBoundaryDraft` /
`slabHoleVertexDragState` / `slabHoleMoveDraft` / `ceilingBoundary
Draft` / `ceilingVertexDragState` / `ceilingHoleBoundaryDraft` /
`ceilingHoleVertexDragState` / `ceilingHoleMoveDraft` /
`zoneBoundaryDraft` / `zoneVertexDragState`. All written only by
the dead vertex-drag handlers and read only by the dead
`clear*BoundaryInteraction` callbacks and `transientFloorplanFit`
checks (which collapse to `false` once their inputs are gone).
- 5 dead `useRef` mirrors of the above (`slabBoundaryDraftRef` etc.)
plus their mirror `useEffect` writes.
- 5 dead `clear*BoundaryInteraction` callbacks (slab, slabHole,
ceiling, ceilingHole, zone) — only called by deleted useEffects
and by `clearDraft`, where the call became a no-op.
- 7 dead `useEffect` watchers for `slabVertexDragState`,
`ceilingVertexDragState`, `slabHoleVertexDragState`,
`slabHoleMoveDraft`, `ceilingHoleVertexDragState`,
`ceilingHoleMoveDraft`, `zoneVertexDragState` (each early-returns
because state is always null, so all listener wiring + commit /
cancel paths inside were unreachable).
- 5 dead `shouldShow*BoundaryHandles` flags + the 5 `useEffect`s
that called `clear*BoundaryInteraction` when they flipped.
- `selectedSlabEditingHoleIndex` / `selectedSlabEditingHole` /
`selectedCeilingEditingHoleIndex` / `selectedCeilingEditingHole`
— derived from now-`null` selectedX entries.
- Dead drag-state guards in `handlePointerMove`, `handleSvgPointer
Move`, and the floor-plan fit `useMemo`.
- Dead top-level helpers: `getRaySegmentIntersection`,
`getSlabHandlePolygon`, `getSlabVisualOffsets`,
`getDraftSlabVisualPolygon`, `WallMeasurementFaceContext` type,
`getWallMeasurementFaceContext`, `getAdjacentOpeningBounds`,
`getSelectedWallMeasurementOverlays`,
`getItemDimensionMeasurementOverlays`, `polygonCentroid`.
Floor-plan panel: 10,466 → 9,006 lines (-1,460). Cumulative reduction
vs `main`: 17,913 → 9,006 (-8,907 lines, **~50%**).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Continuing the post-migration cleanup. After registry-driven kinds
absorbed selection chrome, action menus, and boundary editing through
`def.floorplanAffordances`, the legacy plumbing in `floorplan-panel.tsx`
was left mounted with empty inputs — another ~4k LoC of dead code.
Removed:
- `Editor2dFloorplanActionMenuLayer` mount + its 10 `selectedX
ActionMenuPosition` useMemos. All ten action menus computed positions
from empty entry arrays / null `selectedXEntry`, so the layer never
rendered anything. `FloorplanRegistryActionMenu` is the only mount left.
- Legacy handle layers: `FloorplanWallEndpointLayer`,
`FloorplanFenceEndpointLayer`, `FloorplanWallCurveHandleLayer`, and
the four `FloorplanPolygonHandleLayer` mounts for slab / slab-hole /
ceiling / ceiling-hole — all rendered from `wallEndpointHandles` /
`slabVertexHandles` / etc. which were empty after the registry took
over endpoint, curve, and polygon affordances.
- `FloorplanZoneLabelLayer` mount + component. Zone labels are now
emitted as `kind: 'text'` from `def.floorplan` on the zone kind.
- Dead handlers: every `handle*Select`, `handle*PointerDown`,
`handle*DoubleClick`, `handle*HoverChange`, `handleFloorplan*Hover
Enter`, `handleSelected*` (Move/Delete/Duplicate/AddHole/HoleMove/
HoleDelete/Curve for all 10 legacy kinds), `duplicateSelected*`,
`handleSelectedWallCurve`, `handleSlabVertex*`/`Midpoint*`/`Edge*`/
`Hole*` (same for ceiling and zone), `handleWallEndpointPointerDown`,
`handleFenceEndpointPointerDown`, `handleWallCurvePointerDown`,
`emitFloorplanNodeClick`, `syncDeleteHoveredId`,
`handleZoneLabelClick`, `hasDuplicatableFloorplanSelection`,
`handleDuplicateFloorplanSelection`, `FloorplanDuplicateHotkey` mount.
- Dead handle data: `wallEndpointHandles`, `fenceEndpointHandles`,
`wallCurveHandles`, `canCurveSelectedWall`, and all the
slab/slab-hole/ceiling/ceiling-hole/zone vertex+midpoint+edge handle
useMemos.
- Dead selection / measurement useMemos: `selectedItemEntry`,
`selectedOpeningEntry`, `selectedSpawnEntry`, `selectedFenceEntry`,
`selectedStairEntry`, `selectedRoofEntry`, `selectedElevatorEntry`,
`selectedWallEntry`, plus `selectedItemClearanceMeasurements` and
`movingOpeningPlacementMeasurements` (both 100-200 lines of math
that consumed the empty entries).
- Two dead `<FloorplanMeasurementsLayer>` mounts (clearance / opening
placement) — both fed by useMemos that returned `[]`.
- `<FloorplanZoneLayer>` mount — `visibleZonePolygons` is always empty.
Kept:
- `siteVertexHandles` / `siteMidpointHandles` + `<FloorplanPolygonHandle
Layer>` mount for site — site is the only kind not registry-driven.
- `FloorplanStairLayer` mount (preview-only, hover/click props swapped
for noop helpers since the preview isn't interactive).
- Stub `selectedSlabEntry` / `selectedCeilingEntry` / `selectedZoneEntry`
as `null` typed values so the remaining hole-editing fallback code
compiles. Those fallbacks themselves run as no-ops now and can be
torn down in a follow-up.
Floor-plan panel: 14,395 → 10,466 lines (-3,929). Cumulative reduction
vs `main`: 17,913 → 10,466 (-7,447 lines, ~42%).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Phase 5 / 6 migration moved 7 kinds (fence, column, spawn, item,
elevator, stair, roof) to the registry's `def.floorplan` path, but the
legacy SVG layers in `floorplan-panel.tsx` were left mounted with empty
entry arrays — dead code carrying ~3k lines of useless cost in the diff.
Removed:
- `FloorplanGeometryLayer` (~1.7k lines): inline component rendering
walls / slabs / ceilings / openings from `wallPolygons` /
`slabPolygons` / `ceilingPolygons` / `openingsPolygons` — all
permanently empty stubs after the migration. Wall / slab / ceiling
/ door / window now render via `FloorplanRegistryLayer`.
- `FloorplanFenceLayer` (~265 lines): fence entries always empty
post-migration; fence renders via the registry.
- `FloorplanElevatorLayer` (~420 lines): elevator entries always
empty post-migration.
- `FloorplanNodeLayer` (~415 lines): rendered items / spawns / stairs.
Items + spawns are registry-driven; stair only needed the in-flight
preview, which is now mounted directly via `FloorplanStairLayer`
(preserved as a sibling of the registry layer).
- `FloorplanItemImage` (~40 lines): internal helper used only by
`FloorplanNodeLayer`.
- `floorplan-roof-layer.tsx` (113 lines): roof / roof-segment now
registry-driven.
Net: -2,989 lines from `floorplan-panel.tsx`, plus the deleted roof
layer file. The remaining 14k-line monolith still owns the orchestration
state (selection lookups, marquee, helper lifecycles, hit-test plumbing)
— that's a separate teardown.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three bugs surfaced after the Stage E node-registry migration:
1. Ceiling intercepts 3D hover/click selection
Selecting via the floor-plan helper or the boundary-editor handles
is the intended flow; a direct 3D click on the ceiling should fall
through to whatever's underneath. `SelectionManager` now early-returns
on `ceiling` in onEnter/onLeave/onClick, so `event.stopPropagation`
is skipped and the ray reaches the item/wall/floor below.
2. Ceiling item placement: final click does nothing
When a ceiling-attached draft hangs in front of the ceiling-grid
mesh, the click ray hits the draft first and fires `item:click`,
not `ceiling:click`. `onItemClick` already forwards self-clicks to
shelf-surface / item-surface hosts; this PR adds the matching
ceiling branch so the commit lands on the ceiling under the cursor.
3. Floor-plan item move drift after the commit click
Two contributing causes, both fixed:
- `usePlacementCoordinator`'s `useFrame` lerped the draft mesh
toward `gridPosition.current` (the item's pre-move spot) every
frame, fighting React's render from `scene.position` while the
2D `FloorplanRegistryMoveOverlay` drove the move. Gated the lerp
on a `has3DPointerDrivenMoveRef` flag set on first 3D pointer
event — pure 3D drags are unchanged.
- The overlay's pointer-up handler skipped a final `session.apply`
and committed at the last pointermove position. Browsers don't
guarantee a pointermove right before pointerup, so a quick click
after a drag could land a few pixels off. Re-apply at pointer-up
coords so commit matches where the user actually released.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wholesale move of every remaining kind into its own subdirectory under
`packages/nodes/src/`, finishing the registry-driven migration. Each
kind now ships its definition, schema (re-exported from core), and any
of `geometry` / `renderer` / `system` / `floorplan` / `tool` /
`move-tool` / `panel` / `floorplan-move` / `floorplan-affordances` /
`parametrics` / `preview` it needs — no per-kind code remains under
`packages/editor/src/components/tools/` or
`packages/viewer/src/components/renderers/`.
Deleted (replaced by registry-driven equivalents):
- `tools/{ceiling,column,door,fence,item,slab,spawn,wall,window}/...`
(boundary editors, hole editors, placement tools, move tools,
endpoint movers, curve tools, helpers, math libs)
- `ui/helpers/{ceiling,slab,wall}-helper.tsx`
- `ui/panels/{column,door,elevator,item,roof,roof-segment,spawn,
stair,stair-segment,wall,window}-panel.tsx`
- `viewer/src/components/renderers/{building,ceiling,column,door,
elevator,fence,guide,item,level,roof,roof-segment,scan,site,slab,
spawn,stair,stair-segment,wall,window,zone}-renderer.tsx`
- `viewer/src/components/viewer/legacy-system.tsx`
Added under `packages/nodes/src/`:
- `building/`, `column/`, `elevator/`, `guide/`, `level/`, `roof/`,
`roof-segment/`, `scan/`, `shared/`, `site/`, `stair/`,
`stair-segment/` packages with definition + schema + renderer / system
/ floorplan / panel as appropriate.
- New `floorplan-move.ts` for every kind that supports 2D moves
(ceiling, door, item, shelf, slab, window) — single registry-driven
dispatch path via `def.floorplanMoveTarget`.
- New `floorplan-affordances.ts` for kinds with polygon / endpoint
drags (ceiling, fence, slab, wall) — using the shared
`polygon-vertex-affordance` factories.
- New per-kind `panel.tsx` for kinds with custom inspector content
(door, item, shelf, spawn, wall, window).
- New per-kind `tool.tsx` for placement (door, item, shelf, window).
- New per-kind `move-tool.tsx` for kinds with custom 3D move flows
(door, item, slab, window).
Coordinator + manager updates in `packages/editor/`:
- `tool-manager.tsx` resolves tools from the registry only — no
hardcoded type→component map.
- `panel-manager.tsx` resolves inspector panels the same way.
- `placement-{coordinator,strategies,types}.ts` extended with
shelf-surface placement.
- `selection-manager.tsx` adds the registry-selectable fallback.
- `floorplan-panel.tsx`, `floorplan-background-placement.ts`,
`floorplan-render-context.tsx` updated for the registry layer's new
contract (props, affordance dispatch, render context).
Viewer updates:
- `viewer/index.tsx` drops legacy renderer mounts.
- `node-renderer.tsx` resolves by registry only.
- `scene-bvh.tsx`, `use-node-events.ts`, `level-system.tsx`,
`wall-cutout.tsx`, `zone-system.tsx`, `materials.ts` adjusted for
the registry-only world.
Sidebar tree nodes for ceiling / fence / slab / shelf / tree-node
updated to read from the registered nodes instead of the deleted
legacy renderer trees.
Wiki: new `plugin-authoring.md` page, README index updated.
Tests in `packages/nodes/src/index.test.ts` validate every registered
kind has the required shape.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Captures the gotchas surfaced while building the shelf so the next
contributor adding a registry-driven kind doesn't rediscover them.
`node-definitions.md` — new Pitfalls section + a rule that builders
must emit local-space children. Covers:
- `<GeometrySystem>` must NOT mutate `group.position` / `group.rotation`
after rebuild (the renderer binds them via JSX prop).
- Tag geometry-built children with `userData.__fromGeometry` so
rebuilds don't dispose React-mounted hosted children (the
item-disappears-on-shelf bug).
- Previews must clone materials before mutating them when the kind's
builder caches at module scope.
- Host kinds need a `children: z.array(...).default([])` field on their
schema (and a migration patch for older scenes).
`tools.md` — three new move/placement pitfalls:
- Disable raycast on the moved mesh during drag, otherwise it captures
the ray and starves `grid:move` → commits land at the stale start.
- Commit handlers listen to `grid:click` AND every `${kind}:click` to
catch clicks that land on neighbouring 3D geometry first.
- Move tools must preserve the node's actual `rotation[1]` in
`useLiveTransforms` — hardcoding 0 makes the node un-rotate mid-drag.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two related bugs caused floor items to disappear mid-2D-drag:
1. `startLevelId` did `parent.parentId` unconditionally for non-wall
parents — so for a floor item parented directly to the level (the
canonical convention from `use-placement-coordinator`), it returned
`level.parentId = building.id`. `findContainingSurface` then iterated
the building's children (levels, not slabs) and the fallback
`parentId: startLevelId` reparented the item to the building. Now we
walk the parent chain until we hit a `level` and short-circuit on
`parent.type === 'level'`.
2. `buildSurfaceItemSession` reparented floor items to a slab when the
cursor was over one. Slabs don't carry a `children` field on their
schema (only ceilings + level do), so `updateNodesAction`'s reparent
logic operated on `undefined.children` — the item dropped out of the
level→children DFS the floor-plan layer walks, and the polygon
stopped rendering mid-drag. Split into `buildFloorItemSession`
(always parents to the level, just updates position) and a
ceiling-only `buildSurfaceItemSession`. `findContainingSurface`
narrows to `'ceiling'` as the only valid target.
Matches the 3D `detachItemSurfaceToFloor` convention: floor items live
as level children, not slab children.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>