Advance M8-M11 parity workflows
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

This commit is contained in:
mes123456
2026-08-17 04:37:07 -04:00
parent 7c16b279ae
commit 0fe8d2bb56
324 changed files with 31920 additions and 863 deletions

View File

@@ -11,6 +11,7 @@ export type GreasePencilAttributeDomain = "POINT" | "STROKE" | "CURVE" | "INSTAN
export type GreasePencilAttributeDataType = "BOOL" | "INT" | "FLOAT" | "FLOAT2" | "FLOAT3" | "FLOAT4" | "BYTE_COLOR" | "FLOAT_COLOR";
export interface GreasePencilPointIR {
id: string;
position: [number, number, number];
radius: number;
opacity: number;
@@ -26,7 +27,7 @@ export interface GreasePencilAttributeIR {
}
export interface GreasePencilStrokeIR {
id?: string;
id: string;
cyclic: boolean;
pointCount: number;
points?: GreasePencilPointIR[];
@@ -67,6 +68,7 @@ export interface GreasePencilDataIR {
strokeCount: number;
pointCount: number;
layers: GreasePencilLayerIR[];
activeLayerId?: string;
attributes?: GreasePencilAttributeIR[];
errorCode?: "GREASE_PENCIL_SCHEMA_INVALID" | "GREASE_PENCIL_BUDGET_EXCEEDED";
}
@@ -123,24 +125,28 @@ function parseAttribute(value: unknown, path: string, domainCount: number): Grea
function parsePoint(value: unknown, path: string): GreasePencilPointIR {
const point = record(value, path);
const id = string(point.id, `${path}.id`);
if (!id.startsWith("grease-pencil-point:")) fail(`${path}.id`, "must be a stable Grease Pencil point identity");
const position = tuple(point.position, 3, `${path}.position`) as [number, number, number];
const radius = number(point.radius, `${path}.radius`);
const opacity = number(point.opacity, `${path}.opacity`);
if (radius < 0 || radius > 1_000_000) fail(`${path}.radius`, "is outside the bounded range");
if (opacity < 0 || opacity > 1) fail(`${path}.opacity`, "must be in [0,1]");
const result: GreasePencilPointIR = { position, radius, opacity };
const result: GreasePencilPointIR = { id, position, radius, opacity };
if (point.vertexColor !== undefined) result.vertexColor = tuple(point.vertexColor, 4, `${path}.vertexColor`) as [number, number, number, number];
return result;
}
function parseStroke(value: unknown, path: string): GreasePencilStrokeIR {
const stroke = record(value, path);
const id = string(stroke.id, `${path}.id`);
if (!id.startsWith("grease-pencil-stroke:")) fail(`${path}.id`, "must be a stable Grease Pencil stroke identity");
const result: GreasePencilStrokeIR = {
id,
cyclic: stroke.cyclic === true,
pointCount: count(stroke.pointCount, `${path}.pointCount`),
};
if (typeof stroke.cyclic !== "boolean") fail(`${path}.cyclic`, "must be a boolean");
if (stroke.id !== undefined) result.id = string(stroke.id, `${path}.id`);
if (stroke.materialIndex !== undefined) result.materialIndex = count(stroke.materialIndex, `${path}.materialIndex`);
if (stroke.points !== undefined) {
if (!Array.isArray(stroke.points)) fail(`${path}.points`, "must be an array");
@@ -162,6 +168,9 @@ function parseDrawing(value: unknown, path: string): GreasePencilDrawingIR {
if (!Array.isArray(drawing.strokes)) fail(`${path}.strokes`, "must be an array");
if (drawing.strokes.length !== strokeCount) fail(`${path}.strokes`, "length must match strokeCount");
const strokes = drawing.strokes.map((stroke, index) => parseStroke(stroke, `${path}.strokes[${index}]`));
if (new Set(strokes.map((stroke) => stroke.id)).size !== strokes.length) fail(`${path}.strokes`, "contains duplicate stable stroke identities");
const pointIds = strokes.flatMap((stroke) => (stroke.points ?? []).map((point) => point.id));
if (new Set(pointIds).size !== pointIds.length) fail(`${path}.strokes`, "contains duplicate stable point identities");
if (strokes.reduce((sum, stroke) => sum + stroke.pointCount, 0) !== pointCount) fail(`${path}.pointCount`, "must equal the sum of stroke point counts");
const result: GreasePencilDrawingIR = { id, strokeCount, pointCount, strokes };
if (drawing.attributes !== undefined) {
@@ -224,6 +233,11 @@ export function parseGreasePencilData(value: unknown, path = "greasePencils"): G
const actualPoints = layers.reduce((sum, layer) => sum + layer.frames.reduce((frameSum, frame) => frameSum + frame.drawing.pointCount, 0), 0);
if (!budgetBlocked && (actualFrames !== frameCount || actualStrokes !== strokeCount || actualPoints !== pointCount)) fail(path, "declared counts do not match layer/frame/drawing contents");
const result: GreasePencilDataIR = { id, name, geometryStatus, layerCount, frameCount, strokeCount, pointCount, layers };
if (data.activeLayerId !== undefined) {
const activeLayerId = string(data.activeLayerId, `${path}.activeLayerId`);
if (!layers.some((layer) => layer.id === activeLayerId)) fail(`${path}.activeLayerId`, "must reference a declared layer");
result.activeLayerId = activeLayerId;
}
if (data.errorCode !== undefined) {
if (data.errorCode !== "GREASE_PENCIL_SCHEMA_INVALID" && data.errorCode !== "GREASE_PENCIL_BUDGET_EXCEEDED") fail(`${path}.errorCode`, "is invalid");
result.errorCode = data.errorCode;