Simplify and remove unused handlers in App.tsx

This commit is contained in:
2026-04-15 06:24:08 +02:00
parent 6ce7cd4fb7
commit 26d884e668

View File

@@ -11684,331 +11684,12 @@ export function App({ store, initialStatusMessage }: AppProps) {
updateProjectScheduleRoutine(
routineId,
"Set project sequencer sequence",
sequenceId === null
? "Sequence placement now uses inline held effects."
: "Timeline clip now resolves a project sequence.",
"Timeline clip now resolves a project sequence.",
(routine) => {
routine.sequenceId = sequenceId;
}
)
}
onSetRoutineEffectOption={(routineId, effectOptionId) =>
updateProjectScheduleRoutine(
routineId,
"Set project sequencer effect",
"Updated sequence placement effect.",
(routine) => {
if (routine.target.kind === "actor") {
throw new Error(
"Actor routines use dedicated presence, animation, and path controls."
);
}
const targetOption = getProjectScheduleTargetOptionByKey(
projectScheduleTargetOptions,
getControlTargetRefKey(routine.target)
);
if (targetOption === null) {
throw new Error(
"The current sequencer target no longer exists in the project."
);
}
routine.effects = [
createProjectScheduleEffectFromOption({
targetOption,
effectOptionId,
previousEffect: routine.effects[0] ?? null
})
];
}
)
}
onSetRoutineNumericValue={(routineId, value) =>
updateProjectScheduleRoutine(
routineId,
"Set project sequencer numeric value",
"Updated sequence placement value.",
(routine) => {
if (!Number.isFinite(value) || value < 0) {
throw new Error(
"Sequencer clip numeric values must be finite and zero or greater."
);
}
const effect = routine.effects[0];
if (effect === undefined) {
throw new Error(
"The current sequence placement does not expose a numeric value."
);
}
switch (effect.type) {
case "setSoundVolume":
effect.volume = value;
return;
case "setLightIntensity":
case "setAmbientLightIntensity":
case "setSunLightIntensity":
effect.intensity = value;
return;
default:
throw new Error(
"The current sequencer effect does not expose a numeric value."
);
}
}
)
}
onSetRoutineColorValue={(routineId, colorHex) =>
updateProjectScheduleRoutine(
routineId,
"Set project sequencer color",
"Updated sequence placement color.",
(routine) => {
const effect = routine.effects[0];
if (effect === undefined) {
throw new Error(
"The current sequence placement does not expose a color value."
);
}
switch (effect.type) {
case "setLightColor":
case "setAmbientLightColor":
case "setSunLightColor":
effect.colorHex = colorHex;
return;
default:
throw new Error(
"The current sequencer effect does not expose a color value."
);
}
}
)
}
onSetRoutineAnimationClip={(routineId, clipName) =>
updateProjectScheduleRoutine(
routineId,
"Set project sequencer animation clip",
"Updated sequencer animation clip.",
(routine) => {
const effect = routine.effects[0];
if (effect?.type !== "playModelAnimation") {
throw new Error(
"The current sequencer effect does not expose an animation clip."
);
}
effect.clipName = clipName;
}
)
}
onSetRoutineAnimationLoop={(routineId, loop) =>
updateProjectScheduleRoutine(
routineId,
"Set project sequencer animation loop",
loop
? "Sequencer animation now loops."
: "Sequencer animation now plays once.",
(routine) => {
const effect = routine.effects[0];
if (effect?.type !== "playModelAnimation") {
throw new Error(
"The current sequencer effect does not expose animation looping."
);
}
effect.loop = loop;
}
)
}
onSetActorRoutinePresence={(routineId, active) =>
updateProjectScheduleRoutine(
routineId,
"Set actor sequencer presence",
active
? "Actor routine now keeps the NPC present."
: "Actor routine now hides the NPC during this block.",
(routine) => {
if (routine.target.kind !== "actor") {
throw new Error("Only actor routines expose presence.");
}
upsertActorRoutineEffect(
routine,
createSetActorPresenceControlEffect({
target: routine.target,
active
})
);
}
)
}
onSetActorRoutineAnimationClip={(routineId, clipName) =>
updateProjectScheduleRoutine(
routineId,
"Set actor routine animation",
clipName === null
? "Removed actor routine animation."
: "Updated actor routine animation.",
(routine) => {
if (routine.target.kind !== "actor") {
throw new Error("Only actor routines expose animation.");
}
if (clipName === null) {
removeActorRoutineEffect(routine, "playActorAnimation");
return;
}
const previousEffect = findProjectScheduleRoutineEffect(
routine,
"playActorAnimation"
);
upsertActorRoutineEffect(
routine,
createPlayActorAnimationControlEffect({
target: routine.target,
clipName,
loop: previousEffect?.loop ?? true
})
);
}
)
}
onSetActorRoutineAnimationLoop={(routineId, loop) =>
updateProjectScheduleRoutine(
routineId,
"Set actor routine animation loop",
loop
? "Actor routine animation now loops."
: "Actor routine animation now plays once.",
(routine) => {
if (routine.target.kind !== "actor") {
throw new Error("Only actor routines expose animation.");
}
const effect = findProjectScheduleRoutineEffect(
routine,
"playActorAnimation"
);
if (effect === null) {
throw new Error(
"Select an actor animation clip before changing loop behavior."
);
}
effect.loop = loop;
}
)
}
onSetActorRoutinePath={(routineId, pathId) =>
updateProjectScheduleRoutine(
routineId,
"Set actor routine path",
pathId === null
? "Removed actor routine path."
: "Updated actor routine path.",
(routine) => {
if (routine.target.kind !== "actor") {
throw new Error("Only actor routines expose follow-path.");
}
if (pathId === null) {
removeActorRoutineEffect(routine, "followActorPath");
return;
}
const targetOption = getProjectScheduleTargetOptionByKey(
projectScheduleTargetOptions,
getControlTargetRefKey(routine.target)
);
const pathOption =
targetOption?.defaults.actorPathOptions?.find(
(option) => option.pathId === pathId
) ?? null;
const previousEffect = findProjectScheduleRoutineEffect(
routine,
"followActorPath"
);
upsertActorRoutineEffect(
routine,
createFollowActorPathControlEffect({
target: routine.target,
pathId,
speed:
previousEffect?.speed ??
targetOption?.defaults.actorPathSpeed ??
1,
loop: previousEffect?.loop ?? pathOption?.loop ?? false,
progressMode: "deriveFromTime"
})
);
}
)
}
onSetActorRoutinePathSpeed={(routineId, speed) =>
updateProjectScheduleRoutine(
routineId,
"Set actor routine path speed",
"Updated actor routine path speed.",
(routine) => {
if (routine.target.kind !== "actor") {
throw new Error("Only actor routines expose follow-path.");
}
const effect = findProjectScheduleRoutineEffect(
routine,
"followActorPath"
);
if (effect === null) {
throw new Error("Select an actor path before changing speed.");
}
if (!Number.isFinite(speed) || speed <= 0) {
throw new Error(
"Actor path speed must be a finite number greater than zero."
);
}
effect.speed = speed;
}
)
}
onSetActorRoutinePathLoop={(routineId, loop) =>
updateProjectScheduleRoutine(
routineId,
"Set actor routine path loop",
loop
? "Actor routine path now loops."
: "Actor routine path now clamps at the end.",
(routine) => {
if (routine.target.kind !== "actor") {
throw new Error("Only actor routines expose follow-path.");
}
const effect = findProjectScheduleRoutineEffect(
routine,
"followActorPath"
);
if (effect === null) {
throw new Error("Select an actor path before changing loop.");
}
effect.loop = loop;
}
)
}
onSetSequenceTitle={(sequenceId, title) =>
updateProjectSequence(
sequenceId,