Advance N-015 through N-018 bounded workflows

This commit is contained in:
mes123456
2026-08-12 17:14:27 -04:00
parent 86136139e2
commit d54d5dd913
30 changed files with 662 additions and 59 deletions

View File

@@ -0,0 +1,15 @@
import { applyGreasePencilEditorEdit, parseGreasePencilEditor } from "../../../protocol/grease-pencil-editor";
self.onmessage = () => {
const result: Record<string, unknown> = {};
const base = { schemaVersion: 1, revision: 0, dataId: "grease-pencil:Data", layerId: "layer:Lines", frame: 1, onionSkinning: true, selectedStrokeIndices: [], selectedPoints: [] };
try {
const frame = applyGreasePencilEditorEdit(base, { type: "SET_FRAME", revision: 0, frame: 5 });
const selection = applyGreasePencilEditorEdit(frame, { type: "SET_SELECTION", revision: 1, strokeIndices: [2, 0], points: [{ strokeIndex: 2, pointIndex: 1 }] });
result.edit = [selection.revision, selection.frame, selection.selectedStrokeIndices, selection.selectedPoints];
} catch (error) { result.edit = error instanceof Error ? error.message : String(error); }
try { applyGreasePencilEditorEdit(base, { type: "SET_LAYER", revision: 7, layerId: "layer:Other" }); } catch (error) { result.stale = error instanceof Error ? error.message : String(error); }
try { parseGreasePencilEditor({ ...base, selectedPoints: [{ strokeIndex: 1, pointIndex: 1 }, { strokeIndex: 1, pointIndex: 1 }] }); } catch (error) { result.duplicate = error instanceof Error ? error.message : String(error); }
try { parseGreasePencilEditor({ ...base, selectedStrokeIndices: [-1] }); } catch (error) { result.negative = error instanceof Error ? error.message : String(error); }
self.postMessage(result);
};

View File

@@ -0,0 +1,11 @@
import { applyCurveGizmoDelta } from "../../../protocol/nonmesh-interaction";
self.onmessage = () => {
const result: Record<string, unknown> = {};
const base = { schemaVersion: 1, dataId: "curve:1", baseRevision: 3, phase: "COMMIT", axis: 0, delta: [0.25, 0, 0], handles: [{ pointIndex: 2, side: "LEFT", position: [1, 2, 3] }] };
try { const applied = applyCurveGizmoDelta(base, 3); result.commit = [applied.revision, applied.handles[0].position]; } catch (error) { result.commit = error instanceof Error ? error.message : String(error); }
try { applyCurveGizmoDelta(base, 4); } catch (error) { result.stale = error instanceof Error ? error.message : String(error); }
try { applyCurveGizmoDelta({ ...base, handles: [{ ...base.handles[0] }, { ...base.handles[0] }] }, 3); } catch (error) { result.duplicate = error instanceof Error ? error.message : String(error); }
try { applyCurveGizmoDelta({ ...base, delta: [0.25, 0.25, 0] }, 3); } catch (error) { result.axis = error instanceof Error ? error.message : String(error); }
self.postMessage(result);
};

View File

@@ -223,6 +223,7 @@ function assertFutureCapability(payload: Extract<WebEngineRequest["command"], {
case "setCurveTopology": {
const data = currentSnapshot?.nonMeshData?.find((candidate) => candidate.id === payload.dataId);
if (!data || (data.type !== "CURVE" && data.type !== "SURFACE")) throw report("NON_MESH_DATA_UNSUPPORTED", `N-015 curve data block is unavailable: ${payload.dataId}`);
if (payload.baseRevision !== undefined && payload.baseRevision !== currentSnapshot?.revision) throw report("REVISION_CONFLICT", "Curve topology base revision does not match the current SceneIR");
const splineCount = data.splineCount;
if (payload.splineTypes !== undefined && (payload.splineTypes.length !== splineCount || payload.splineTypes.some((value) => !["POLY", "BEZIER", "NURBS"].includes(value)))) throw report("NON_MESH_PROPERTY_INVALID", "Curve spline types must match the existing topology");
for (const values of [payload.cyclicU, payload.cyclicV]) if (values !== undefined && values.length !== splineCount) throw report("NON_MESH_PROPERTY_INVALID", "Curve cyclic flags must match the spline count");