From 40d14be78ea9795a83671dea33503eba47457bd9 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 31 Mar 2026 05:11:52 +0200 Subject: [PATCH] Add world environment settings to App.tsx --- src/app/App.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/app/App.tsx b/src/app/App.tsx index e21bf909..bd5da429 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -370,7 +370,10 @@ export function App({ store, initialStatusMessage }: AppProps) { const [uvScaleDraft, setUvScaleDraft] = useState(createVec2Draft(createDefaultFaceUvState().scale)); const [playerStartPositionDraft, setPlayerStartPositionDraft] = useState(createVec3Draft(DEFAULT_PLAYER_START_POSITION)); const [playerStartYawDraft, setPlayerStartYawDraft] = useState("0"); - const [statusMessage, setStatusMessage] = useState(initialStatusMessage ?? "Slice 1.4 room-authoring workflow ready."); + const [ambientLightIntensityDraft, setAmbientLightIntensityDraft] = useState(String(editorState.document.world.ambientLight.intensity)); + const [sunLightIntensityDraft, setSunLightIntensityDraft] = useState(String(editorState.document.world.sunLight.intensity)); + const [sunDirectionDraft, setSunDirectionDraft] = useState(createVec3Draft(editorState.document.world.sunLight.direction)); + const [statusMessage, setStatusMessage] = useState(initialStatusMessage ?? "Slice 1.5 world environment settings ready."); const [preferredNavigationMode, setPreferredNavigationMode] = useState( primaryPlayerStart === null ? "orbitVisitor" : "firstPerson" ); @@ -444,6 +447,18 @@ export function App({ store, initialStatusMessage }: AppProps) { setPlayerStartYawDraft(String(editablePlayerStart.yawDegrees)); }, [editablePlayerStart]); + useEffect(() => { + setAmbientLightIntensityDraft(String(editorState.document.world.ambientLight.intensity)); + }, [editorState.document.world.ambientLight.intensity]); + + useEffect(() => { + setSunLightIntensityDraft(String(editorState.document.world.sunLight.intensity)); + }, [editorState.document.world.sunLight.intensity]); + + useEffect(() => { + setSunDirectionDraft(createVec3Draft(editorState.document.world.sunLight.direction)); + }, [editorState.document.world.sunLight.direction]); + useEffect(() => { if (editorState.toolMode === "play") { return;