@rig-c/parts 2.46.0 → 2.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.ts +3 -1
- package/docs/AUTHORING.md +28 -6
- package/docs/STABILITY.md +18 -3
- package/package.json +1 -1
- package/src/alternatelayers.ts +2 -1
- package/src/assemble.ts +48 -48
- package/src/assembly-reading.ts +320 -94
- package/src/authoredunit.ts +2 -2
- package/src/build.ts +21 -10
- package/src/check.ts +9 -6
- package/src/config.ts +48 -14
- package/src/depthworkflow.ts +4 -2
- package/src/editedparts.ts +6 -1
- package/src/inputs.ts +1 -1
- package/src/parts.ts +2 -2
- package/src/partsource.ts +4 -1
- package/src/takelayers.ts +4 -1
- package/src/takeregion.ts +4 -1
package/src/check.ts
CHANGED
|
@@ -43,7 +43,7 @@ import { baseAnchorMoves, type AnchorRegion } from './baseanchor.ts';
|
|
|
43
43
|
*
|
|
44
44
|
* | output | what |
|
|
45
45
|
* | --- | --- |
|
|
46
|
-
* | `build
|
|
46
|
+
* | `build/`, `build-report.json` | `rigc build --profile rig-play --pack --page-edges free --pack-shape polygon` (or `pot`, `rect`, when the caller names them; {@link PAGE_EDGES}, {@link PACK_SHAPES}) — the packed atlas is the final artifact, and `build-report.json` beside `build/` holds rigc's own `build-report/1` (`--report`) for that primary packed compile on a failing compile as on a green one (issue #1394) |
|
|
47
47
|
* | `gate_spine-html.txt` | that build's gate lines, verbatim — the one gate: rigc's `build` runs it once over the compile and once over the packed pages on disk, and `rig-play` holds every rule `spine` measures (selftest `CH09`) |
|
|
48
48
|
* | `idle_frames/` | `rigc render --animation idle --fps 12 --max 640 --geometry`: `frames.json` + `idle/f*.png` + `idle/geometry.json` (each mesh's skinned vertices, which `TEXTURE_STRETCH` reads, every attachment's posed triangles, which `TIP_OVER_ROOT` and both halves of `STILL_REGIONS_DARK` read since issues #118 and #123, and every bone's world transform, which the face half reads its head bone from) |
|
|
49
49
|
* | `contact.png` | rigc's own contact sheet of that render, copied out |
|
|
@@ -6898,7 +6898,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6898
6898
|
const out = resolve(outDir);
|
|
6899
6899
|
const outExisted = existsSync(out);
|
|
6900
6900
|
mkdirSync(out, { recursive: true });
|
|
6901
|
-
const buildDir = join(out, 'build');
|
|
6901
|
+
const buildDir = join(out, 'build'), buildReportPath = join(out, BUILD_REPORT_FILE);
|
|
6902
6902
|
const idleDir = join(out, 'idle_frames');
|
|
6903
6903
|
const stillDir = join(out, '_still');
|
|
6904
6904
|
const isoDir = join(out, '_isolated');
|
|
@@ -6908,7 +6908,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6908
6908
|
const foldDir = join(out, FOLD_SCRATCH);
|
|
6909
6909
|
const seamMotionDir = join(out, MOTION_SEAM_SCRATCH);
|
|
6910
6910
|
const windBandDir = join(out, WIND_BAND_SCRATCH);
|
|
6911
|
-
for (const d of [join(out, 'extremes'), join(out, '_extremes'), buildDir, idleDir, stillDir, isoDir, loopDir, seamDir, keptDir, join(out, 'setup_still_auto'), foldDir, seamMotionDir, windBandDir]) rmSync(d, { recursive: true, force: true });
|
|
6911
|
+
for (const d of [join(out, 'extremes'), join(out, '_extremes'), buildDir, buildReportPath, idleDir, stillDir, isoDir, loopDir, seamDir, keptDir, join(out, 'setup_still_auto'), foldDir, seamMotionDir, windBandDir]) rmSync(d, { recursive: true, force: true });
|
|
6912
6912
|
const written: string[] = [];
|
|
6913
6913
|
const write = (name: string, data: string): void => {
|
|
6914
6914
|
writeFileSync(join(out, name), data);
|
|
@@ -6917,9 +6917,9 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6917
6917
|
|
|
6918
6918
|
try {
|
|
6919
6919
|
// 1. build, packed, under the policy profile
|
|
6920
|
-
const build = rigc(['build', '--rig', inp.rigPath, '--motion', inp.motionPath, '--out', buildDir, ...packedBuildArgs(mode)]);
|
|
6920
|
+
const build = rigc(['build', '--rig', inp.rigPath, '--motion', inp.motionPath, '--out', buildDir, '--report', buildReportPath, ...packedBuildArgs(mode)]);
|
|
6921
6921
|
const gateHtml = buildGateLines(build.out);
|
|
6922
|
-
write('gate_spine-html.txt', `${gateHtml.join('\n')}\n`);
|
|
6922
|
+
write('gate_spine-html.txt', `${gateHtml.join('\n')}\n`); if (existsSync(buildReportPath)) written.push(BUILD_REPORT_FILE);
|
|
6923
6923
|
if (build.status !== 0) refuseIfAny(rigcFailed(packedBuildLabel(mode), build, gateHtml));
|
|
6924
6924
|
const pack = parsePackLines(gateHtml);
|
|
6925
6925
|
refuseIfAny(packEdgeProblems(pack, mode));
|
|
@@ -6971,7 +6971,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6971
6971
|
windBandRead = measureWindBand(wb, buildDir, windBandDir, animationNames, rigc);
|
|
6972
6972
|
} catch (err) {
|
|
6973
6973
|
rmSync(windBandDir, { recursive: true, force: true });
|
|
6974
|
-
|
|
6974
|
+
for (const p of [join(out, 'gate_spine-html.txt'), buildReportPath]) rmSync(p, { force: true });
|
|
6975
6975
|
rmSync(buildDir, { recursive: true, force: true });
|
|
6976
6976
|
if (!outExisted) rmSync(out, { recursive: true, force: true });
|
|
6977
6977
|
throw err;
|
|
@@ -9968,3 +9968,6 @@ export function stretchLine(geo: IdleGeometry | null, path: string, problems: Pr
|
|
|
9968
9968
|
per_mesh: rows,
|
|
9969
9969
|
};
|
|
9970
9970
|
}
|
|
9971
|
+
|
|
9972
|
+
/** The compiler's `build-report/1` (`--report`) written beside `build/` on the primary packed compile (issue #1394). */
|
|
9973
|
+
export const BUILD_REPORT_FILE = 'build-report.json';
|
package/src/config.ts
CHANGED
|
@@ -349,7 +349,7 @@ export interface Assemble {
|
|
|
349
349
|
/** Issue #492: composite full:face under head:face on the head canvas to fill transparent holes inside the face silhouette. */
|
|
350
350
|
head_face_underfill?: boolean;
|
|
351
351
|
/** Opt-in: yield original drift-refused front cores and connected non-core rims to an opaque behind holder matching the painting. */
|
|
352
|
-
yield_refused?: boolean;
|
|
352
|
+
yield_refused?: boolean | string[];
|
|
353
353
|
/** Emit the report-only last-writer sidecar; absent or false is off. */
|
|
354
354
|
stage_map?: boolean;
|
|
355
355
|
/** Named plan parts retain their own pixels beneath a drawn-in-front soft occluder. */
|
|
@@ -940,15 +940,15 @@ export function partBoundBones(b: PartBinding): Map<string, string[]> {
|
|
|
940
940
|
* Returns null when `config.turn` is absent, so a rig without a turn block is
|
|
941
941
|
* untouched.
|
|
942
942
|
*/
|
|
943
|
-
export function turnMovingPartPair(
|
|
943
|
+
export function turnMovingPartPair<C extends Pick<ConfigConstraint, 'type'> & { bone?: unknown }>(
|
|
944
944
|
cfg: {
|
|
945
945
|
assemble?: CharacterConfig['assemble'];
|
|
946
946
|
turn?: TurnSpec;
|
|
947
947
|
bones?: BoneEntry[];
|
|
948
948
|
meshes?: Record<string, MeshSpec>;
|
|
949
949
|
regions?: Record<string, RegionSpec>;
|
|
950
|
-
limbs?: Record<string, Limb
|
|
951
|
-
constraints?:
|
|
950
|
+
limbs?: Record<string, Pick<Limb, 'segments'>>;
|
|
951
|
+
constraints?: C[];
|
|
952
952
|
},
|
|
953
953
|
): ((a: string, b: string) => boolean) | null {
|
|
954
954
|
const turn = cfg.turn;
|
|
@@ -1794,7 +1794,7 @@ export interface EarlyConfig {
|
|
|
1794
1794
|
depth?: DepthConfig;
|
|
1795
1795
|
key: string;
|
|
1796
1796
|
seethrough: SeeThrough;
|
|
1797
|
-
assemble: { rig_scale: number; seam?: SeamRule; project?: ProjectRule; ground?: Ground; take?: TakeDeclaration[]; editor_receipts?: EditorReceipts; edited_parts?: EditedParts; head_face_underfill?: boolean; yield_refused?: boolean; stage_map?: boolean; keep_under_occluders?: string[]; require_hidden_extent?: HiddenExtentDeclaration[]; extend_painting?: PaintingExtension[]; occluders?: OccluderDeclaration[]; edge_splits?: EdgeSplit[] };
|
|
1797
|
+
assemble: { rig_scale: number; seam?: SeamRule; project?: ProjectRule; ground?: Ground; take?: TakeDeclaration[]; editor_receipts?: EditorReceipts; edited_parts?: EditedParts; head_face_underfill?: boolean; yield_refused?: boolean | string[]; stage_map?: boolean; keep_under_occluders?: string[]; require_hidden_extent?: HiddenExtentDeclaration[]; extend_painting?: PaintingExtension[]; occluders?: OccluderDeclaration[]; edge_splits?: EdgeSplit[] };
|
|
1798
1798
|
}
|
|
1799
1799
|
|
|
1800
1800
|
/** What plain `assemble` reads: the early config plus the plan `--propose-plan` printed. */
|
|
@@ -1890,9 +1890,7 @@ function parseEarlyConfigFrom(raw: Json, door: EarlyDoor, base: string | null, p
|
|
|
1890
1890
|
if ('take' in a) checkTakeLayers(c, a.take, null, a);
|
|
1891
1891
|
if ('editor_receipts' in a) checkEditorReceipts(c, a.editor_receipts);
|
|
1892
1892
|
if ('edited_parts' in a) checkEditedParts(c, a.edited_parts, a.plan);
|
|
1893
|
-
|
|
1894
|
-
c.fail('CONFIG_FIELD_TYPE', 'config.assemble.yield_refused', `is ${show(a.yield_refused)}; true or false is required`);
|
|
1895
|
-
}
|
|
1893
|
+
checkYieldRefused(c, a);
|
|
1896
1894
|
}
|
|
1897
1895
|
}
|
|
1898
1896
|
}
|
|
@@ -1920,6 +1918,7 @@ function parseEarlyConfigFrom(raw: Json, door: EarlyDoor, base: string | null, p
|
|
|
1920
1918
|
checkAlternates(c, t.assemble.alternates, made, limbs, names?.bones ?? null, names?.chains ?? null, t.regions, t.meshes);
|
|
1921
1919
|
}
|
|
1922
1920
|
const output = new Set([...made.parts.filter(n => !limbs?.consumed.has(n)), ...made.patches, ...made.cuts, ...(limbs?.parts.keys() ?? [])]);
|
|
1921
|
+
if (isPlainObject(t.assemble)) checkYieldRefused(c, t.assemble, new Set([...finalLayerPartNames(made.parts, made.cuts, limbs), ...made.patches]), limbs);
|
|
1923
1922
|
if (isPlainObject(t.assemble) && 'extend_painting' in t.assemble) checkPaintingExtensions(c, t.assemble.extend_painting, new Set([...output].filter(n => !made.patches.includes(n) && !limbs?.consumed.has(n))));
|
|
1924
1923
|
if ('motion_seams' in t) {
|
|
1925
1924
|
c.problems.push(...motionSeamProblems(t.motion_seams, output, 'config.motion_seams', 'CONFIG_MOTION_SEAM'));
|
|
@@ -2141,9 +2140,10 @@ function parseConfigFrom(raw: Json, base: string | null): { config: CharacterCon
|
|
|
2141
2140
|
if (isPlainObject(t.assemble) && 'alternates' in t.assemble) {
|
|
2142
2141
|
checkAlternates(c, t.assemble.alternates, { parts, patches, cuts }, limbs, names.bones, names.chains, t.regions, t.meshes);
|
|
2143
2142
|
}
|
|
2144
|
-
if (isPlainObject(t.assemble)
|
|
2145
|
-
const output =
|
|
2146
|
-
|
|
2143
|
+
if (isPlainObject(t.assemble)) {
|
|
2144
|
+
const output = finalLayerPartNames(parts, cuts, limbs);
|
|
2145
|
+
checkYieldRefused(c, t.assemble, new Set([...output, ...patches]), limbs);
|
|
2146
|
+
if ('extend_painting' in t.assemble) checkPaintingExtensions(c, t.assemble.extend_painting, output);
|
|
2147
2147
|
}
|
|
2148
2148
|
if ('meshes' in t) checkMeshes(c, t.meshes, names.bones, names.chains, t.stops);
|
|
2149
2149
|
if ('regions' in t) checkRegions(c, t.regions, names.bones);
|
|
@@ -2722,6 +2722,43 @@ function checkOccluderFiles(c: Check, assemble: Json, base: string | null): void
|
|
|
2722
2722
|
c.problems.push(...occluderFileProblems(declarations, base));
|
|
2723
2723
|
}
|
|
2724
2724
|
|
|
2725
|
+
function finalLayerPartNames(parts: readonly string[], cuts: readonly string[], limbs: LimbNames | null): Set<string> {
|
|
2726
|
+
return new Set([...parts, ...cuts].filter(name => !limbs?.consumed.has(name)).concat([...(limbs?.parts.keys() ?? [])]));
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2729
|
+
function checkYieldRefused(c: Check, assemble: Record<string, Json>, outputs?: Set<string>, limbs?: LimbNames | null): void {
|
|
2730
|
+
const value = assemble.yield_refused;
|
|
2731
|
+
if (!('yield_refused' in assemble) || typeof value === 'boolean') return;
|
|
2732
|
+
const at = 'config.assemble.yield_refused';
|
|
2733
|
+
if (!Array.isArray(value)) {
|
|
2734
|
+
c.fail('CONFIG_FIELD_TYPE', at, `is ${show(value)}; true, false or a list of final yielding part names is required`);
|
|
2735
|
+
return;
|
|
2736
|
+
}
|
|
2737
|
+
if (value.length === 0) c.fail('CONFIG_FIELD_TYPE', at, 'is []; use false or omit the key to disable yield');
|
|
2738
|
+
const names = outputs === undefined ? undefined : new Set(outputs);
|
|
2739
|
+
if (names !== undefined && Array.isArray(assemble.alternates)) {
|
|
2740
|
+
for (const alternate of assemble.alternates.filter(isPlainObject)) {
|
|
2741
|
+
if (!Array.isArray(alternate.cuts)) continue;
|
|
2742
|
+
for (const cut of alternate.cuts.filter(isPlainObject)) if (typeof cut.into === 'string') names.add(cut.into);
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
const seen = new Set<string>();
|
|
2746
|
+
for (const [i, name] of value.entries()) {
|
|
2747
|
+
const entry = `${at}[${i}]`;
|
|
2748
|
+
if (!c.string(entry, name)) continue;
|
|
2749
|
+
if (seen.has(name)) c.fail('CONFIG_PART_UNIQUE', entry, `names ${show(name)} again; each yielding part is named once`);
|
|
2750
|
+
seen.add(name);
|
|
2751
|
+
if (names !== undefined && !names.has(name)) {
|
|
2752
|
+
const limb = limbs?.consumed.get(name);
|
|
2753
|
+
const segments = limb === undefined ? [] : limbs?.chains.get(limb)?.parts ?? [];
|
|
2754
|
+
const detail = limb === undefined
|
|
2755
|
+
? 'a final output part name is required (source tags and aliases are not accepted)'
|
|
2756
|
+
: `config.limbs.${limb} consumes it; list its final segment parts instead (${segments.map(part => show(part)).join(', ')})`;
|
|
2757
|
+
c.fail('CONFIG_NAME_RESOLVES', entry, `names ${show(name)}; ${detail}`);
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2725
2762
|
function checkKeepUnderOccluders(c: Check, a: Record<string, Json>, plan: readonly string[] | null): void {
|
|
2726
2763
|
if (!('keep_under_occluders' in a)) return;
|
|
2727
2764
|
const at = 'config.assemble.keep_under_occluders';
|
|
@@ -2924,9 +2961,6 @@ function checkAssemble(c: Check, v: Json, door: 'assemble' | 'full'): { parts: s
|
|
|
2924
2961
|
if ('head_face_underfill' in a && typeof a.head_face_underfill !== 'boolean') {
|
|
2925
2962
|
c.fail('CONFIG_FIELD_TYPE', `${p}.head_face_underfill`, `is ${show(a.head_face_underfill)}; true or false is required`);
|
|
2926
2963
|
}
|
|
2927
|
-
if ('yield_refused' in a && typeof a.yield_refused !== 'boolean') {
|
|
2928
|
-
c.fail('CONFIG_FIELD_TYPE', `${p}.yield_refused`, `is ${show(a.yield_refused)}; true or false is required`);
|
|
2929
|
-
}
|
|
2930
2964
|
if ('stage_map' in a && typeof a.stage_map !== 'boolean') {
|
|
2931
2965
|
c.fail('CONFIG_FIELD_TYPE', `${p}.stage_map`, `is ${show(a.stage_map)}; true or false is required`);
|
|
2932
2966
|
}
|
package/src/depthworkflow.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { createHash } from 'node:crypto';
|
|
6
6
|
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from 'node:fs';
|
|
7
7
|
import { basename, dirname, join, relative, resolve, sep } from 'node:path';
|
|
8
|
+
import { refuseStaleAssembly } from './assembly-reading.ts';
|
|
8
9
|
import { loadConfigAndAnimations, parseConfig } from './config.ts';
|
|
9
10
|
import { relocateConfigReferences } from './configrelocation.ts';
|
|
10
11
|
import { depthReading, readSourceDepth } from './depthsheets.ts';
|
|
@@ -223,7 +224,8 @@ export function applyDepth(input: { parts: string; manifest: string; config: str
|
|
|
223
224
|
emptyOutput(input.out, [input.parts, input.config, input.manifest, input.rigConfig, ...Object.values(recipe.parts).flatMap(p => { const map = resolve(dirname(input.config), p.map); return [map, map + '.binding.json']; })]);
|
|
224
225
|
const rawParts = object(readJson(join(input.parts, 'parts.json')), 'parts.json'), file = readParts(join(input.parts, 'parts.json'));
|
|
225
226
|
for (const p of file.parts) if (Object.hasOwn(recipe.parts, p.name) && p.provenance?.depth?.kind === 'authored-unit') fail('DEPTH_AUTHORED_UNIT_CONFLICT', `part "${p.name}"`, 'has provenance.depth.kind "authored-unit"; a transported scalar reference cannot coexist with authored unit depth — retain the unit declaration or supply an explicitly reassembled scalar-compatible input; no automatic transition is made');
|
|
226
|
-
loadConfigAndAnimations(input.rigConfig);
|
|
227
|
+
const { config } = loadConfigAndAnimations(input.rigConfig);
|
|
228
|
+
refuseStaleAssembly(input.rigConfig, file, config);
|
|
227
229
|
const raw = object(readJson(input.rigConfig), 'rig config'), turn = object(raw.turn, 'config.turn');
|
|
228
230
|
for (const [name, group] of Object.entries(recipe.groups)) {
|
|
229
231
|
const target = name === 'head' ? turn : object(turn.body, 'config.turn.body'); target.pivot = group.pivot;
|
|
@@ -231,7 +233,7 @@ export function applyDepth(input: { parts: string; manifest: string; config: str
|
|
|
231
233
|
}
|
|
232
234
|
// Keep relative paths portable when relocating the output directory with its inputs.
|
|
233
235
|
relocateConfigReferences(raw, dirname(input.rigConfig), input.out, 'relative');
|
|
234
|
-
parseConfig(raw);
|
|
236
|
+
refuseStaleAssembly(join(input.out, 'config.json'), file, parseConfig(raw));
|
|
235
237
|
const warnings: string[] = [];
|
|
236
238
|
const writes = new Map<string, Uint8Array>(), rows: Obj[] = [], recs = rawParts.parts as Obj[];
|
|
237
239
|
// Retain auxiliary art (including alternate sets) and diagnostics byte-for-byte.
|
package/src/editedparts.ts
CHANGED
|
@@ -128,7 +128,12 @@ export function replaceEditedParts(
|
|
|
128
128
|
continue;
|
|
129
129
|
}
|
|
130
130
|
const found = sha(encodePngBytes(part.image));
|
|
131
|
-
if (found !== receipt.from_sha256) problems.push({
|
|
131
|
+
if (found !== receipt.from_sha256) problems.push({
|
|
132
|
+
code: 'ASSEMBLE_EDITED_PART_BASELINE', object,
|
|
133
|
+
detail: `the current assembled PNG sha256 is ${found}; receipt from_sha256 ${receipt.from_sha256} is required. ` +
|
|
134
|
+
'The assembled PNG changed since the baseline, typically because an assembly input changed. ' +
|
|
135
|
+
'Use edited-part --parts with the prior manifest and current config to check for ASSEMBLY_CONFIG_STALE and see which assembly fields changed',
|
|
136
|
+
});
|
|
132
137
|
if (image.width !== part.record.w || image.height !== part.record.h) problems.push({ code: 'ASSEMBLE_EDITED_PART_SIZE', object, detail: `edited PNG is ${image.width}x${image.height}; assembled box ${part.record.w}x${part.record.h} is required` });
|
|
133
138
|
const actual = sha(edit.bytes);
|
|
134
139
|
if (actual !== receipt.sha256) problems.push({ code: 'ASSEMBLE_EDITED_PART_SHA256', object, detail: `edited bytes sha256 is ${actual}; receipt sha256 ${receipt.sha256} is required` });
|
package/src/inputs.ts
CHANGED
|
@@ -73,7 +73,7 @@ export function padToSquare(w: number, h: number, side: number): SquarePad {
|
|
|
73
73
|
return { side, left: Math.floor((side - w) / 2), top: Math.floor((side - h) / 2) };
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
export function makeInputs(painting: Raster, cfg: Pick<CharacterConfig
|
|
76
|
+
export function makeInputs(painting: Raster, cfg: { seethrough?: Partial<Pick<NonNullable<CharacterConfig['seethrough']>, 'head_box' | 'resolution'>> }, label: string): SeeThroughInputs {
|
|
77
77
|
const problems: Problem[] = [];
|
|
78
78
|
const { width: w, height: h } = painting;
|
|
79
79
|
let translucent = 0;
|
package/src/parts.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assemblyFieldDigest } from './assembly-reading.ts';
|
|
1
|
+
import { assemblyFieldDigest, isSplitTakeMetadataField } from './assembly-reading.ts';
|
|
2
2
|
import { orderedEditedPartReceipt, type EditedPartReceipt } from './editedparts.ts';
|
|
3
3
|
import { parseReceiptProducer, receiptText } from './receiptproducer.ts';
|
|
4
4
|
import { takenSourceProblems, type TakenLayerSource } from './takesource.ts';
|
|
@@ -886,7 +886,7 @@ function checkParts(raw: unknown, path: string): PartsFile {
|
|
|
886
886
|
if (value === null || typeof value !== 'object' || Object.keys(value).some(key => key !== 'sha256' && key !== 'fields') ||
|
|
887
887
|
!digest(value.sha256) || !Array.isArray(value.fields) || value.fields.length === 0 ||
|
|
888
888
|
!value.fields.every((row, i) => row !== null && typeof row === 'object' && Object.keys(row).length === 2 &&
|
|
889
|
-
typeof row.name === 'string' && /^[a-z_]+(?:\.[a-z_]+)*$/.test(row.name) &&
|
|
889
|
+
typeof row.name === 'string' && (/^[a-z_]+(?:\.[a-z_]+)*$/.test(row.name) || isSplitTakeMetadataField(row.name)) &&
|
|
890
890
|
digest(row.sha256) && (i === 0 || value.fields![i - 1].name < row.name)) ||
|
|
891
891
|
assemblyFieldDigest(value.fields) !== value.sha256) {
|
|
892
892
|
fail('PARTS_FIELD_TYPE', `${path} field "assembly_config"`, 'requires sorted distinct field names with lowercase SHA-256 digests and their matching aggregate digest');
|
package/src/partsource.ts
CHANGED
|
@@ -54,7 +54,10 @@ export function tracePartsDeclared(cfg: Pick<AssembleConfig, 'assemble'>): boole
|
|
|
54
54
|
* Order is the config's: cuts, each alternate set's cuts, patches, painting
|
|
55
55
|
* extensions, the arm split, limb splits in key order.
|
|
56
56
|
*/
|
|
57
|
-
export function untracedPartSources(cfg: Pick<AssembleConfig, 'assemble'
|
|
57
|
+
export function untracedPartSources(cfg: Pick<AssembleConfig, 'assemble'> & {
|
|
58
|
+
seethrough: Pick<AssembleConfig['seethrough'], 'arm_split'>;
|
|
59
|
+
limbs?: Record<string, Pick<NonNullable<AssembleConfig['limbs']>[string], 'segments' | 'split'>>;
|
|
60
|
+
}): Problem[] {
|
|
58
61
|
if (!tracePartsDeclared(cfg)) return [];
|
|
59
62
|
const out: Problem[] = [];
|
|
60
63
|
const refuse = (object: string, found: string): void => {
|
package/src/takelayers.ts
CHANGED
|
@@ -161,7 +161,10 @@ function supportOverlap(a: Layer, b: Layer): number {
|
|
|
161
161
|
return px;
|
|
162
162
|
}
|
|
163
163
|
/** Apply every declaration together, so replacing all tied layers from one run can retain its known order. */
|
|
164
|
-
export function applyTakenLayers
|
|
164
|
+
export function applyTakenLayers<T extends Pick<EarlyConfig, 'depth'> & {
|
|
165
|
+
seethrough: Pick<EarlyConfig['seethrough'], 'resolution' | 'head_box'>;
|
|
166
|
+
assemble: { take?: TakeDeclaration[]; plan?: PlanEntry[]; occluders?: OccluderDeclaration[] };
|
|
167
|
+
}>(runs: { full: LayerSet; head: LayerSet; single: boolean }, painting: Raster, cfg: T, configPath: string): { full: LayerSet; head: LayerSet; single: boolean; notes: string[] } {
|
|
165
168
|
const wholeDeclarations = (cfg.assemble.take ?? []).filter((item): item is TakeLayers => 'tags' in item);
|
|
166
169
|
const declarations = (cfg.assemble.take ?? []).filter((item): item is TakeLayers | TakeOccluderSplit => 'tags' in item || 'occluder' in item);
|
|
167
170
|
const occluders = cfg.assemble.occluders ?? [];
|
package/src/takeregion.ts
CHANGED
|
@@ -118,7 +118,10 @@ export function deriveTakenRegion(base: Layer, donor: Layer, painting: Raster, s
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/** Called beside whole-layer take, before assembly or any output emission. */
|
|
121
|
-
export function applyTakenRegions(runs: Runs, painting: Raster, cfg: AssembleConfig,
|
|
121
|
+
export function applyTakenRegions(runs: Runs, painting: Raster, cfg: Pick<AssembleConfig, 'depth'> & {
|
|
122
|
+
seethrough: Pick<AssembleConfig['seethrough'], 'head_box'> | undefined;
|
|
123
|
+
assemble: Pick<AssembleConfig['assemble'], 'take' | 'plan'>;
|
|
124
|
+
}, configPath: string, setup: SetupPainting | undefined, receipts: ReceiptLedger, sourcePath?: string): Runs {
|
|
122
125
|
const declarations = (cfg.assemble.take ?? []).filter((item): item is TakeRegion => 'seed' in item);
|
|
123
126
|
if (declarations.length === 0) return runs;
|
|
124
127
|
const tolerance = setup?.rgb_tolerance;
|