mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 01:18:34 +00:00
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.