editor: stop a hidden Site from emptying exports and the 2D plan - #907
Merged
Merged
Conversation
A layout whose root Site was saved with visible: false exported as an empty file: pruneHiddenSceneNodes inherited visibility up the parentId chain, so the Site's flag hid every building, level and node beneath it. The viewer never applies that flag (the Site renderer ignores it and the Site row has no eye toggle), so the editor showed the full house while the GLB held one empty scene-renderer node. The Site's own visibility now stops at the Site: hosted nodes keep their own flag, and a hidden Site drops only its ground fill and boundary. The declaredSiteParents map existed solely to cascade Site visibility to detached children, so it goes too. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…). Please try again, rephrase, or reach out if it keeps failing. Error id: 863d3c77-80fd-4915-89f5-0c4393865bd3 |
…lidators The GLB fix left the same ancestor walk in two 2D paths: the shared viewer's FloorplanPreview rejected every node under a hidden Site (an empty plan for the same layout), and isFloorplanHierarchyVisible gated site-scoped plugin kinds on the Site's flag for the PDF export and the live 2D view. One rule now lives in core: hidesDescendants(node) is false only for a Site, whose flag hides its own ground fill and boundary and nothing beneath it. The exporter, the plan preview and the 2D hierarchy gate read it. validate_scene returns a warnings list and flags a hidden Site with that note; Load Build (validateBuildJson) warns the same way, so an author who hides the Site learns what the flag does. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
A layout whose root Site is saved with
visible: falsecame out empty from every export while the editor showed the full house. Three code paths walked theparentIdchain and treated the Site like any other container, so its flag hid every building, level and node beneath it:pruneHiddenSceneNodesinglb-export.ts, which feeds GLB, USDZ, STL, OBJ, the print formats and the production bake. A 275-node house exported as a 184-byte GLB holding one empty node.isVisibleInFloorplanin the shared viewer'sFloorplanPreview, which left the public viewer's 2D tab blank for the same layout (0 of 198 level nodes passed against the real file).isFloorplanHierarchyVisible, which gated site-scoped plugin kinds on the Site's flag in the PDF export and the live 2D view.The viewer never applies that flag: the Site renderer ignores
visible, and the Site row in the sidebar has no eye toggle, so the state only arrives through the CLI, MCP or a hand-authored layout.One rule now lives in core,
hidesDescendants(node), false only for a Site: hiding a Site hides its own ground fill and boundary and nothing beneath it. The exporter, the plan preview and the 2D hierarchy gate all read it. ThedeclaredSiteParentsmap, which existed solely to cascade Site visibility onto detached Environment children, is gone.Because nothing told the author the flag was presentation-only,
validate_scenenow returns awarningslist (same{ nodeId, path, message }shape aserrors) and flags a hidden Site with that note, and Load Build (validateBuildJson) emits asite_hiddenwarning.wiki/architecture/node-schemas.mddocuments the rule.Hosts that implement
SceneBridge.validateScene(the hosted MCP bridge in private-editor) need to returnwarningstoo; that lands with the submodule bump.How to test
cd packages/editor && bun test src/lib/glb-export.test.ts src/components/viewer/floorplan-preview-visibility.test.ts src/components/editor-2d/renderers/floorplan-registry-layer.test.ts src/lib/floorplan/floorplan-export.test.ts— the new tests cover a hidden Site over a visible building/level/item for the exporter, the plan preview and the 2D gate, plus hidden buildings, levels and leaves still hiding.cd packages/mcp && bun test src/tools/validate-scene.test.ts— a hidden Site yieldsvalid: truewith one warning;cd packages/core && bun test src/validation/validate-build-json.test.ts— Load Build warns withsite_hidden.bun run buildin core and mcp;tsgo --noEmitin editor.visible: false(through MCPupdate_nodeor the layout JSON), leave "Export visible nodes only" on, and click Export GLB: the file contains the building. Open the shared viewer's 2D tab: the plan draws. Runvalidate_scene: one warning names the Site.Screenshots / screen recording
N/A — non-visual change in the export, plan-collection and validation paths.
Checklist
bun devbun checkto verify)mainbranchNot ticked: the in-app export and 2D tab were not exercised in a browser from this checkout; coverage is the unit suites above.
Note
Medium Risk
Changes visibility semantics across GLB/USDZ and floorplan export paths; behavior is centralized and heavily unit-tested but affects all visible-only exports.
Overview
Hiding a root Site with
visible: falseno longer cascades to buildings and levels. Core now exportshidesDescendants(false only forsite) andHIDDEN_SITE_NOTE, so a hidden Site affects only its own ground/boundary while children keep their own visibility flags.GLB export, the shared viewer floorplan preview, and live 2D / PDF floorplan hierarchy checks all use that rule instead of walking
parentIdand treating Site like any other container. Export pruning drops non–scene-node children under a hidden Site (parcel geometry) but keeps hosted building content; the olddeclaredSiteParentsSite-visibility map is removed.Validation surfaces the behavior: Load Build emits a
site_hiddenwarning, and MCPvalidate_sceneadds a non-failingwarningsarray (same shape as errors) for hidden Sites. Wiki node-schema docs describe the Site exception.Reviewed by Cursor Bugbot for commit f4dcdc2. Bugbot is set up for automated code reviews on this repo. Configure here.