feat(stage-tamagotchi-godot): camera control (#1855)
## Summary This PR adds the first usable camera and view-state loop for the experimental Godot stage. The main design direction is that Godot owns the stage view state, while Electron and the settings page act as lifecycle/transport/control surfaces. The settings UI can now edit Godot camera state, and camera changes from the Godot window can flow back to the UI. ## What Changed - Added the shared Godot view-state contract for camera pose, avatar bounds, snapshots, patches, and errors. - Added Electron main bridge APIs for Godot status, scene input, view snapshots, and view patches. - Added Godot-side camera runtime: - initial camera bootstrap from loaded avatar bounds - avatar facing normalisation - orbit, pan, wheel movement, and WASD-style camera movement - idle persistence for camera position, yaw, pitch, and FOV - Added settings-page Godot camera controls with coalesced updates, restart-safe session handling, and stale request protection. - Kept scene input simple: Electron does not cache the selected model for replay. Each Godot start receives the current model selection from the renderer. ## File Guide Shared contracts: - `packages/stage-shared/src/godot-stage/view-state.ts` defines the Godot view-state contract and schema validation. - `packages/stage-shared/src/godot-stage/index.ts` exports the Godot shared contract surface. - `packages/stage-shared/package.json` exposes the new shared entry. Electron / renderer bridge: - `apps/stage-tamagotchi/src/shared/eventa/index.ts` adds the Eventa contracts for Godot status, scene input, view snapshot, patch, and error events. - `apps/stage-tamagotchi/src/main/services/airi/godot-stage/index.ts` owns the Godot sidecar lifecycle, local WebSocket bridge, scene input forwarding, and view-state forwarding. Settings page: - `apps/stage-tamagotchi/src/renderer/pages/settings/models/index.vue` wires the settings page to Godot status, scene input, snapshots, and patches. - `apps/stage-tamagotchi/src/renderer/pages/settings/models/godot-view-patch-queue.ts` coalesces high-frequency camera edits before sending them to Godot. - `apps/stage-tamagotchi/src/renderer/pages/settings/models/godot-view-session.ts` tracks renderer-local Godot session epochs so stale async results are ignored. Shared settings UI: - `packages/stage-ui/src/components/scenarios/settings/model-settings/godot.vue` renders the Godot camera controls. - `packages/stage-ui/src/components/scenarios/settings/model-settings/panel.vue` routes the model settings panel between Live2D, VRM, and Godot settings. - `packages/stage-ui/src/components/scenarios/settings/model-settings/runtime.ts` resolves model-settings runtime display state and Godot camera control range. - `packages/stage-ui/src/components/data-pane/property-number.vue` updates number control behavior so config changes such as min/max/range are reflected correctly. Godot runtime: - `engines/stage-tamagotchi-godot/scripts/StageRoot.cs` wires scene loading, view runtime, and transport together. - `engines/stage-tamagotchi-godot/scripts/scene/StageSceneController.cs` loads VRM avatars and normalizes avatar facing direction. - `engines/stage-tamagotchi-godot/scripts/view/StageViewRuntime.cs` owns Godot view-state updates, snapshots, patch application, and idle persistence. - `engines/stage-tamagotchi-godot/scripts/view/StageCameraPoseController.cs` computes avatar bounds, bootstraps the camera, applies camera pose, and handles camera movement math. - `engines/stage-tamagotchi-godot/scripts/view/StageCameraInputController.cs` maps mouse and keyboard input into camera operations. - `engines/stage-tamagotchi-godot/scripts/view/StageViewStateRules.cs` centralizes view-state defaults and validation rules. - `engines/stage-tamagotchi-godot/scripts/view/StageViewStateStore.cs` persists and loads Godot camera view state. - `engines/stage-tamagotchi-godot/scripts/transport/StageViewJson.cs` parses and serializes view-state transport payloads. - `engines/stage-tamagotchi-godot/scripts/transport/StageViewPayloads.cs` defines the C# payload records used by the transport layer. --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
L
Lilia_Chen committed
ecf234c24617e3c3b6480a4955a7c06f7e23f7ee
Parent: 3a6f7a7
Committed by GitHub <noreply@github.com>
on 5/20/2026, 7:32:59 PM