feat(web): complete portable Blender feature gaps
This commit is contained in:
@@ -41,6 +41,17 @@ export interface RenderRoutingResultIR {
|
||||
issues: Array<{ code: ErrorCode; message: string; recoverable: boolean }>;
|
||||
}
|
||||
|
||||
export type RenderCommandKind = "renderFrame" | "renderAnimation";
|
||||
|
||||
export interface RenderCommandRequestIR {
|
||||
kind: RenderCommandKind;
|
||||
routing: RenderRoutingRequestIR;
|
||||
frame?: number;
|
||||
frameStart?: number;
|
||||
frameEnd?: number;
|
||||
step?: number;
|
||||
}
|
||||
|
||||
function blocked(
|
||||
target: RenderRoutingTarget,
|
||||
capability: RenderRoutingResultIR["capability"],
|
||||
@@ -103,3 +114,19 @@ export function routeRenderExecution(request: RenderRoutingRequestIR, context: R
|
||||
}
|
||||
return blocked("SERVER_JOB", "UNSUPPORTED_RENDER_ENGINE", "UNSUPPORTED_ENGINE", "PLATFORM_CAPABILITY_UNAVAILABLE", "The requested render engine has no declared Web or server route");
|
||||
}
|
||||
|
||||
/** Routes a user-visible frame or animation render through the declared native/server capability. */
|
||||
export function routeRenderCommand(request: RenderCommandRequestIR, context: RenderRoutingContextIR = {}): RenderRoutingResultIR {
|
||||
if (request.kind === "renderFrame" && request.frame !== undefined && (!Number.isSafeInteger(request.frame) || request.frame < -1000000 || request.frame > 1000000)) {
|
||||
throw new Error("INVALID_ARGUMENT: render frame is outside the bounded range");
|
||||
}
|
||||
if (request.kind === "renderAnimation") {
|
||||
if (!Number.isSafeInteger(request.frameStart) || !Number.isSafeInteger(request.frameEnd) || request.frameStart! > request.frameEnd!) {
|
||||
throw new Error("INVALID_ARGUMENT: render animation range is invalid");
|
||||
}
|
||||
if (request.step !== undefined && (!Number.isSafeInteger(request.step) || request.step < 1 || request.step > 1000)) {
|
||||
throw new Error("INVALID_ARGUMENT: render animation step is invalid");
|
||||
}
|
||||
}
|
||||
return routeRenderExecution(request.routing, context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user