Add support for playActorAnimation and followActorPath control effects
This commit is contained in:
@@ -1282,6 +1282,10 @@ export function getControlEffectResolutionKey(effect: ControlEffect): string {
|
|||||||
switch (effect.type) {
|
switch (effect.type) {
|
||||||
case "setActorPresence":
|
case "setActorPresence":
|
||||||
return `state:actorPresence:${getControlTargetRefKey(effect.target)}`;
|
return `state:actorPresence:${getControlTargetRefKey(effect.target)}`;
|
||||||
|
case "playActorAnimation":
|
||||||
|
return `state:actorAnimationPlayback:${getControlTargetRefKey(effect.target)}`;
|
||||||
|
case "followActorPath":
|
||||||
|
return `state:actorPathAssignment:${getControlTargetRefKey(effect.target)}`;
|
||||||
case "playModelAnimation":
|
case "playModelAnimation":
|
||||||
case "stopModelAnimation":
|
case "stopModelAnimation":
|
||||||
return `state:modelAnimationPlayback:${getControlTargetRefKey(effect.target)}`;
|
return `state:modelAnimationPlayback:${getControlTargetRefKey(effect.target)}`;
|
||||||
@@ -1396,6 +1400,22 @@ export function cloneControlEffect<TEffect extends ControlEffect>(
|
|||||||
target: cloneControlTargetRef(effect.target),
|
target: cloneControlTargetRef(effect.target),
|
||||||
active: effect.active
|
active: effect.active
|
||||||
} as TEffect;
|
} as TEffect;
|
||||||
|
case "playActorAnimation":
|
||||||
|
return {
|
||||||
|
type: "playActorAnimation",
|
||||||
|
target: cloneControlTargetRef(effect.target),
|
||||||
|
clipName: effect.clipName,
|
||||||
|
loop: effect.loop
|
||||||
|
} as TEffect;
|
||||||
|
case "followActorPath":
|
||||||
|
return {
|
||||||
|
type: "followActorPath",
|
||||||
|
target: cloneControlTargetRef(effect.target),
|
||||||
|
pathId: effect.pathId,
|
||||||
|
speed: effect.speed,
|
||||||
|
loop: effect.loop,
|
||||||
|
progressMode: effect.progressMode
|
||||||
|
} as TEffect;
|
||||||
case "playModelAnimation":
|
case "playModelAnimation":
|
||||||
return {
|
return {
|
||||||
type: "playModelAnimation",
|
type: "playModelAnimation",
|
||||||
@@ -1526,6 +1546,22 @@ export function cloneRuntimeResolvedDiscreteControlState<
|
|||||||
value: state.value,
|
value: state.value,
|
||||||
source: state.source
|
source: state.source
|
||||||
}) as TState;
|
}) as TState;
|
||||||
|
case "actorAnimationPlayback":
|
||||||
|
return createResolvedActorAnimationPlaybackState({
|
||||||
|
target: state.target,
|
||||||
|
clipName: state.clipName,
|
||||||
|
loop: state.loop,
|
||||||
|
source: state.source
|
||||||
|
}) as TState;
|
||||||
|
case "actorPathAssignment":
|
||||||
|
return createResolvedActorPathAssignmentState({
|
||||||
|
target: state.target,
|
||||||
|
pathId: state.pathId,
|
||||||
|
speed: state.speed,
|
||||||
|
loop: state.loop,
|
||||||
|
progressMode: state.progressMode,
|
||||||
|
source: state.source
|
||||||
|
}) as TState;
|
||||||
case "lightEnabled":
|
case "lightEnabled":
|
||||||
return createResolvedLightEnabledState({
|
return createResolvedLightEnabledState({
|
||||||
target: state.target,
|
target: state.target,
|
||||||
@@ -1648,6 +1684,19 @@ export function areControlEffectsEqual(
|
|||||||
switch (left.type) {
|
switch (left.type) {
|
||||||
case "setActorPresence":
|
case "setActorPresence":
|
||||||
return left.active === (right as SetActorPresenceControlEffect).active;
|
return left.active === (right as SetActorPresenceControlEffect).active;
|
||||||
|
case "playActorAnimation":
|
||||||
|
return (
|
||||||
|
left.clipName === (right as PlayActorAnimationControlEffect).clipName &&
|
||||||
|
left.loop === (right as PlayActorAnimationControlEffect).loop
|
||||||
|
);
|
||||||
|
case "followActorPath":
|
||||||
|
return (
|
||||||
|
left.pathId === (right as FollowActorPathControlEffect).pathId &&
|
||||||
|
left.speed === (right as FollowActorPathControlEffect).speed &&
|
||||||
|
left.loop === (right as FollowActorPathControlEffect).loop &&
|
||||||
|
left.progressMode ===
|
||||||
|
(right as FollowActorPathControlEffect).progressMode
|
||||||
|
);
|
||||||
case "playModelAnimation":
|
case "playModelAnimation":
|
||||||
return (
|
return (
|
||||||
left.clipName === (right as PlayModelAnimationControlEffect).clipName &&
|
left.clipName === (right as PlayModelAnimationControlEffect).clipName &&
|
||||||
@@ -1699,6 +1748,10 @@ export function getControlEffectLabel(effect: ControlEffect): string {
|
|||||||
switch (effect.type) {
|
switch (effect.type) {
|
||||||
case "setActorPresence":
|
case "setActorPresence":
|
||||||
return "Set Actor Presence";
|
return "Set Actor Presence";
|
||||||
|
case "playActorAnimation":
|
||||||
|
return "Play Actor Animation";
|
||||||
|
case "followActorPath":
|
||||||
|
return "Follow Actor Path";
|
||||||
case "playModelAnimation":
|
case "playModelAnimation":
|
||||||
return "Play Animation";
|
return "Play Animation";
|
||||||
case "stopModelAnimation":
|
case "stopModelAnimation":
|
||||||
@@ -1768,6 +1821,14 @@ export function formatControlEffectValue(effect: ControlEffect): string {
|
|||||||
switch (effect.type) {
|
switch (effect.type) {
|
||||||
case "setActorPresence":
|
case "setActorPresence":
|
||||||
return effect.active ? "Present" : "Hidden";
|
return effect.active ? "Present" : "Hidden";
|
||||||
|
case "playActorAnimation":
|
||||||
|
return effect.loop === false
|
||||||
|
? `${effect.clipName} (Once)`
|
||||||
|
: `${effect.clipName} (Loop)`;
|
||||||
|
case "followActorPath":
|
||||||
|
return `${effect.pathId} @ ${effect.speed}${
|
||||||
|
effect.loop ? " (Loop)" : ""
|
||||||
|
}`;
|
||||||
case "playModelAnimation":
|
case "playModelAnimation":
|
||||||
return effect.loop === false
|
return effect.loop === false
|
||||||
? `${effect.clipName} (Once)`
|
? `${effect.clipName} (Once)`
|
||||||
@@ -1814,6 +1875,30 @@ export function applyControlEffectToResolvedState(
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
return nextResolved;
|
return nextResolved;
|
||||||
|
case "playActorAnimation":
|
||||||
|
upsertResolvedDiscreteState(
|
||||||
|
nextResolved,
|
||||||
|
createResolvedActorAnimationPlaybackState({
|
||||||
|
target: effect.target,
|
||||||
|
clipName: effect.clipName,
|
||||||
|
loop: effect.loop,
|
||||||
|
source
|
||||||
|
})
|
||||||
|
);
|
||||||
|
return nextResolved;
|
||||||
|
case "followActorPath":
|
||||||
|
upsertResolvedDiscreteState(
|
||||||
|
nextResolved,
|
||||||
|
createResolvedActorPathAssignmentState({
|
||||||
|
target: effect.target,
|
||||||
|
pathId: effect.pathId,
|
||||||
|
speed: effect.speed,
|
||||||
|
loop: effect.loop,
|
||||||
|
progressMode: effect.progressMode,
|
||||||
|
source
|
||||||
|
})
|
||||||
|
);
|
||||||
|
return nextResolved;
|
||||||
case "playModelAnimation":
|
case "playModelAnimation":
|
||||||
upsertResolvedDiscreteState(
|
upsertResolvedDiscreteState(
|
||||||
nextResolved,
|
nextResolved,
|
||||||
|
|||||||
Reference in New Issue
Block a user