feat(web): switch to implementation-first capability wave
This commit is contained in:
16
web/protocol/workbench-command-groups.ts
Normal file
16
web/protocol/workbench-command-groups.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user