The spacebar branch in onkeydown called switchCameraView; remove it
along with the now-unused switchCameraView callback param/field. Editor
no longer passes that arg into MouseControls' constructor.
Drops the remaining 1-line forwarders on Editor and rewires their
callers to talk to the owning subsystem directly.
Inlined at call sites then deleted:
- updateOutliner → selection.refreshOutliner (3 actions/* callers)
- publishSelect → selection.publishSelect (1 action + helper.ts)
- updateSelectedUI → selection.updateSelectedUI (in-engine callers)
- cacheScene → save_manager.getSceneJson (EngineProvider)
- setColor → activeScene.setColor (ControlPanelSceneObject)
- isObjectLipsync deleted entirely (zero callers)
Relocated:
- lockUnlockObject + isObjectLocked moved onto SelectionBridge. The
bridge gains a SelectionBridgeDeps surface for the userData mutation
(still in SceneUtils as toggleObjectLocked) and the gizmo
attach/detach. Callers (Outliner, ControlPanelSceneObject) now go
through editor.selection.
- setSelectedObject (which despite the name wrote position/rotation/
scale onto the active selection) becomes
SceneManager.updateSelectedTransform — same data ownership, no more
reverse dependency from helper.ts into sceneManager.selected_objects.
helper.ts shrinks to removeTransformControls, isObjectLocked,
toggleObjectLocked, getSelectedSum, deleteObject. The pre-existing
TS errors in deleteObject (Mesh.texture / Material[] dispose) are
untouched — out of scope for this refactor.
GizmoController now reads/writes the store's transformSpace through a
new GizmoControllerDeps surface that Editor wires up in initialize().
- changeMode(type) reads the desired space from the store internally
(forces local for scale), so callers don't plumb space through.
- toggleTransformSpace() owns the read/flip/write/apply loop that used
to live on Editor.toggleTransformSpace.
Editor.change_mode and Editor.toggleTransformSpace are deleted.
Callers updated:
- actions/setTransformMode.ts → editor.gizmo.changeMode(...)
- Controls3D.tsx → editorEngine?.gizmo.toggleTransformSpace()
- keymap.ts → editor.gizmo.changeMode + .toggleTransformSpace; the
inline setGizmoMode body shrinks to one line and the duplicate
toggleTransformSpace helper is gone.
CameraController now owns switchCameraView. The body lifted from
SceneUtils.switchCameraView gets cross-subsystem capabilities
(scene access, transform-controls removal, selection write,
editor-state and object-panel store actions) through a new
CameraControllerDeps object that Editor wires up in initialize().
This keeps subsystems from importing each other directly: the
controller sees a narrow callback surface, not SelectionBridge or
SceneUtils. Same precedent as the existing ViewportController setters.
Deletes:
- SceneUtils.switchCameraView (helper.ts)
- Editor.switchCameraView facade
The space-bar handler in MouseControls now points directly at
cameraController.switchCameraView via the callback Editor passes in.
Removed Editor fields/methods left over from a removed video-export
feature: rendering, switchPreviewToggle, processingRecording,
processingHasFailed, recorder, globalSetTrackLengthSeconds,
startRenderHeight/Width, selectedCanvas, togglePlayback, updateLoad,
showLoading, endLoading. Every read of these flags was permanently
false; whole branches in renderScene/renderSingleFrame were unreachable.
The space-bar handler in keybinds_controls.ts was also dead today
(selectedCanvas was never set true) — rewired it to call
editor.switchCameraView() directly via a callback so pressing Space
toggles camera view as intended.
MouseControls' constructor drops the four dead params (selectedCanvas,
switchPreviewToggle, rendering, togglePlayback) and gains a single
switchCameraView callback in their place.
Owns the camera state, FreeCam plumbing, render aspect ratio, and the
per-frame camera tick. The camera-side of renderSingleFrame now reduces
to a single cameraController.tickPerFrame(delta) call that handles the
FOV-from-store sync, FreeCam integration with store write-back, the
camera_person_mode cam_obj transfer, and the render_camera mirror.
Editor still constructs the cameras and lockControls during initialize()
because they need the renderer's domElement, but the fields land on
cameraController. External callers in helper.ts, save_manager.ts,
useFreeCam.ts, setCameraAspect.ts, and ControlsTopButtons.tsx now reach
through editor.cameraController; no Editor-level forwarders.
editor.ts: 1074 -> 941 LOC.
Fourth step of the editor.ts decomposition. Pulls the engine→store
selection-and-outliner sync surface out of Editor into a dedicated
module.
SelectionBridge owns:
selected (current inspected object)
last_selected_sum (frame-to-frame transform-change check)
Methods take their dependencies as method arguments / closure-based
deps — no `editor` reference, no `import type Editor`, no circular
import. Constructor takes:
getSceneManager: () => SceneManager | undefined (lazy — created later)
cameraName: string
version: number
Methods:
setSelected, publishSelect, updateSelectedUI, refreshOutliner,
updateOutliner, getAssetType, getCharactersByUuid, isCharacterUuid.
Editor exposes the bridge as `editor.selection` and constructs it in
its constructor. Three facades stay on Editor for the external callers:
editor.publishSelect() — actions/selectObject.ts, helper.ts
editor.updateOutliner() — actions/add{Object,Character,Shape}.ts
editor.updateSelectedUI() — helper.ts
ControlPanelSceneObject reads `editor.selected` via a forwarding getter
that returns this.selection.selected.
The four near-identical "render_outliner + setOutlinerItems" snippets
that used to live in Editor.initialize / newScene / loadScene /
deleteObject collapse into one place: selection.refreshOutliner().
Dead code removed during the move:
- outliner_feature_flag was hardcoded `true` (with `// TODO REMOVE`),
making the false-branch fallback paths in updateSelectedUI /
publishSelect unreachable. Field and all `if` branches dropped.
- Editor.last_selected: passed by value to MouseControls (which
immediately overwrites it with []), and helper.ts wrote to it but
nothing read. Pure write-only dead state.
- The `return 0` on a void-returning method that triggered the
"Not all code paths return a value" typecheck error — gone with
updateSelectedUI's body.
- Unused AssetType / ClipGroup imports in editor.ts.
helper.ts updates:
- removeTransformControls drops the dead last_selected write.
- switchCameraView and deleteObject now write
editor.selection.selected (instead of editor.selected) so the
forwarding getter still surfaces the current value.
Net: editor.ts down to ~1074 LOC. Typecheck baseline drops by 1
(the void-return error is gone).
Third step of the editor.ts decomposition. Pulls TransformControls
ownership and the gizmo lifecycle out of Editor into a focused module.
GizmoController owns:
control (TransformControls).
Methods take their dependencies as method arguments — no `editor`
reference, no `import type Editor`, no circular import:
configure(camera, domElement, scene, callbacks)
changeMode(type, space)
setSpace(space)
canToggleSpace()
attach(object), detach()
addToScene(scene), removeFromScene(scene)
setVisible(v), isVisible()
Editor exposes the gizmo as `editor.gizmo` and constructs it empty in
the constructor; configure() is called from initialize() once camera
and renderer exist. The two existing public methods stay on Editor as
facades, so the external callers (actions/setTransformMode.ts,
comps/Controls3D.tsx, engine/keymap.ts) keep working unchanged:
Editor.change_mode reads the store's transformSpace and forwards.
Editor.toggleTransformSpace toggles the store and pushes into gizmo.
External readers updated:
helper.ts (SceneUtils.lockUnlockObject + removeTransformControls)
routes through editor.gizmo.attach/detach/addToScene/removeFromScene
instead of poking editor.control directly.
Editor.snapShotOfCurrentFrame uses editor.gizmo.setVisible /
isVisible instead of touching control.visible.
Editor passes editor.gizmo.control to the MouseControls constructor
where it previously passed editor.control.
Dead code removed:
- transform_interaction on Editor: passed by value to MouseControls
(which has its own internal copy that overrides) and the `= true`
write in change_mode mutated a field nothing read. Pure dead code.
- The "if (this.control == undefined) return;" guard immediately
after `new TransformControls(...)` — that branch was unreachable.
- Unused TransformControls import in editor.ts.
Net: editor.ts down to 1196 LOC. Typecheck error count drops by 3.
Second step of the editor.ts decomposition. Pulls both EffectComposer
chains (main + raw) and the post-process passes the editor actually uses
out of Editor into a dedicated subsystem.
PostProcessingPipeline owns:
composer, render_composer, outlinePass, customOutlinerPass, surfaceFinder.
Methods take their dependencies as method arguments — no `editor`
reference, no `import type Editor`, no circular import:
configureMain(renderer, scene, camera, w, h)
configureRaw(rawRenderer, scene, renderCamera, w, h)
resize(w, h)
dispose()
updateSurfaceIdAttributeToMesh(scene)
Editor exposes the pipeline as `editor.postProcessing` and constructs it
in the constructor (empty) before Scene, since Scene's load paths invoke
updateSurfaceIdAttributeToMesh as a callback. The Scene constructor now
receives a closure that dispatches into the pipeline.
ViewportController stays decoupled from composer internals: PR 1's
resizePostProcessing callback now delegates to postProcessing.resize(w, h),
which encapsulates the optional-chaining dance for composers that may not
exist yet at the first resize.
External readers updated:
helper.ts (SceneUtils.removeTransformControls) reads
editor.postProcessing.outlinePass instead of editor.outlinePass.
Editor.snapShotOfCurrentFrame and Editor.renderScene route through
editor.postProcessing.composer / .render_composer.
Editor.unmountEngine calls editor.postProcessing.dispose() instead of
the two composer.dispose() calls.
Dead code removed during the move:
- bloomPass (created but never added; the addPass call was already commented out)
- smaaPass, ssaoPass (declared but never instantiated)
- renderPass, rawRenderPass, outputPass, renderOutputPass fields (only
added to a composer once, never read again — now locals)
- setRenderDepth, setNormalMap, setOutlineRender (no callers — only
setColorMap was called from configureRaw, and it's now inlined)
- the corresponding three-of-four `Material` uniforms typecheck errors
- 9 unused three.js imports in editor.ts
(EffectComposer, RenderPass, OutlinePass, OutputPass, SMAAPass,
SAOPass, UnrealBloomPass, CustomOutlinePass, FindSurfaces, SSAOPass)
Net: editor.ts loses ~140 LOC and the post-processing concern entirely;
typecheck error baseline drops by 4 (3 dead mode setters + 1 unused
import).
First step of the editor.ts decomposition (refactor/3d-editor-cleanup).
Pulls the canvas/container DOM seam, the ResizeObserver, and the resize
cascade out of the ~1450-LOC Editor class into a standalone module.
ViewportController owns container, canvReference, canvasRenderCamReference,
the ResizeObserver, lastCanvasSize, plus the onWindowResize / observed
resize logic.
Engine fields are forwarded explicitly through the `engine` constructor
argument:
- cameras, renderer, render aspect ratio: closure-based getters that
resolve at call time
- post-processing: a single resizePostProcessing(w, h) callback rather
than three composer field getters
The single callback is deliberate. The original code creates the main
composer in _configurePostProcessing but the raw composer + custom
outline pass much later in _configurePostProcessingRaw, with the first
viewport.onWindowResize() landing between the two. Three separate
composer getters would have ViewportController peeking at fields that
don't exist yet at that first resize and silently no-op'ing via `?.`.
The callback hides that lifecycle concern inside the post-processing
module, where it belongs.
No `import type Editor`, no circular import. The dead `update*` and
`*MayReset` accessors that the original code carried as defensive
fallbacks (with self-deprecating "we should not need this" comments)
were never actually called and are dropped here. containerMayReset
stays — it has live internal callers.
Editor exposes the controller as `editor.viewport` and routes its
internal call sites through `this.viewport.<method>()`.
Net: editor.ts loses ~107 lines and one cohesive responsibility.
The last batch of PageScene-owned signals — `is3DPageMounted`,
`is3DEditorInitialized`, `is3DSceneLoaded`, and the three canvas-ref
signals (sceneContainer, editorCanvas, camViewCanvas) — now live on
the Zustand store. EngineProvider, the canvas components, the
useEditorCanvas hook, and the cross-app TopBar consumer all read from
the store instead. The helper signals in editor.ts are gone; the
`set3DPageMounted` / `setIs3DEditorInitialized` / `setIs3DSceneLoaded`
exports stay as thin wrappers around the store actions for existing
callers.
PromptBox3D and CameraSettingsModal now accept plain values + setters
instead of `Signal<T>` props. The camera/focalLengthDragging/
isPromptBoxFocused signals are gone — store is the single source of
truth. Engine code (editor/save_manager/scene) reads/writes via
`usePageSceneStore.getState()` and store actions. Demo asset signals
are now plain constants (they were never reactive).
api_manager.ts goes from 460 lines to ~135. The video-render
pipeline (uploadMediaFrameGeneration, stylizeVideo,
StylizeVideoParams, getMediaBatch, getMediaFile, uploadMedia,
gltfExport) was unreachable after videoGeneration was deleted.
Surviving public methods:
- saveSceneState (called by save_manager)
- loadSceneState (called by save_manager)
- uploadMediaSceneThumbnail (used internally by saveSceneState)
Also drops the local ArtStyle / Visibility / MediaFile types —
they only fed the deleted methods. The ArtStyle enum has a
separate copy in ~/enums/ArtStyle.ts that other code uses.
Delete two files that became unreferenced:
- engine/APIManagerResponseError.ts (duplicate of the local class
in api_manager.ts; nothing imported it)
- models/generationOptions.ts (IGenerationOptions/GenerationOptions
fed editor.generation_options, deleted last commit)
Net: -1 typecheck error, -326 lines.
Files with zero importers across the artcraft app:
- constants/RandomTexts.ts — RandomTextsPositive/Negative seeded
prompt suggestions in the deleted StylizeTab.
- composable_engines/scene_format.tsx — empty (1 line).
- constants/page.ts and the matching currentPage signal in
signals/global.ts — Pages enum + signal, neither read.
- enums/StylizeTabPages.ts and enums/AudioTabPages.ts — re-exported
via enums/index.ts but no consumer.
- models/track.ts, models/message.ts, models/voice.ts, models/tts.ts
— timeline / TTS / audio-panel types from deleted features.
- styleList.ts — used to seed selectedArtStyle's default; that
store field is gone.
- models/types.tsx had a duplicate AudioTabPages enum (separate
from the deleted one in enums/) — drop the duplicate too.
models/index.ts and enums/index.ts trimmed to match. Error count
unchanged (151) — none of these had broken type errors anyway.
Strip the stylize fields that nothing reads anymore now that the
StyleMoreOptions / StyleSelection UI is gone. From PageSceneStore:
selectedArtStyle, upscale, faceDetail, styleStrength, lipSync,
cinematic, enginePreProcessing, globalIPAMediaToken, adapterImage,
positivePrompt, negativePrompt, isUserInputPositive,
isUserInputNegative, showNegativePrompt — and the matching setters
+ resetSceneGenerationMetadata. Drop the styleList / ArtStyle
imports; both go unused here.
From editor.ts: drop negative_prompt, art_style,
engine_preprocessing, generation_options, globalIpAdapterImage.
Keep positive_prompt — PromptBox3D writes it via setEnginePrompt
(PageEditor.tsx) and save_manager round-trips it.
Trim save_manager.loadFromJson to the prompt-only path (legacy
saves with stylize keys load fine; the now-removed if-guards just
silently ignored them anyway). Trim SceneMetadata to
{ positivePrompt, cameraAspectRatio } and the matching
SceneGenereationMetaData interface.
ControlsTopButtons.handleResetScene drops its now-removed store
call.
Both component trees survived earlier cleanup but never render
from PageEditor or PageScene. They were the last UI consumers
of the stylize store fields; deleting them sets up a follow-up
that drops those store fields entirely.
Net: -17 typecheck errors (the orphan files were the source of
many missing-import errors).
cardLayout.ts, MoodboardHtmlColorPicker.tsx, findDropTarget.ts, and
CardNodeHtml.tsx were swept into the PageEnigma -> PageScene rename
commit (76add858c9) on this 3D-refactor branch. They belong on
moodboard-page-html.
The file content is preserved on the local-only moodboard-rescue
branch (pointing at 01e0e27037). To carry them back over:
git checkout moodboard-page-html
git checkout moodboard-rescue -- frontend/apps/artcraft/app/src/pages/PageMoodboard/cardLayout.ts frontend/apps/artcraft/app/src/pages/PageMoodboardHtml/MoodboardHtmlColorPicker.tsx frontend/apps/artcraft/app/src/pages/PageMoodboardHtml/interactions/findDropTarget.ts frontend/apps/artcraft/app/src/pages/PageMoodboardHtml/nodes/CardNodeHtml.tsx
git commit
The Enter Pose Mode button reached through a window.__mouseControls
global handle that MouseControls' constructor set up. With
getActiveEditor() already exposing the live editor instance for
non-React callers (used in the camera-view toggle, the keymap),
the global is unnecessary.
Drop the (window as any).__mouseControls = this assignment in
MouseControls and the matching Window augmentation in
PoseModeSelector. Replace the click handler's reach with
getActiveEditor()?.mouse_controls?.toggleFKMode() — same shape
the keymap entry already uses.
The Tab interface in this file was the type for the deleted
SidePanel/tabList.tsx tab list. Grep across app/src/ confirms no
consumer remains; AssetModal uses its own local AssetTab type.
Drop the file and the matching re-export in models/index.ts.
EditorStates is no longer referenced from editor.ts now that
PREVIEW is gone from the enum and switchPreview/switchEdit are
deleted. EngineCanvases.tsx never used useContext/EngineContext;
the imports were leftover from earlier work.
Net: -3 typecheck errors.
The mouseOverEventHandler / enableFreeCamControls /
disableFreeCamControls trio existed to track when the cursor was on
the viewport canvas and toggle FreeCam.enabled. With useFreeCam
gating itself on editorState === CAMERA_VIEW, that gate is
redundant; the only remaining consumer of selectedCanvas was
MouseControls.onkeydown's space-bar branch, which is unreachable
after the previous keyboard rewrite.
Removes the last document.addEventListener call from PageScene.
Replace MouseControls.onkeydown's giant if-else chain with a
declarative keymap:
- engine/keymap.ts: KeyBinding type + buildKeymap() returning every
one-shot viewport shortcut as one entry. Each carries label /
group metadata so a future Ctrl-hold cheatsheet overlay can read
the same array. dispatchBinding() does the modifier match
(treating Ctrl and Meta as equivalent for macOS).
- hooks/useViewportKeyboard.ts: attaches a single keydown listener
that gates on hotkeyStatus + editable-element checks, then walks
the keymap. Held movement keys (W/A/S/D etc.) live in useFreeCam
since they're continuous; this hook is for one-shots only.
The listener is on document, not the canvas, deliberately: canvas
focus is finicky and would require the user to click the viewport
before T/R/G work. The editable-element guard prevents the keymap
from firing while inputs are focused.
MouseControls.onkeydown is now unreachable (SceneManager's window
listeners are no-op since the previous commit, and useViewportKeyboard
goes straight to keymap dispatch). The class itself stays for now —
it still implements selection / FK / pointer-lock state.
The old SceneManager.attachEventListeners() attached window-level
mousemove / click / mousedown / mouseup / keydown handlers in dev
mode and dispatched them into MouseControls. Replace with two pieces:
- hooks/useViewportPointer.ts: canvas-scoped pointer listeners
that call into editor.mouse_controls. NDC pointer coords are
computed via the new engine/pointer.ts helpers (ndcFromClient,
applyNdcToVector2). Selection clicks suppress while the
free-cam owns input (CAMERA_VIEW state).
- engine/pointer.ts: pure NDC coordinate translation, no DOM
side-effects.
SceneManager.attachEventListeners / detachEventListeners are now
no-ops; kept for back-compat with the editor lifecycle so future
follow-ups can carve them out cleanly.
MouseControls itself still owns selection / FK / drag state — its
dispatch methods (onMouseMove, onMouseClick, etc.) are now invoked
by the React hook instead of window listeners. A future PR can
dissolve MouseControls further; the goal here is "no window
listeners" + "React owns lifecycle".
The 446-line FreeCam class is gone. Its responsibilities split:
- Math (move/rotate vectors, pan/zoom from inputs, lookAt) lives in
cameraMath.ts as pure functions, plus a freeCamFrameTick() that
integrates the per-frame state.
- Listener attachment + drag/key state ownership moves into
hooks/useFreeCam.ts. Listeners are scoped to the canvas (no
window/document handlers); held-key state is reset on
CAMERA_VIEW exit so a stale W keypress can't drift the camera.
- The shared FreeCamControlState struct flows through Editor via
editor.setFreeCamState(state); the render loop reads it and
calls freeCamFrameTick() each frame.
Side effects: keybinds_controls.ts now imports
isPointerLockSupported from browserChecks; helper.ts and
PageEditor's camera-select handler stop poking
.cameraViewControls and reset velocity via freeCamState instead.
PreviewEngineCamera's camera-view toggle now just flips the store
state — useFreeCam picks it up on its own (no more
enableFreeCamControls/disableFreeCamControls call site).
Pure-function helpers carved out of FreeCam in preparation for the
hook rewrite:
- engine/cameraMath.ts: HeldMoveKeys / HeldRotateKeys types,
moveVectorFromKeys, rotationVectorFromKeys, panFromDrag,
zoomFromWheel, lookAtFromCamera, lerpVelocity. No DOM access, no
signals.
- engine/browserChecks.ts: isSafariOrWebKit, hasApplePay, isSafari,
isPointerLockSupported. Unrelated to camera math; were just
hitchhiking in free_cam.ts.
free_cam.ts re-exports the browser checks for back-compat with
keybinds_controls.ts; both consumers will switch to the direct
imports when free_cam.ts is deleted in the next commit.
The Phase 6 hooks (useFreeCam, useViewportPointer, useViewportKeyboard)
need a React-shaped accessor for the canvas DOM node so their
useEffects re-run when the canvas mounts/unmounts. Promote the
existing editorCanvasSignal / camViewCanvasSignal into useEditorCanvas
/ useCamViewCanvas hooks that bridge signal -> React state via a
subscribe.
Add tabIndex={0} and outline:none to the editor canvas so it can
receive keyboard focus without showing a focus ring.
handleButtonCameraView in PreviewEngineCamera was a TODO no-op.
Flip editorState (EDIT <-> CAMERA_VIEW) via the store, then call
editor.enableFreeCamControls() / disableFreeCamControls() on the
active editor. Drop the stale console.log useEffect that fired on
every state change.
The 3D editor no longer generates videos. Remove:
- engine/video_generation.ts (the VideoGeneration class)
- comps/GenerateModals/ (modal + MyMovies/Sharing/Activity/cards)
- comps/PreviewFrameImage.tsx (PREVIEW-state-only preview overlay)
- comps/ControlsTopButtons/TestFeaturesButtons.tsx (dev-only,
rendered with debug={false})
- ~/components/signaled/TopBar/MyMoviesButton.tsx (was orphaned;
no consumer)
editor.ts: drop the VideoGeneration import, field, instantiation,
and the dead helpers it powered (useCachedMediaTokens,
stopPlaybackAndUploadVideo, switchPreview/switchEdit, generateFrame,
generateVideo, checkAndUseCache).
PageSceneStore: drop previewSrc/viewMyMovies/generateMovieId/
generateProgress fields and setters.
EditorStates: drop the PREVIEW variant; PageEditor's state machine is
now EDIT <-> CAMERA_VIEW only. PREVIEW was set only by the deleted
video_generation.ts and read by PreviewFrameImage (deleted) and a few
gates in PreviewEngineCamera + ControlPanelSceneObject (now removed).
Net: -8 typecheck errors.
sidePanelWidth, sidePanelVisible, dndSidePanelWidth and their setters
are no longer read by any rendered component. Drop them from
PageSceneStore and the lone setSidePanelWidth(340) call in
PageEditor's mount effect. PreviewFrameImage's width calc no longer
subtracts the (always-zero) panel width.
The <SidePanel /> component was never rendered from PageEditor.tsx; the
entire comps/SidePanel/, comps/SidePanelMenu/, and most of comps/SidePanelTabs/
tree was unreachable. Relocate the few files still consumed by
AssetModal (sharedComps/ItemElement{,s}.tsx, hooks/useUserObjects,
hooks/useFeaturedObjects, utilities/fetchMediaItems + misc) to
comps/AssetMenu/{shared,hooks,utilities}/, and the StyleOptions panel
used by StyleMoreOptions to its parent folder. Then delete the rest.
Net: -33 typecheck errors (the dead tree had its own type problems).
Editor/ -> engine/:
- Rename pages/PageScene/Editor/ -> pages/PageScene/engine/
- Update every "./Editor/...", "../Editor/...", "../../Editor/...",
"~/pages/PageScene/Editor/..." import path. The class name `Editor`,
`EditorState` types, and `editorState` field are unchanged -- only
the directory is renamed
- ImageTo3DExperience also gets the new path
useSignals() drops where the component reads zero .value signals:
- comps/GenerateModals/Activity.tsx
- comps/SidePanelTabs/hooks/useFeatureFlags.tsx
- comps/SidePanelTabs/sharedComps/ItemElement.tsx
- comps/SidePanelTabs/tabComps/StylizeTab/PageStyleSelection.tsx
- comps/StyleMoreOptions/StyleMoreOptions.tsx
The remaining useSignals() callers still subscribe to genuine signals
(pageHeight/pageWidth from ~/signals, outlinerIsShowing,
sceneContainerSignal, etc.) and need to stay until those signals migrate.
Final grep audit confirms no residue:
- "PageEnigma" -- 0 hits
- "from \"...Editor/...\"" import paths -- 0 hits
- Queue.publish / Queue.subscribe / fromEngineActions /
toEngineActions / toTimelineActions -- 0 hits
- TimeLine, AudioEngine, TransformEngine, EmotionEngine, LipSyncEngine,
CharacterAnimationEngine, ClipUI, TimelineState -- 0 hits
Typecheck unchanged at 144 errors in PageScene; zero new errors.
The directory was named after a stale codename. The route is
/$sceneToken, the top bar reads "Edit Scene", and the page is the main
scene-editing workspace. Renaming the directory, top-level component,
and Zustand store accordingly:
- pages/PageEnigma/ -> pages/PageScene/
- pages/PageScene/PageEnigma.tsx -> PageScene.tsx
- pages/PageScene/PageEnigmaStore.ts -> PageSceneStore.ts
- usePageEnigmaStore -> usePageSceneStore (function rename across the
whole codebase via sed)
- All ~/pages/PageEnigma/* import paths -> ~/pages/PageScene/*
- Component name PageEnigma -> PageScene in routes/_index.tsx and
routes/$sceneToken.tsx
234 files touched, all mechanical. Typecheck error count holds at 144;
zero new errors introduced by the rename.
stylizeTab.ts (deleted). 11 consumers migrated:
UI components:
- StyleOptions: cinematic / upscale / faceDetail / lipSync /
enginePreProcessing toggles drive the matching store setters; the
upscale<->cinematic mutual-exclusion logic preserved
- StyleStrength: slider + number input read styleStrength from store,
call setStyleStrength
- Prompts: textBufferPositive / textBufferNegative now positivePrompt /
negativePrompt on the store; isUserInputPositive /
isUserInputNegative / showNegativePrompt as fields with setters
- IPAdapter: adapterImage + globalIPAMediaToken from store; useShallow
subscribes to all four needed fields/setters in one selector
- StylizeTab: selectedArtStyle from store, setSelectedArtStyle replaces
the old setArtStyleSelection helper
- StyleSelection: same pattern -- selectedArtStyle and
setSelectedArtStyle
- GenerateMovieButton: snapshots the entire stylize bag from the store
with usePageEnigmaStore.getState() inside the click handler
Engine + persistence:
- SceneMetadata.getSceneGenerationMetaData reads cameraAspectRatio,
globalIPAMediaToken, upscale, faceDetail, styleStrength, lipSync,
cinematic, enginePreProcessing all from the store in one getState()
- save_manager.loadFromJson restores all stylize state through the
store's setters instead of the old restoreSceneGenerationMetadata
signal helper. globalIpAdapterImageMediaToken restoration also goes
through setGlobalIPAMediaToken
- video_generation: setGlobalIPAMediaToken on upload + reads
globalIPAMediaToken from store for the gen request payload
- ControlsTopButtons: new-scene flow calls
usePageEnigmaStore.getState().resetSceneGenerationMetadata()
Bonus cleanup:
- SidePanelTabs reverted to inlining pageHeight - 64 (the previous
edit got lost in a stash round-trip)
- IPAdapter dropped useSignals and uses useShallow for its 4-field
selector
Net effect on typecheck: 145 -> 144 errors in PageEnigma.
sizing.ts (deleted). Was already minimal -- just sidePanelWidth, the
last survivor after the timeline-related sizing exports were stripped
in Phase 2. Three consumers migrated:
- PageEditor's mount-time setup: store.setSidePanelWidth(340)
- PreviewFrameImage: pulls sidePanelWidth off the store alongside
sidePanelVisible
- SidePanel: same pattern (already reading sidePanelVisible /
dndSidePanelWidth from the store; sidePanelWidth joins them)
- StyleSelection: subscribes to sidePanelWidth via the store
signals/ down to 10 files: camera, demoAssets, dragAndDrop, engine,
objectPanel, outliner, precisionSelectorMenu, promptBox, stylizeTab.
selectedMode.ts (deleted):
- PoseModeSelector reads poseMode + showPoseControls from store, calls
setPoseMode to toggle
- keybinds_controls migrates the t/r/g hotkeys (mode change),
x (transform space toggle), 'Escape' (exits pose mode), object
selection (sets showPoseControls), and FK toggle to the store
- editor.change_mode + toggleTransformSpace read/write transformSpace
through usePageEnigmaStore.getState()
- Controls3D's mode dropdown + world/local pill read selectedMode and
transformSpace from the store
- actions/setTransformMode no longer dual-writes the legacy signal
- store's PoseMode union changed from "select" | "edit" to
"select" | "pose" to match what the engine actually checks
sidePanel.ts (deleted):
- SidePanel reads sidePanelVisible + dndSidePanelWidth from store
- TabTitle's close button calls setSidePanelVisible
- SidePanelMenu pulls sidePanelVisible + setSidePanelVisible
- PreviewFrameImage reads sidePanelVisible (was a signal, now store)
- sidePanelHeight (was a computed signal of pageHeight - 64) inlined
at its three call sites: PreviewEngineCamera, SidePanelTabs,
StyleSelection. cameraFilter has no consumers; it lives on the store
for the next round.
signals/ down to 11 leaves: camera, demoAssets, dragAndDrop, engine,
objectPanel, outliner, precisionSelectorMenu, promptBox, sizing,
stylizeTab.
hotkeys.ts (deleted):
- keybinds_controls reads usePageEnigmaStore.getState().hotkeyStatus.disabled
- ControlPanelSceneObject pulls disableHotkeyInput / enableHotkeyInput
off the store and passes them to InputVector
- PageEditor pulls the same and passes them to LoginModal +
PromptBox3D. DomLevels imported from PageEnigmaStore (replacing the
signals/hotkeys re-export)
selectedItem.ts (deleted):
- No external consumers (dead since the timeline removal).
selectedObject lives on the store; the legacy signal had no readers
outside its own file.
signals/index.ts no longer re-exports either slice. Down to 13 files
in signals/.
assetModal.ts (deleted):
- AssetMenu: setAssetModalVisibleDuringDrag(true) on open
- AssetModal: reads assetModalVisible / assetModalVisibleDuringDrag /
reopenAfterDrag from the store, writes via the matching setters.
Modal close drives setAssetModalVisible(false); the reopen-after-add
checkbox writes through setReopenAfterDrag (note: store field is
reopenAfterDrag, not the old reopenAfterDragSignal name)
- Controls3D: handleOpenModal flips both setters from the store; the
empty-scene tooltip useEffect reads assetModalVisible from the store
- keybinds_controls: 'b' shortcut opens the asset modal via the store
- DragAndDrop/DndAsset: pointerdown clears
assetModalVisibleDuringDrag, pointerup restores it from
reopenAfterDrag, click (no drag) restores it to true. All through
the store now.
signals/index.ts no longer re-exports assetModal. Four signal files
gone so far in Phase 5; signals/ now down to 13 leaves (camera,
demoAssets, dragAndDrop, engine, hotkeys, objectPanel, outliner,
precisionSelectorMenu, promptBox, selectedItem, selectedMode,
sidePanel, sizing, stylizeTab).
Three more signal files retired in favour of the Zustand store.
error.ts (deleted):
- ErrorDialog (in ~/components/signaled): reads showErrorDialog /
errorDialogTitle / errorDialogMessage from the store, calls
setShowErrorDialog
- SceneTitleInput (in TopBar): handleShowErrorDialog uses the store's
setErrorDialog action
myMovies.ts (deleted):
- MyMoviesButton (in TopBar): writes via setGenerateMovieId /
setViewMyMovies
- GenerateModals: useEffect-on-store replaces useSignalEffect; reads
generateMovieId from store
- MyMovies and Sharing: read viewMyMovies from store, close via
setViewMyMovies
- Sharing also reads generateMovieId from store
editorOverlays.ts (deleted):
- PageEditor's LoadingDots: reads editorLoader from store
- SceneContainer: reads editorLetterBox from store and passes through
to Letterbox
- PreviewEngineCamera: reads editorLetterBox + toggleEditorLetterBox
from store
- save_manager: showEditorLoader/hideEditorLoader become thin wrappers
over the store actions, keeping the same call sites
signals/index.ts no longer re-exports any of the three deleted files.
Migrates components and engine code from reading signals/engine.ts
(cameraAspectRatio, editorState, gridVisibility, previewSrc) to reading
the Zustand store.
Components migrated to usePageEnigmaStore reads:
- AspectRatioMenu (also dropped useSignals + collapsed two
duplicated lookup ladders into ICON_BY_RATIO / LABEL_BY_RATIO)
- PreviewFrameImage
- Letterbox (no longer reactive via signals; reads camAspect from store)
- StyleButtons (editorState, previewSrc, setEditorState)
- Outliner (cameraAspectRatio)
- SidePanelMenu (editorState + setEditorState)
- ControlPanelSceneObject (editorState)
- PreviewEngineCamera (cameraAspectRatio + editorState)
- PageEditor (cameraAspectRatio for getScale; the signal version still
flows into PromptBox3D as a prop)
Engine code migrated to usePageEnigmaStore.getState():
- editor.ts: snapShotOfCurrentFrame reads cameraAspectRatio + grid;
switchPreview / switchEdit set editorState
- helper.ts: switchCameraView writes editorState
- video_generation.ts: generateFrame writes previewSrc + editorState
- SceneMetadata.ts: cameraAspectRatio for snapshot metadata
- scene.ts: subscribes to store gridVisible (not the signal)
signals/engine.ts becomes a thin compatibility layer for PromptBox3D's
signal-typed props. Its setters dual-write into the store so any
PromptBox3D-driven changes (grid toggle, aspect ratio dropdown) keep
the store authoritative. editorState / previewSrc / setEditorState
removed entirely -- nothing outside the store needs them anymore.
Net effect on typecheck: 148 -> 147 errors in PageEnigma. Zero new
errors introduced.
The auto-success useEffect in UploadModalSplat / UploadModalImage /
UploadModal3D was firing on UploaderStates.success and immediately
calling onClose(), which short-circuited the UploaderModalContent
switch before the UploaderStates.success branch (UploadSuccess) could
render. The OK button on UploadSuccess was effectively dead code.
Move the success-side actions (open the gallery, fire onSuccess, close
the modal) into the UploadSuccess onOk handler. The user now sees the
"upload successful" dialog and can dismiss it intentionally; the
gallery opens at dismissal so they can drag the freshly uploaded asset
onto the canvas.
Pre-refactor the splat upload modal had two paths: the (developer-only)
local-bytes path that handed the in-memory buffer to a now-deleted
editor.timeline.addLocalSplat, and a real upload path that registered
the file in Storyteller's media library but did nothing else with it.
The local-bytes branch was the only thing letting a freshly uploaded
splat reach the canvas. With it gone, splat upload was a dead end --
the file landed in the user's media library but they had no path back
to the 3D editor.
Align with the existing image / 3D-model upload convention: on
UploaderStates.success, set galleryModalVisibleViewMode and call
onSuccess(selectedCategory). The user can then drag the freshly
uploaded splat from the auto-opened gallery onto the canvas, which
flows through PageEditor's onImageDrop handler and into
actions/addObject.
Other changes:
- onSuccess signature: (ArrayBuffer, boolean) => (FilterEngineCategories)
to match UploadModalImage / UploadModal3D
- Drop the unused onLocalBytes prop and plumbing in UploadFilesSplat;
no callsite invoked it. The two existing consumers
(PageEnigma/Controls3D, GlobalFileDropHandler) ignore the category
argument, which is fine -- () => void is assignable.
Replaces the four-hop signal-stub pattern (drop -> store-only update,
engine never told) with explicit action helpers that mutate the engine
and the store in one step.
actions/:
- addObject / addCharacter / addShape: call editor.sceneManager.create
to load the THREE.js object, then update the Zustand store. addCharacter
also stamps userData.isCharacter on the loaded object
- deleteObject: thin wrapper over editor.deleteObject (which already
goes through SceneUtils to update the store)
- selectObject / deselectObject: invoke sceneManager.select_object;
Editor.publishSelect already writes the selection to the store
- setTransformMode: drives editor.change_mode + store + the legacy
selectedMode signal during the migration window
- setCameraAspect: drives editor.changeRenderCameraAspectRatio + store +
the legacy cameraAspectRatio signal
- index.ts barrel
Wiring updates:
- PageEditor drop handler (gallery -> 3D) now calls actions/addObject
and actions/addCharacter with the editor and world position
- DragAndDrop/DndAsset takes the editor at pointerdown time and calls
actions/* on drop. ItemElement passes the editor in via EngineContext
- AspectRatioMenu calls actions/setCameraAspect; PageEditor's bottom-bar
aspect-ratio select uses the action too
- Controls3D's mode toggle (move/rotate/scale) goes through
actions/setTransformMode and the four little redundant handlers are
collapsed into one
- ImageTo3DExperience's "Open in 3D Editor" button uses getActiveEditor
to pick up the live editor across pages
Plumbing:
- New module-level activeEditor handle in EngineContext (with
getActiveEditor / setActiveEditor) so non-React callers and cross-page
actions can reach the engine; EngineProvider sets it on init and
clears on unmount
- Drop the now-orphaned signals/objectGroup, signals/characterGroups,
signals/shape entirely. Their job (store update + engine call) lives
in actions/. signals/index.ts loses the corresponding re-exports
- Remove the placeholder addLocalSplat onSuccess in Controls3D (a
developer-test path for direct splat loading; the real splat upload
goes through GlobalFileDropHandler) and delete the now-confirmed-dead
recordScene method in editor.ts
- video_generation.ts zipBlob: type as Blob | null (matches the
UploadStudioShot signature; pre-existing TS error)
Net effect on typecheck: 144 -> 147 errors in PageEnigma + experiences;
zero errors introduced in actions/, PageEnigmaStore, or DragAndDrop. All
new errors are pre-existing issues in adjacent files surfaced by the
edits, not regressions.
editor.ts surgery (1864 -> 1665 lines):
- Drop imports + field declarations + constructor instantiations for
AudioEngine, TransformEngine, EmotionEngine, LipSyncEngine,
CharacterAnimationEngine, and TimeLine; drop the
Queue/QueueNames/fromEngineActions/toEngineActions imports
- Drop timeline state fields: can_playback, playback_location,
current_frame, last_scrub. generating_preview stays (it tracks the
stylize preview render, not the timeline)
- Replace Queue.publish in changeRenderCameraAspectRatio, newScene,
loadScene, and publishSelect with direct store actions
(usePageEnigmaStore.getState().setSelectedObject / resetScene)
- Replace timeline.characters lookups (used by SceneManager outliner)
with a getCharactersByUuid helper that reads the store
- Replace timeline.isCharacter (passed into SceneManager) with an
isCharacterUuid helper that checks the store's character list
- recordScene becomes a no-op stub: timeline-driven frame capture is
gone, video generation needs to drive its own frame loop. TODO marker
for the rewiring
- generateVideo and togglePlayback drop their timeline.is_playing /
scrubber gating; renderSingleFrame drops the timeline.update branch
- Bonus: kill the meraAspectRatio typo (a pre-existing bug in the
recordScene branch I deleted)
Cascading fixes:
- save_manager.ts loadScene/loadCache: drop calls to the deleted
timeline.scrub and timeline.checkEditorCanPlay
- video_generation.ts videoProcessingPipeline: stub the
engineFrameBuffers.payloadZip path with a TODO; the video upload now
always errors via the existing handleError. The full rewiring is the
same TODO as recordScene
- Controls3D UploadModalSplat onSuccess: drop the
editor.timeline.addLocalSplat call
- SidePanelTabs: drop a long-broken import of useMouseEventsSidePanel
(the Timeline/utils path it pointed to was already deleted before
this refactor); resize handle gets a TODO marker for Phase 6
Net effect on typecheck: 162 -> 144 errors in PageEnigma. Every
remaining error in PageEnigma predates this branch; no new TypeScript
errors introduced by the refactor.