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.
Frontend
This is an nx monorepo that can contain multiple apps and shared libraries.
All commands to run these projects are performed from this directory.
Install dependencies
npm install
Editor2d
Run dev server:
nx dev editor2d
artcraft
Run dev server:
nx dev artcraft
call when starting on main or a new branch:
./clean_modules
The names for @frontend and @storyteller come from the package.json file in the libs folder.
import { Login } from "@frontend/login";
import { api } from "@storyteller/api";
For shared UI components, import from @storyteller/ui-[componentname].
import { Button } from "@storyteller/ui-button";
import { Modal } from "@storyteller/ui-modal";
building:
npx nx build artcraft
npx nx build editor2d
dev:
npx nx dev artcraft
npx nx dev editor2d
# component build
1.
npx nx g @nx/react:library libs/components/toaster --import-path=@storyteller/ui-toaster --bundler=vite
npm install
2.import it first in code
3.nx sync
4.nx build
or
# frontend build
in frontend folder
% nx build -project type
% nx build artcraft
% nx dev artcraft