lecodes-3d-editor
v0.8.0
Published
LeCodes Scene Editor — the visual .scene.ts editor (Vue components + a standalone host). Embedded by the platform frontend as raw source; hosted on local files by the lecodes CLI (`lecodes scene`), like lecodes-design.
Readme
lecodes-3d-editor
The visual .scene.ts 3D scene editor (node tree | GL viewport | schema-driven inspector) as an
embeddable Vue component — the editor half of docs/scene-editor-plan.md. Package directory:
packages/lecodes-3d-editor.
Standalone playground (no platform, no auth)
bun run dev # edits dev/demo (a sample scene + user aspect)
SCENE_DIR=/path/to/project bun run dev # edit any folder containing .scene.ts filesCompiles run in-process through the SDK pipeline (@letary/chisel, or LECODES_CHISEL_BIN for a
local chisel build), with the exact virtual-entry composition the platform backend uses
(sdk/compile → sceneEditorEntries), so behavior here matches production. File text is polled,
so editing the scene in your IDE re-runs the viewport.
Materials, shaders, assets (docs/scene-materials-plan.md)
- The asset drawer under the viewport lists every project asset in tabs (All · Models · Images
· Materials · Prefabs — shaders sit in Materials), grouped by folder. A tile selects the asset
for the inspector; models/prefabs also arm click-to-place; any tile drags into the viewport
(models place, materials/shaders paint whatever they land on) or onto an object field.
Thumbnails: models and materials render through the hidden preview host on the open scene's
bundle; a prefab compiles its OWN scene file (
SceneSource.compileScene) and is captured whole (harness.frameAll, a temporary sun when the file has no light). Missing material/prefab previews render on first show; "Refresh Preview" re-renders any of them. - Every mesh node has a Material card: the picker says what it is (Lit / Unlit / Shadow
catcher / a project
.matshader / a material asset), the parameter rows follow — a custom shader's rows come fromparseShaderSchema(sdk/compile) reading@color @range @step @defaultannotations in the.mat. Parameter edits go live throughharness.setMaterialParam. - Material assets (
materials/*.material.ts,defineMaterial) are shared instances; editing one in the inspector rewrites its file and every user follows live. "Save as asset…" moves an inline material into a file. GLB parts show one card per primitive slot (names from the GLB's own JSON —glbSlots.ts) and persist asoverrides['part'].materials[slot]. - Hosts feed this through
SceneSource.images/materials/shaders/readText/writeText/shaderUrl(the HTTP hosts serve/api/shader— the lite JSON built on the fly, or the CLI host's compiled artifacts; the platform host reads the asset's compiledshaderslist).
Embedding
import { SceneEditor, type SceneSource } from "lecodes-3d-editor"The host supplies a SceneSource per scene file (reactive text(), write, edit-mode
compile(), project aspects()) — see src/types.ts. The platform frontend backs it with the
editor store + GET /api/projects/:uuid/scene/compile; this playground backs it with a local
folder. A future lecodes scene CLI command can reuse the same pieces (like lecodes-design).
Theme comes from the host's CSS variables (--bg, --surface, --border, --text, --dim,
--accent, …) with dark fallbacks baked in.
