From 915ff68aff6d88da35db680414eb962d2d23de3e Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 14 Apr 2026 03:06:48 +0200 Subject: [PATCH] Refactor and update project schedule routines and options --- src/app/App.tsx | 3 +-- src/runtime-three/runtime-project-scheduler.ts | 12 ++++++++++-- src/scheduler/project-schedule-control-options.ts | 5 ++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/app/App.tsx b/src/app/App.tsx index d2e60853..93e80958 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -348,8 +348,7 @@ import { getProjectScheduleEffectOptionId, getProjectScheduleTargetOptionByKey, listProjectScheduleEffectOptions, - listProjectScheduleTargetOptions, - type ProjectScheduleEffectOptionId + listProjectScheduleTargetOptions } from "../scheduler/project-schedule-control-options"; import { loadProjectPackage, diff --git a/src/runtime-three/runtime-project-scheduler.ts b/src/runtime-three/runtime-project-scheduler.ts index 2636fb96..19c10cd8 100644 --- a/src/runtime-three/runtime-project-scheduler.ts +++ b/src/runtime-three/runtime-project-scheduler.ts @@ -20,6 +20,14 @@ import { type ProjectScheduleRoutine } from "../scheduler/project-scheduler"; +type ActorPresenceScheduleRoutine = ProjectScheduleRoutine & { + target: { + kind: "actor"; + actorId: string; + }; + effect: SetActorPresenceControlEffect; +}; + export interface RuntimeResolvedActorScheduleState { actorId: string; hasRules: boolean; @@ -97,10 +105,10 @@ export function createRuntimeProjectSchedulerState(options: { function resolveActorScheduleRules( scheduler: ProjectScheduler, actorId: string -): ProjectScheduleRoutine[] { +): ActorPresenceScheduleRoutine[] { return Object.values(scheduler.routines) .filter( - (routine) => + (routine): routine is ActorPresenceScheduleRoutine => routine.enabled && routine.target.kind === "actor" && routine.target.actorId === actorId && diff --git a/src/scheduler/project-schedule-control-options.ts b/src/scheduler/project-schedule-control-options.ts index 28dd7f96..05ce0a14 100644 --- a/src/scheduler/project-schedule-control-options.ts +++ b/src/scheduler/project-schedule-control-options.ts @@ -28,7 +28,7 @@ import { } from "../controls/control-surface"; import { getModelInstances } from "../assets/model-instances"; import { getModelInstanceDisplayLabel } from "../assets/model-instance-labels"; -import { getEntityDisplayLabel, getSortedEntityDisplayLabels } from "../entities/entity-labels"; +import { getSortedEntityDisplayLabels } from "../entities/entity-labels"; import { listProjectNpcActors } from "../entities/npc-actor-registry"; export const PROJECT_SCHEDULE_EFFECT_OPTION_IDS = [ @@ -311,7 +311,7 @@ export function listProjectScheduleTargetOptions( groupLabel: "Model Instances", defaults: { animationClipNames, - animationLoop: modelInstance.animationLoop ?? true + animationLoop: true } }); } @@ -690,4 +690,3 @@ export function createProjectScheduleEffectFromOption(options: { }); } } -