Add setVisibility method to RuntimeInteractionDispatcher and update handling in RuntimeInteractionSystem
This commit is contained in:
@@ -5,7 +5,9 @@ import {
|
||||
} from "../interactions/interaction-links";
|
||||
import {
|
||||
getInteractionLinkImpulseSteps,
|
||||
type ImpulseSequenceStep
|
||||
type ImpulseSequenceStep,
|
||||
type SequenceVisibilityMode,
|
||||
type SequenceVisibilityTarget
|
||||
} from "../sequencer/project-sequence-steps";
|
||||
|
||||
import type {
|
||||
@@ -35,6 +37,11 @@ export interface RuntimeInteractionDispatcher {
|
||||
visible: boolean | undefined,
|
||||
link: InteractionLink
|
||||
): void;
|
||||
setVisibility?(
|
||||
target: SequenceVisibilityTarget,
|
||||
mode: SequenceVisibilityMode,
|
||||
link: InteractionLink
|
||||
): void;
|
||||
playAnimation(
|
||||
instanceId: string,
|
||||
clipName: string,
|
||||
@@ -759,6 +766,25 @@ export class RuntimeInteractionSystem {
|
||||
link
|
||||
);
|
||||
return;
|
||||
case "setVisibility":
|
||||
if (dispatcher.setVisibility !== undefined) {
|
||||
dispatcher.setVisibility(step.target, step.mode, link);
|
||||
return;
|
||||
}
|
||||
|
||||
if (step.target.kind === "brush") {
|
||||
dispatcher.toggleBrushVisibility(
|
||||
step.target.brushId,
|
||||
step.mode === "toggle" ? undefined : step.mode === "show",
|
||||
link
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
"Runtime visibility steps targeting model instances require dispatcher.setVisibility support."
|
||||
);
|
||||
return;
|
||||
case "startDialogue":
|
||||
dispatcher.startDialogue(step.dialogueId, {
|
||||
kind: "interactionLink",
|
||||
|
||||
Reference in New Issue
Block a user