From 1de82de206e166514bca92d65cf541cad60d2d30 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 15 Apr 2026 09:15:01 +0200 Subject: [PATCH] Rename and update dialogue-related functions and types in App.tsx and transform-session.ts --- src/app/App.tsx | 53 +++++++++++++++++++++++++++-------- src/core/transform-session.ts | 4 +++ 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/app/App.tsx b/src/app/App.tsx index 13b98306..1fea4130 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -4930,18 +4930,20 @@ export function App({ store, initialStatusMessage }: AppProps) { ); }; - const handleAddProjectSequenceDialogueStep = ( + const handleAddProjectSequenceNpcTalkStep = ( sequenceId: string, - dialogueId: string + npcEntityId: string, + dialogueId: string | null ) => { updateProjectSequence( sequenceId, - "Add project sequence dialogue clip", - "Added dialogue effect.", + "Add project sequence NPC talk effect", + "Added NPC talk effect.", (sequence) => { sequence.effects.push({ stepClass: "impulse", - type: "startDialogue", + type: "makeNpcTalk", + npcEntityId, dialogueId }); } @@ -5287,19 +5289,48 @@ export function App({ store, initialStatusMessage }: AppProps) { ); }; - const updateProjectSequenceDialogueStepDialogueId = ( + const updateProjectSequenceNpcTalkStepNpcEntityId = ( sequenceId: string, stepIndex: number, - dialogueId: string + npcEntityId: string ) => { updateProjectSequenceStep( sequenceId, stepIndex, - "Set project sequence dialogue", - "Updated sequence dialogue.", + "Set project sequence talk NPC", + "Updated talking NPC.", (step) => { - if (step.type !== "startDialogue") { - throw new Error("Only dialogue steps expose a dialogue id."); + if (step.type !== "makeNpcTalk") { + throw new Error("Only NPC talk effects expose a talking NPC."); + } + + const npcTargetOption = + npcDialogueSequenceTargetOptions.find( + (option) => option.npcEntityId === npcEntityId + ) ?? null; + + step.npcEntityId = npcEntityId; + step.dialogueId = + npcTargetOption?.defaultDialogueId ?? + npcTargetOption?.dialogues[0]?.dialogueId ?? + null; + } + ); + }; + + const updateProjectSequenceNpcTalkStepDialogueId = ( + sequenceId: string, + stepIndex: number, + dialogueId: string | null + ) => { + updateProjectSequenceStep( + sequenceId, + stepIndex, + "Set project sequence NPC dialogue", + "Updated NPC dialogue.", + (step) => { + if (step.type !== "makeNpcTalk") { + throw new Error("Only NPC talk effects expose an NPC dialogue."); } step.dialogueId = dialogueId; diff --git a/src/core/transform-session.ts b/src/core/transform-session.ts index 22603598..67297898 100644 --- a/src/core/transform-session.ts +++ b/src/core/transform-session.ts @@ -994,6 +994,10 @@ function createBrushTransformTarget( brushId: brush.id, brushKind: brush.kind, sideCount: brush.kind === "radialPrism" ? brush.sideCount : undefined, + majorSegmentCount: + brush.kind === "torus" ? brush.majorSegmentCount : undefined, + tubeSegmentCount: + brush.kind === "torus" ? brush.tubeSegmentCount : undefined, initialCenter: cloneVec3(brush.center), initialRotationDegrees: cloneVec3(brush.rotationDegrees), initialSize: cloneVec3(brush.size),