From 0bf1491a56334afd9e1210f8345d5ac84717b3cc Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 15 Apr 2026 01:42:17 +0200 Subject: [PATCH] Refactor and add new project sequence effects in App.tsx --- src/app/App.tsx | 79 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 69 insertions(+), 10 deletions(-) diff --git a/src/app/App.tsx b/src/app/App.tsx index 15e1c955..23139a70 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -4701,8 +4701,10 @@ export function App({ store, initialStatusMessage }: AppProps) { const handleAddProjectSequenceVisibilityStep = ( sequenceId: string, - targetBrushId: string + targetKey: string ) => { + const target = readSequenceVisibilityTargetKey(targetKey); + updateProjectSequence( sequenceId, "Add project sequence visibility effect", @@ -4710,14 +4712,70 @@ export function App({ store, initialStatusMessage }: AppProps) { (sequence) => { sequence.effects.push({ stepClass: "impulse", - type: "toggleVisibility", - targetBrushId, - visible: undefined + type: "setVisibility", + target, + mode: "toggle" }); } ); }; + const handleAddProjectSequencePlayAnimationStep = ( + sequenceId: string, + targetKey: string + ) => { + handleAddProjectSequenceSpecificControlStep( + sequenceId, + "impulse", + targetKey, + "model.playAnimation", + "Add project sequence play animation effect", + "Added play animation effect." + ); + }; + + const handleAddProjectSequenceStopAnimationStep = ( + sequenceId: string, + targetKey: string + ) => { + handleAddProjectSequenceSpecificControlStep( + sequenceId, + "impulse", + targetKey, + "model.stopAnimation", + "Add project sequence stop animation effect", + "Added stop animation effect." + ); + }; + + const handleAddProjectSequencePlaySoundStep = ( + sequenceId: string, + targetKey: string + ) => { + handleAddProjectSequenceSpecificControlStep( + sequenceId, + "impulse", + targetKey, + "sound.play", + "Add project sequence play sound effect", + "Added play sound effect." + ); + }; + + const handleAddProjectSequenceStopSoundStep = ( + sequenceId: string, + targetKey: string + ) => { + handleAddProjectSequenceSpecificControlStep( + sequenceId, + "impulse", + targetKey, + "sound.stop", + "Add project sequence stop sound effect", + "Added stop sound effect." + ); + }; + const handleDeleteProjectSequenceStep = ( sequenceId: string, stepIndex: number @@ -4954,19 +5012,21 @@ export function App({ store, initialStatusMessage }: AppProps) { const updateProjectSequenceVisibilityStepTarget = ( sequenceId: string, stepIndex: number, - targetBrushId: string + targetKey: string ) => { + const target = readSequenceVisibilityTargetKey(targetKey); + updateProjectSequenceStep( sequenceId, stepIndex, "Set project sequence visibility target", "Updated visibility target.", (step) => { - if (step.type !== "toggleVisibility") { + if (step.type !== "setVisibility") { throw new Error("Only visibility effects expose a whitebox solid target."); } - step.targetBrushId = targetBrushId; + step.target = target; } ); }; @@ -4982,12 +5042,11 @@ export function App({ store, initialStatusMessage }: AppProps) { "Set project sequence visibility mode", "Updated visibility mode.", (step) => { - if (step.type !== "toggleVisibility") { + if (step.type !== "setVisibility") { throw new Error("Only visibility effects expose a visibility mode."); } - step.visible = - mode === "toggle" ? undefined : mode === "show"; + step.mode = mode; } ); };