Repository navigation
Conversation
…ed graph The baked viewer never loads the scene graph into useScene, so a bakeReplaceRenderer that builds from its parent (a ground surface needs its site's polygon and terrain) found nothing and drew an empty group, while GlbScene had already hidden the baked mesh: the kind vanished. BakeReplaceRenderer's component now takes an optional `resolve`, the same signature as GeometryContext.resolve. GlbScene takes the published graph's nodes (`sceneNodes`), builds one stable resolver and GlbReplaceInstances hands it to every renderer. Renderers that ignore it are unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What this changesNodes with
Start with |
What does this PR do?
For a user: in a published project's baked viewer, ground that a plugin draws from its site (painted surface, grass) now shows up. Before, the lot was an empty grey plane in the baked viewer, while the editor showed the grass.
Why it was missing: a kind with
bake: 'replace'has its baked mesh hidden byGlbScene, and is re-rendered live through itsbakeReplaceRenderer. That renderer only received{ nodes }. The baked viewer never loads the scene graph intouseScene, so a renderer that builds from its parent (a ground surface needs its site's polygon and terrain) found no parent and drew an empty group.What changes:
BakeReplaceRenderer's component takes an optionalresolve, with the same signature asGeometryContext.resolve.GlbScenetakessceneNodes(the graph the artifact was baked from), builds one stable resolver, andGlbReplaceInstancespasses it to every replace renderer. It's stable becauseGlbReplaceInstancesis memoized.wiki/architecture/node-definitions.md→ Bake policy documents the prop.Compatibility: no schema change, so saved scenes and existing bakes load as before (E-003). A renderer that ignores
resolvebehaves exactly as today, and a host without the graph just omits it. Plugins keep loading (E-010).Test (T-001): one repro in the existing
plugin-dispatch.test.tsx. It mounts a replace renderer with an emptyuseSceneand checks that it resolves its parent throughresolve.How to test
How to see it, once a host passes
sceneNodesand the plugin readsresolve(merge order below):lod0.glbpath): the grass is drawn. Before this change, only the lot outline showed, on grey.Checks run on this branch:
bun test packages/viewer/src/components/viewer/plugin-dispatch.test.tsx: 6 pass. Full viewer suite (bun test srcinpackages/viewer): 510 pass.bun run check(Biome): exit 0, warnings only.turbo run check-types --filter=[132c029b](core, viewer): 2/2 successful.E2E_BASE_URL=http://localhost:3106 dotenv -e .env.local -- playwright test e2e/community/baked-viewer-environment-terrain.spec.ts.environment:surface-materialandenvironment:ground-coverboth missing from the baked viewer.Merge order
resolve, falling back touseScene.sceneNodes, and bumps this submodule and the plugin ref.If this PR is squash-merged, the host's submodule pointer (dd4f780) must be re-bumped to the squash commit before step 3.
Screenshots / screen recording
Local before/after captures, not committed (to be dragged in):
before-baked-viewer.png: baked viewer, the lot outline on a grey, empty ground.after-baked-viewer.png: the same view, the painted grass surface fills the lot.before-editor-live.png/after-editor-live.png: the editor's live view, identical, grass in both.Checklist
bun devbun checkto verify)mainbranch🤖 Generated with Claude Code