Advance N-015 through N-018 bounded workflows
This commit is contained in:
15
web/app/src/workers/grease-pencil-editor-test.worker.ts
Normal file
15
web/app/src/workers/grease-pencil-editor-test.worker.ts
Normal 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);
|
||||
};
|
||||
11
web/app/src/workers/nonmesh-interaction-test.worker.ts
Normal file
11
web/app/src/workers/nonmesh-interaction-test.worker.ts
Normal 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);
|
||||
};
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user