Advance M8-M11 parity workflows
This commit is contained in:
@@ -40,7 +40,10 @@ export interface WeightPatchIR {
|
||||
indices: number[];
|
||||
values: number[];
|
||||
normalize?: boolean;
|
||||
limit?: number;
|
||||
mirror?: boolean;
|
||||
mirrorAxis?: 0 | 1 | 2;
|
||||
mirrorTolerance?: number;
|
||||
}
|
||||
|
||||
export interface PaintBrushVertexIR {
|
||||
@@ -278,10 +281,26 @@ export function parseWeightPatch(value: unknown): WeightPatchIR {
|
||||
if (typeof patch.normalize !== "boolean") fail("weightPatch.normalize", "must be boolean");
|
||||
result.normalize = patch.normalize;
|
||||
}
|
||||
if (patch.limit !== undefined) {
|
||||
const limit = integer(patch.limit, "weightPatch.limit");
|
||||
if (limit < 1 || limit > 32) fail("weightPatch.limit", "must be in [1,32]");
|
||||
result.limit = limit;
|
||||
}
|
||||
if (patch.mirror !== undefined) {
|
||||
if (typeof patch.mirror !== "boolean") fail("weightPatch.mirror", "must be boolean");
|
||||
result.mirror = patch.mirror;
|
||||
}
|
||||
if (patch.mirrorAxis !== undefined) {
|
||||
const axis = integer(patch.mirrorAxis, "weightPatch.mirrorAxis");
|
||||
if (axis > 2) fail("weightPatch.mirrorAxis", "must be 0, 1 or 2");
|
||||
result.mirrorAxis = axis as 0 | 1 | 2;
|
||||
}
|
||||
if (patch.mirrorTolerance !== undefined) {
|
||||
const tolerance = finite(patch.mirrorTolerance, "weightPatch.mirrorTolerance");
|
||||
if (tolerance <= 0 || tolerance > 1) fail("weightPatch.mirrorTolerance", "must be in (0,1]");
|
||||
result.mirrorTolerance = tolerance;
|
||||
}
|
||||
if (!result.mirror && (result.mirrorAxis !== undefined || result.mirrorTolerance !== undefined)) fail("weightPatch.mirrorAxis/mirrorTolerance", "require mirror=true");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user