Files
workinf_Blender_Wasm/web/protocol/workbench-command-groups.ts
mes123456 7549b9a15c
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
feat(web): switch to implementation-first capability wave
2026-08-29 01:22:03 +08:00

17 lines
1.2 KiB
TypeScript

import { getWebEngineCommandCapability, type WebEngineCommandType } from "./web-engine-capabilities";
export const WORKBENCH_COMMAND_GROUPS = Object.freeze({
OBJECT: ["createPrimitive", "duplicateObject", "deleteObject", "setObjectTransform", "setParent", "createCollection", "moveObjectToCollection", "renameId", "applyObjectTransform", "setObjectOrigin"],
MESH: ["meshEdit", "translateMeshVertices", "createUVMap", "setActiveUVMap", "unwrapUV", "setVertexColors", "setVertexWeights"],
ANIMATION: ["setFrame", "insertObjectKeyframe", "deleteObjectKeyframe", "setFCurveInterpolation", "setConstraint", "setNLAStack"],
RENDER: ["setCameraProperties", "setLightProperties", "setWorldProperties"],
IO: ["importImage", "importVFont", "setMaterialImageNode"],
} as const satisfies Record<string, readonly WebEngineCommandType[]>);
export function isWorkbenchCommandAvailable(type: unknown): type is WebEngineCommandType {
return getWebEngineCommandCapability(type)?.route !== "MAIN_GUARDED";
}
export function workbenchCommandCount(): number {
return Object.values(WORKBENCH_COMMAND_GROUPS).reduce((count, group) => count + group.filter(isWorkbenchCommandAvailable).length, 0);
}