Repository navigation
nodes: the floor plan draws hosted items where they sit in 3D - #1205
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Thanks @officialasishkumar. Drawing hosted items where they actually sit in 3D fixes a real floor-plan mismatch (related: #992), and the Codex review on 60e65f7 came back clean. |
60e65f7 to
53b7b69
Compare
|
Rebased onto current main and resolved the conflict in the item floorplan imports. Item, nodes and MCP tests and tsc pass locally. I haven't attached the before/after floor-plan screenshots yet. |
Aymericr
left a comment
There was a problem hiding this comment.
[Maintainer] Thanks @officialasishkumar. Reviewed at 53b7b69.
The direction is good: resolveItemTransform now asks restingNodePlanFrame for the pose the 3D scene uses instead of keeping a second, hand-written wall/roof/column calculation, and the net diff is smaller (+238 -266). The new level-frame-wall-mount.test.ts covers the three important cases (wall-side front/back face, wall body centre on a justified wall, roof-face item).
Before this can merge:
- Screenshots. This changes what the floor plan draws, which is visible behavior. Please add before/after screenshots of the floor plan with items hung on a wall (both faces), on an offset-justified wall, and on a roof face.
- CI.
CIhas not run on this head: fork workflows are waiting for maintainer approval, only Bugbot is green. - Check the removed cache.
resolveItemTransformlost itscacheparameter. Please confirm no caller still passes one and that the per-frame cost on a scene with many items has not regressed (a quick note on the number of items you tried is enough).
I am not blocking on the code itself; once the screenshots are in and CI is green this looks ready.
53b7b69 to
960b089
Compare
|
No caller passes one: only the old recursion used it, and as a fresh map per call it never cached across items. On a 2000 item scene (floor, wall, wall-side, shelf, nested and ceiling items) the shared frame took about 2.8 ms per full pass against 0.2 ms on main, so 960b089 has the item plan ask for a plan-only frame, which brings that to about 1.4 ms, and during a drag only the moved subtree rebuilds. |
|
Review at
This changes visible UI, so please attach before/after screenshots or a short clip. P0/P1: 0. CI hasn't run on this fork PR yet because it needs a maintainer to approve the workflow run; it merges once that's green. |
The item floor plan rebuilt each host's frame by hand in 2D (wall, item, shelf, roof face, block face), separately from core's nodeLevelFrame that the viewer, MCP and cabinet hosting already use. The two drifted apart: 76 of the 480 host/mount combinations listed in pascalorg#992 drew a footprint away from the item's committed 3D pose. - Block faces: nested shelves and items, and any item not placed at the face host's upright rotation, were composed from yaw alone, so a tilted face frame put them up to 0.6 m off. - Shelf on a wall: an item chain under a transformed wall shelf was composed through the shelf's level-local pose instead of the wall's, landing several metres away. - Roof faces: wall-side items used their stored face depth, while ItemSystem seats them on the roof wall surface. resolveItemTransform now reads the item's level frame through restingNodePlanFrame, so the plan uses the same pose the viewer mounts, for every host chain. To make that frame complete, core's item frame now applies the depth ItemSystem gives wall-mounted items: wall items sit relative to the wall body's centre and wall-side items on the chosen face of a wall or roof segment. This also corrects MCP world points for wall-side items, so their "on the wall centreline" approximation note goes, drops the two matching known limits from the frames doc, and drops two floor-plan move overrides that only copied the plan pose onto an identical frame. The roof case in floorplan-rendered-exits pinned the stored face depth; it now asserts the rendered pose like the wall and ceiling cases. New tests cover the failing chains against the mounted scene, the frame's wall-mount depth in core, and MCP measurement of wall-side items. Part of pascalorg#992 (the floor-plan half; the catalog drop on a standalone cabinet module is separate).
resolveItemTransform reads only X, Z and heading from the item's level frame, but restingNodePlanFrame resolved the full frame, including wall slab support, ceiling height and floor lift for every item. Let callers ask for a plan-only frame and use it for the item plan, so those heights are skipped. Positions in plan and all rotations are unchanged, and this roughly halves the cost of resolving an item's plan pose. restingNodePlanFrame keeps the full frame by default, since the floor plan move session reads its height.
…System Core's item frame and the viewer's ItemSystem each worked out where a wall-mounted item sits: a wall item off the wall body's centre, a wall-side item on the face of its wall or roof segment wall. Move that into getWallMountedItemZ beside the other wall frame helpers and call it from both, so the floor plan, MCP and the 3D scene read one rule. It returns null where the host leaves the stored depth alone, which is when ItemSystem leaves the mesh's z untouched; ItemSystem still reads a wall through its live override. A unit test pins the seated depths and the cases left alone, and the level frame tests stay as independent numeric checks.
960b089 to
dcf8e2f
Compare
|
P3 is done: the item frame and ItemSystem now share |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit dcf8e2f. Configure here.
| return { | ||
| x: f.position[0], | ||
| y: f.position[2], | ||
| rotation: Math.atan2(f.axes[2][0], f.axes[2][2]), |
There was a problem hiding this comment.
Tilted footprints ignore projected depth
Medium Severity
resolveItemTransform takes the plan heading from atan2 of the level frame's +Z axis, which keeps that axis's direction but drops its horizontal length. buildItemFloorplan still shifts a wall-side footprint by the full half-depth and draws the full depth along that heading. When +Z is tilted, as on a non-upright block face, the footprint moves by up to half the depth and no longer sits on the mesh.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit dcf8e2f. Configure here.
There was a problem hiding this comment.
Verified at dcf8e2f0: real but minor, and not a blocker. wall-side placement on a block face accepts normals with abs(normalY) <= 0.05 (packages/nodes/src/block/face-host.ts:33) and applies zero local rotation, so +Z can be slightly tilted. resolveItemTransform keeps only the heading, so buildItemFloorplan offsets the footprint by the full half-depth instead of the X/Z projection. The error is a small fraction of the depth for faces that pass that gate, and the half-depth offset predates this PR. Tracking as a follow-up: project the mounted bounds through the full frame and assert the emitted polygon corners.
Aymericr
left a comment
There was a problem hiding this comment.
LGTM at dcf8e2f0. Reviewed with Codex (gpt-6.2-astra) in two rounds, a full review and then each finding re-checked against the code. P0/P1: 0. Local CI replica (lint, i18n, types, tests, build, smoke, mcp, viewer-live) passes on a merge with current main.
The earlier P3 is fixed: getWallMountedItemZ is shared by core and ItemSystem. The contributor's reasons for leaving the P2s are acceptable for this PR:
- Depth cap: the 32-level guard is core's shared frame-walk guard. Normal placement is capped far below it, so this only matters for unusually deep legacy chains.
- Reference-floor overlay (
floorplan-panel.tsx:5839->items.ts:116): it's a pre-existing legacy path this PR doesn't touch. - Host previews: following a host during a drag is intentional.
Follow-ups, not blocking:
- Tilted block-face wall-side footprints (
floorplan.ts:54, Bugbot's finding): real but small, sinceface-host.ts:33only allowsabs(normalY) <= 0.05. Project the bounds through the full frame and assert the polygon corners. - PDF export (
floorplan-export.tsx:786/919->resting-surface-plan.ts:41):getEffectiveNode(parent)merges global live overrides, so an export during a wall drag can mix preview and committed poses. Use the supplied snapshot's host there. - Move the reference-floor overlay onto the shared item geometry builder.
- Allow deep item chains in
resolveItemTransforminstead of dropping the footprint at depth > 32.


What does this PR do?
Part of #992: the floor-plan half. The catalog drop on a standalone cabinet module is a separate problem and isn't changed here.
The item floor plan built each host's frame by hand in 2D (wall, item, shelf, roof face, block face). Core's
nodeLevelFrame, which the viewer, MCP and cabinet hosting use, builds the same frames separately, and the two had drifted apart. I restored the 480-case grid from the deleted differential, but checked it against the committed 3D pose instead of the frozen copy. It fails on exactly the 76 combinations listed in the issue:ItemSystemseats them on the roof wall surface, so they were off by half the wall thickness.Changes:
resolveItemTransformnow reads the item's level frame throughrestingNodePlanFrame. The plan uses the pose the viewer mounts, for every host chain, and about 230 lines of per-host 2D composition are gone.nodeLevelFrame(core) now applies the depthItemSystemgives wall-mounted items:wallitems are offset from the wall body's centre, andwall-sideitems sit on the chosen face of a wall or roof segment. Before this, the frame put them on the stored depth.node-world-point.tsis removed.floorplan-move.tsonly copied the plan pose onto a frame that's now identical, so they're removed.floorplan-rendered-exits.test.tsxpinned the stored face depth ("Production plan rendering uses stored roof-face Z…"). It now asserts the rendered pose, like the wall and ceiling cases do.New tests:
column-audit3.test.tsx: block-top, block-bottom, roof-face, shelf-on-wall and wall-back chains, three items deep. Each item's plan pose has to equal its mounted pose. Onmain, the first four fail and wall-back passes; wall-back guards the new core path.level-frame-wall-mount.test.ts(core): wall-side front/back faces, awallitem on a justified wall, and a wall-side item on a roof face. All four fail onmain.measure-world.test.ts(mcp): a wall-side item is measured on its face and isn't flagged as approximate. Fails onmain.How to test
mainthey drift off).mainit's half the wall thickness inward).bun --cwd packages/nodes run test,bun --cwd packages/core run test,bun --cwd packages/mcp run testandbun --cwd packages/editor run test.What I ran (Linux arm64, Bun 1.4.4):
maincheckout in my environment (Cannot find package 'undefined'from the bundle eval).check-typesfor core, nodes and mcp passes.bun checkreports no errors.Screenshots / screen recording
Not added yet.
Checklist
bun devbun checkto verify)mainbranchNote
Medium Risk
Touches shared frame math used by viewer, MCP, and floor plan; behavior change is intentional but broad across hosted item chains.
Overview
Unifies 2D floor-plan item placement with the same level-frame / 3D mounting path the viewer and MCP already use, fixing drift for nested hosts (block faces, wall shelves, roof wall-side items).
Adds
getWallMountedItemZin core and wires it throughitemFrame(nodeLevelFrame) andItemSystem, so wall and wall-side depths match rendering: body-centre offset forattachTo: 'wall', face Z for wall-side on walls and roof segments.resolveItemTransformdrops per-host 2D math (~230 lines) and reads the item pose viarestingNodePlanFrame(planOnly: true). Redundant plan-pose overrides infloorplan-moveare removed; MCP drops the wall-side “centreline” approximation. Docs and regression tests cover wall/roof mounts, MCP measure, and multi-host item chains (#992).Reviewed by Cursor Bugbot for commit dcf8e2f. Bugbot is set up for automated code reviews on this repo. Configure here.