114 lines
8.8 KiB
TypeScript
114 lines
8.8 KiB
TypeScript
import type { FCurveInterpolation } from "./web-engine";
|
|
import type { WebEngineEditCommand } from "./web-engine";
|
|
|
|
type AnimationCommand<T extends WebEngineEditCommand["type"]> = Extract<WebEngineEditCommand, { type: T }>;
|
|
|
|
/** Typed constructors for animation, constraint and render property edits. */
|
|
export const animationRenderCommands = Object.freeze({
|
|
insertKeyframe(objectId: string, frame: number, property: AnimationCommand<"insertObjectKeyframe">["property"], interpolation: FCurveInterpolation = "BEZIER"): AnimationCommand<"insertObjectKeyframe"> {
|
|
return { type: "insertObjectKeyframe", objectId, frame, property, interpolation };
|
|
},
|
|
deleteKeyframe(objectId: string, frame: number, property?: AnimationCommand<"deleteObjectKeyframe">["property"]): AnimationCommand<"deleteObjectKeyframe"> {
|
|
return { type: "deleteObjectKeyframe", objectId, frame, ...(property ? { property } : {}) };
|
|
},
|
|
setConstraint(objectId: string, constraintName: string, enabled: boolean, influence: number): AnimationCommand<"setConstraint"> {
|
|
return { type: "setConstraint", objectId, constraintName, enabled, influence };
|
|
},
|
|
setActiveAction(objectId: string, actionId: string | null): AnimationCommand<"setActiveAction"> {
|
|
return { type: "setActiveAction", objectId, actionId };
|
|
},
|
|
setNLAStack(objectId: string, tracks: AnimationCommand<"setNLAStack">["tracks"], baseRevision?: number): AnimationCommand<"setNLAStack"> {
|
|
return { type: "setNLAStack", objectId, tracks, ...(baseRevision === undefined ? {} : { baseRevision }) };
|
|
},
|
|
moveNLAStrip(objectId: string, trackId: string, stripId: string, frameStart: number, baseRevision: number): AnimationCommand<"moveNLAStrip"> {
|
|
return { type: "moveNLAStrip", objectId, trackId, stripId, frameStart, baseRevision };
|
|
},
|
|
setLightProperties(dataId: string, properties: AnimationCommand<"setLightProperties">["properties"]): AnimationCommand<"setLightProperties"> {
|
|
return { type: "setLightProperties", dataId, properties };
|
|
},
|
|
setCameraProperties(dataId: string, properties: AnimationCommand<"setCameraProperties">["properties"]): AnimationCommand<"setCameraProperties"> {
|
|
return { type: "setCameraProperties", dataId, properties };
|
|
},
|
|
setWorldProperties(dataId: string, properties: AnimationCommand<"setWorldProperties">["properties"]): AnimationCommand<"setWorldProperties"> {
|
|
return { type: "setWorldProperties", dataId, properties };
|
|
},
|
|
setSceneProperties(dataId: string, properties: AnimationCommand<"setSceneProperties">["properties"]): AnimationCommand<"setSceneProperties"> {
|
|
return { type: "setSceneProperties", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneRenderSettings(dataId: string, properties: AnimationCommand<"setSceneRenderSettings">["properties"]): AnimationCommand<"setSceneRenderSettings"> {
|
|
return { type: "setSceneRenderSettings", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneAudioSettings(dataId: string, properties: AnimationCommand<"setSceneAudioSettings">["properties"]): AnimationCommand<"setSceneAudioSettings"> {
|
|
return { type: "setSceneAudioSettings", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneUnitSettings(dataId: string, properties: AnimationCommand<"setSceneUnitSettings">["properties"]): AnimationCommand<"setSceneUnitSettings"> {
|
|
return { type: "setSceneUnitSettings", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneTimelineSettings(dataId: string, properties: AnimationCommand<"setSceneTimelineSettings">["properties"]): AnimationCommand<"setSceneTimelineSettings"> {
|
|
return { type: "setSceneTimelineSettings", dataId, properties: { ...properties } };
|
|
},
|
|
setScenePipelineSettings(dataId: string, properties: AnimationCommand<"setScenePipelineSettings">["properties"]): AnimationCommand<"setScenePipelineSettings"> {
|
|
return { type: "setScenePipelineSettings", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneBindings(dataId: string, properties: AnimationCommand<"setSceneBindings">["properties"]): AnimationCommand<"setSceneBindings"> {
|
|
return { type: "setSceneBindings", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneViewLayerSettings(dataId: string, layerName: string, properties: AnimationCommand<"setSceneViewLayerSettings">["properties"]): AnimationCommand<"setSceneViewLayerSettings"> {
|
|
return { type: "setSceneViewLayerSettings", dataId, layerName, properties: { ...properties } };
|
|
},
|
|
setSceneCollectionSettings(dataId: string, layerName: string, collectionId: string, properties: AnimationCommand<"setSceneCollectionSettings">["properties"]): AnimationCommand<"setSceneCollectionSettings"> {
|
|
return { type: "setSceneCollectionSettings", dataId, layerName, collectionId, properties: { ...properties } };
|
|
},
|
|
setSceneBorderSettings(dataId: string, properties: AnimationCommand<"setSceneBorderSettings">["properties"]): AnimationCommand<"setSceneBorderSettings"> {
|
|
return { type: "setSceneBorderSettings", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneSimplifySettings(dataId: string, properties: AnimationCommand<"setSceneSimplifySettings">["properties"]): AnimationCommand<"setSceneSimplifySettings"> {
|
|
return { type: "setSceneSimplifySettings", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneColorManagement(dataId: string, properties: AnimationCommand<"setSceneColorManagement">["properties"]): AnimationCommand<"setSceneColorManagement"> {
|
|
return { type: "setSceneColorManagement", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneImageFormat(dataId: string, properties: AnimationCommand<"setSceneImageFormat">["properties"]): AnimationCommand<"setSceneImageFormat"> {
|
|
return { type: "setSceneImageFormat", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneMotionBlur(dataId: string, properties: AnimationCommand<"setSceneMotionBlur">["properties"]): AnimationCommand<"setSceneMotionBlur"> {
|
|
return { type: "setSceneMotionBlur", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneHairSettings(dataId: string, properties: AnimationCommand<"setSceneHairSettings">["properties"]): AnimationCommand<"setSceneHairSettings"> {
|
|
return { type: "setSceneHairSettings", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneCompositorSettings(dataId: string, properties: AnimationCommand<"setSceneCompositorSettings">["properties"]): AnimationCommand<"setSceneCompositorSettings"> {
|
|
return { type: "setSceneCompositorSettings", dataId, properties: { ...properties } };
|
|
},
|
|
setScenePerformanceSettings(dataId: string, properties: AnimationCommand<"setScenePerformanceSettings">["properties"]): AnimationCommand<"setScenePerformanceSettings"> {
|
|
return { type: "setScenePerformanceSettings", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneSamplingSettings(dataId: string, properties: AnimationCommand<"setSceneSamplingSettings">["properties"]): AnimationCommand<"setSceneSamplingSettings"> {
|
|
return { type: "setSceneSamplingSettings", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneMultiviewSettings(dataId: string, properties: AnimationCommand<"setSceneMultiviewSettings">["properties"]): AnimationCommand<"setSceneMultiviewSettings"> {
|
|
return { type: "setSceneMultiviewSettings", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneStampSettings(dataId: string, properties: AnimationCommand<"setSceneStampSettings">["properties"]): AnimationCommand<"setSceneStampSettings"> {
|
|
return { type: "setSceneStampSettings", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneLineSettings(dataId: string, properties: AnimationCommand<"setSceneLineSettings">["properties"]): AnimationCommand<"setSceneLineSettings"> {
|
|
return { type: "setSceneLineSettings", dataId, properties: { ...properties } };
|
|
},
|
|
setSceneViewLayerPassSettings(dataId: string, layerName: string, properties: AnimationCommand<"setSceneViewLayerPassSettings">["properties"]): AnimationCommand<"setSceneViewLayerPassSettings"> {
|
|
return { type: "setSceneViewLayerPassSettings", dataId, layerName, properties: { ...properties } };
|
|
},
|
|
setSceneViewLayerAOVs(dataId: string, layerName: string, aovs: AnimationCommand<"setSceneViewLayerAOVs">["aovs"]): AnimationCommand<"setSceneViewLayerAOVs"> {
|
|
return { type: "setSceneViewLayerAOVs", dataId, layerName, aovs: aovs.map((aov) => ({ ...aov })) };
|
|
},
|
|
setSceneViewLayerLightgroups(dataId: string, layerName: string, lightgroups: string[]): AnimationCommand<"setSceneViewLayerLightgroups"> {
|
|
return { type: "setSceneViewLayerLightgroups", dataId, layerName, lightgroups: [...lightgroups] };
|
|
},
|
|
setObjectLightgroup(objectId: string, lightgroup: string | null): AnimationCommand<"setObjectLightgroup"> {
|
|
return { type: "setObjectLightgroup", objectId, lightgroup };
|
|
},
|
|
setWorldLightgroup(dataId: string, lightgroup: string | null): AnimationCommand<"setWorldLightgroup"> {
|
|
return { type: "setWorldLightgroup", dataId, lightgroup };
|
|
},
|
|
} satisfies Record<string, (...args: never[]) => WebEngineEditCommand>);
|