@rig-c/parts 2.47.1 → 2.49.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/docs/AUTHORING.md +180 -77
- package/docs/STABILITY.md +130 -33
- package/package.json +1 -1
- package/src/assembly-reading.ts +35 -9
- package/src/behindseams.ts +223 -101
- package/src/build.ts +47 -6
- package/src/check.ts +2 -0
- package/src/takeregion.ts +4 -2
package/docs/STABILITY.md
CHANGED
|
@@ -375,6 +375,47 @@ these new fields are missing from an older stamp, the stale refusal says
|
|
|
375
375
|
that the stamp predates the binding and asks for one re-assemble with the
|
|
376
376
|
same config.
|
|
377
377
|
|
|
378
|
+
A config with a region take (an `assemble.take` entry with `seed`) and a
|
|
379
|
+
`config.requirements` file that declares `setup_painting.rgb_tolerance` binds
|
|
380
|
+
that tolerance at `requirements.setup_painting.rgb_tolerance`. Under
|
|
381
|
+
`ground: "busy"` with `project: "visible"`, the `requirements.setup_painting`
|
|
382
|
+
field already binds the tolerance, so this field is not written there. A
|
|
383
|
+
config with no region take, or no declared tolerance, keeps its reading. A
|
|
384
|
+
stamp that lacks only this field is refused as `ASSEMBLY_CONFIG_STALE`, and
|
|
385
|
+
the refusal says that the stamp predates the binding and asks for one
|
|
386
|
+
re-assemble with the same config. The reading reads only `config.requirements`.
|
|
387
|
+
|
|
388
|
+
`assemble` and `build` refuse a `--requirements` file that `config.requirements`
|
|
389
|
+
does not name whenever its content reaches assembly: the config has a region
|
|
390
|
+
take (`setup_painting.rgb_tolerance`), or under `ground: "busy"` with
|
|
391
|
+
`project: "visible"` the file declares `setup_painting.figure_mask`. With no
|
|
392
|
+
`config.requirements` the refusal is `ASSEMBLE_REQUIREMENTS_UNDECLARED`; a
|
|
393
|
+
declaration naming another file is `BUILD_REQUIREMENTS_CONFLICT`, whose detail
|
|
394
|
+
then names the field that reaches assembly. "Names" is the rule
|
|
395
|
+
`BUILD_REQUIREMENTS_CONFLICT` already holds: the same file once resolved (the
|
|
396
|
+
flag against the working directory, the declaration against the config's
|
|
397
|
+
directory), or a file of the same bytes. A `--requirements` file whose content
|
|
398
|
+
reaches no assembly input is accepted as before and moves no byte. Where a
|
|
399
|
+
region take or a busy-visible figure mask reads requirements, `assemble` reads
|
|
400
|
+
them as `build` does: from `config.requirements`, with `--requirements`
|
|
401
|
+
optional and, when given, naming the same file. "The same file" here and in
|
|
402
|
+
both refusals means the same resolved file, or a file with the same bytes. So
|
|
403
|
+
every requirements value that changes what assemble takes or masks is in the
|
|
404
|
+
reading. A flag-only `cut_material` still decides whether
|
|
405
|
+
`cut_material_sources.json` is written, and a flag-only `pinholes.required`
|
|
406
|
+
still decides a refusal; neither changes the parts or the stamp.
|
|
407
|
+
|
|
408
|
+
Release order for the tolerance binding: a reader on Parts 2.48.0 or earlier
|
|
409
|
+
refuses a stamp this release writes for a config with a region take and a
|
|
410
|
+
declared tolerance outside busy-visible, with a false `ASSEMBLY_CONFIG_STALE`
|
|
411
|
+
at `config.requirements.setup_painting.rgb_tolerance`. So release Parts, then
|
|
412
|
+
Review, then Create, before those consumers read such stamps.
|
|
413
|
+
|
|
414
|
+
A stamp that predates both later bindings is refused with one sentence naming
|
|
415
|
+
both: `the recorded stamp predates split-take donor metadata and region-take
|
|
416
|
+
setup_painting.rgb_tolerance bindings. Re-run assemble once with the same
|
|
417
|
+
config`.
|
|
418
|
+
|
|
378
419
|
The stable named subpath `@rig-c/parts/assembly-reading` exports
|
|
379
420
|
`assemblyConfigReading(configPath: string, parts: PartsFile): AssemblyConfigRecord`
|
|
380
421
|
and `assemblyConfigChanges(configPath: string, parts: PartsFile): string[]`.
|
|
@@ -1177,7 +1218,7 @@ remains a diagnostic and the bar uses the precedence below.
|
|
|
1177
1218
|
| `CUT_JOINT_MATERIAL` | Declared joint cut-material support and crossing evidence | `undeclared` |
|
|
1178
1219
|
| `SETUP_MATCHES_PAINTING` | Native-grid source vs rendered setup under authored regional mismatch limits | `undeclared`, `no-limit` (at least one region lacks a limit and none fail) |
|
|
1179
1220
|
| `BOUNDARY_COLOUR_STEP` | Authored allowance for excess colour step between parts in idle | `undeclared` |
|
|
1180
|
-
| `BEHIND_PART_SEAMS` | Authored thresholds for standing and motion-opened rear seam cells, including requested turn poses | `undeclared`, `no-complete-threshold-reading` (including no eligible pairs or an incomplete non-failing reading) |
|
|
1221
|
+
| `BEHIND_PART_SEAMS` | Authored thresholds for standing at setup and motion-opened rear seam cells, including `motion_opened` at requested turn poses | `undeclared`, `no-complete-threshold-reading` (including no eligible pairs or an incomplete non-failing reading) |
|
|
1181
1222
|
| `SEAM_OVER_MOTION` | Body-root gap plus under-owned ghost floor and required zero-background seam readings | `no-root-gate`, `no-animation`, `no-complete-root-reading` (root evidence unmeasured) |
|
|
1182
1223
|
|
|
1183
1224
|
| SEAM_OVER_MOTION precedence | Declared outcome |
|
|
@@ -1575,22 +1616,60 @@ default, and a pair without either a rig or pair T reports SKIP and a HOLE,
|
|
|
1575
1616
|
never PASS. Allowance is a nonnegative safe integer, defaulting to 0 by the
|
|
1576
1617
|
explicit design ruling, with optional per-pair override for both halves.
|
|
1577
1618
|
|
|
1578
|
-
Declared readings independently measure motion-opened rear visibility
|
|
1579
|
-
standing contrasting rear visibility
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
`
|
|
1587
|
-
|
|
1588
|
-
|
|
1619
|
+
Declared readings independently measure motion-opened rear visibility on every
|
|
1620
|
+
idle frame and standing contrasting rear visibility at setup (against the
|
|
1621
|
+
parts' flat recomposite at their painted positions, issue #1408) on core's
|
|
1622
|
+
official seam grid. There is no WARN mode, one-cell floor, rest mask or
|
|
1623
|
+
subtraction of setup-visible cells. At setup, `standing` compares the full setup
|
|
1624
|
+
render (`rasters.full`) with the parts' flat recomposite (`flatComposite` of
|
|
1625
|
+
`parts.json` and `parts/*.png` over white in `rig.json` slot order, rendered
|
|
1626
|
+
onto the pair's native seam grid), both flattened source-over white
|
|
1627
|
+
(`[255, 255, 255]`), by max-channel distance: a bracketed rear-visible cell is
|
|
1628
|
+
raw (`raw_px`) when `d[0] > 0`, `d[1] > 0` and `dRecomposite > 0`, and counts
|
|
1629
|
+
(`px`) when `d[0] > T`, `d[1] > T` and `dRecomposite > T` (a cell outside the
|
|
1630
|
+
recomposite's canvas has `dRecomposite = Infinity`). Setup standing catches a
|
|
1631
|
+
part that the rig places away from where it was painted; it does not measure
|
|
1632
|
+
fidelity to the `--source` painting (which is `SETUP_MATCHES_PAINTING`'s and the
|
|
1633
|
+
`RECOMPOSITE_HOLES` / `parts.json` `recomposite` record's job), and `--source`
|
|
1634
|
+
is not required for `behind_seams`. A recomposite whose size differs from the
|
|
1635
|
+
stage is refused by name and never resampled; and through `check` the loader
|
|
1636
|
+
refuses the same mismatch earlier, as `CHECK_RIG_STAGE_IS_THE_CANVAS`. On a
|
|
1637
|
+
corridor whose endpoint owner is ambiguous (`0` or `3`) at setup, cells within T
|
|
1638
|
+
of the recomposite (`dRecomposite <= T`) are left out of the unread population,
|
|
1639
|
+
without adding their endpoints to `boundary_cells` (`support`); elsewhere they
|
|
1640
|
+
stay geometric (`geometric_px` and `samples`) but cannot count. An ambiguous
|
|
1641
|
+
endpoint makes a corridor unread only when at least one of its cells differs
|
|
1642
|
+
from the recomposite by more than T (`dRecomposite > T`), and `allowance` never
|
|
1643
|
+
clears an unread cell. Without `--parts` (`parts.json` and `parts/*.png`), setup
|
|
1644
|
+
standing is `SKIP` with
|
|
1645
|
+
`reason: "no --parts manifest was supplied; setup standing compares the setup render with the parts' flat recomposite"`,
|
|
1646
|
+
adds a `setup` `unmeasured[]` row, and with an authored T emits
|
|
1647
|
+
`CHECK_BEHIND_PART_SEAMS_UNMEASURED`. On idle frames, `standing` is never
|
|
1648
|
+
measured: `frames[].standing` and `pairs[].standing` carry `status: "SKIP"` with
|
|
1649
|
+
`reason: "not applicable: motion_opened reads the pair"` when `motion_opened`
|
|
1650
|
+
reads that frame (or pair), or
|
|
1651
|
+
`reason: "idle standing is not measured: idle frames have no recomposite oracle, and the pair's idle reading is motion_opened"`
|
|
1652
|
+
when `motion_opened` cannot read that frame (or pair). `pairs[].standing` is
|
|
1653
|
+
the idle summary only; setup status is at `pairs[].setup.standing` (never folded
|
|
1654
|
+
into `pairs[].standing`), and `BehindSeamsStanding`, `BehindSeamsReading` and
|
|
1655
|
+
`BehindSeamsTurnPair['standing']` carry an optional `reason` string when
|
|
1656
|
+
`status` is `"SKIP"`. `BEHIND_PART_SEAMS`
|
|
1657
|
+
keeps `setup`, `motion_opened` and `standing` separate, names the selected pair
|
|
1658
|
+
and provenance, per-frame `behind_slots`, grid and sampled/read/unmeasured
|
|
1659
|
+
counts, and reports per-frame hits, worst counts, temporal spans and spatial
|
|
1660
|
+
runs. Exceeding the allowance uses `CHECK_BEHIND_PART_SEAMS`
|
|
1661
|
+
(`object: "pair \"<A>|<B>\" setup standing"` at setup); a mandatory unread
|
|
1662
|
+
population uses `CHECK_BEHIND_PART_SEAMS_UNMEASURED`. Missing behind slots,
|
|
1663
|
+
`--parts` manifest for setup standing's recomposite, idle, setup, motion
|
|
1664
|
+
support, boundary population or verified render evidence is a HOLE, not a zero
|
|
1665
|
+
PASS. Existing render/sidecar refusals remain refusals. The standing
|
|
1589
1666
|
bracketed-run definition does not certify curved or diagonal openings.
|
|
1590
1667
|
|
|
1591
1668
|
Per-cell samples are a bounded diagnostic sample; the counts are the
|
|
1592
|
-
measurement (issue #1403). Each `samples[]` list (standing
|
|
1593
|
-
|
|
1669
|
+
measurement (issue #1403). Each measured `samples[]` list (setup standing, idle
|
|
1670
|
+
`motion_opened` on every idle frame, and turn `motion_opened` on every turn
|
|
1671
|
+
pose; idle and turn `standing` are never measured and their `samples[]` are
|
|
1672
|
+
always `[]`) holds at most 64 rows.
|
|
1594
1673
|
A list that measured more holds 64 and gains `samples_omitted`, the number of
|
|
1595
1674
|
rows left out; a list of 64 or fewer has no such field and is written as before.
|
|
1596
1675
|
Standing keeps its 64 worst rows: counted first, then the larger of the two
|
|
@@ -1605,13 +1684,27 @@ this key no turn rows are written and existing `check.json` bytes are unchanged.
|
|
|
1605
1684
|
With it, `BEHIND_PART_SEAMS.turn` records named independent reset poses: each
|
|
1606
1685
|
dial's declared `from` and `max` with other dials at setup, then every full
|
|
1607
1686
|
min/max corner, deduplicated in that order. It records planned and observed dial locals and observed slider mapped times, per-pair
|
|
1608
|
-
`frames`, `sampled_poses`, `read_poses`, `unmeasured_poses`,
|
|
1609
|
-
|
|
1687
|
+
`frames`, `sampled_poses`, `read_poses`, `unmeasured_poses`, `motion_opened`
|
|
1688
|
+
status and maximum count, and the `standing` summary (`status: "SKIP"`,
|
|
1689
|
+
`reason`, `max_px: 0`). There are no temporal
|
|
1610
1690
|
spans: pose indices are sample identities, and time is 0 for every reset.
|
|
1611
1691
|
Turn uses its own setup, rest geometry and transported stock seam evidence;
|
|
1612
|
-
idle stock and idle counts are unchanged. The same thresholds, allowances
|
|
1613
|
-
rear-set
|
|
1614
|
-
|
|
1692
|
+
idle stock and idle counts are unchanged. The same thresholds, allowances and
|
|
1693
|
+
rear-set rules apply to `motion_opened` on turn poses. Because a turn pose is
|
|
1694
|
+
an independent `t=0` pose and the parts' flat recomposite is not transported to
|
|
1695
|
+
it, turn `standing` is never measured (issue #1412), mirroring idle: on each
|
|
1696
|
+
turn pose, `turn.pairs[].frames[].standing` carries `status: "SKIP"` with zero
|
|
1697
|
+
counts, `box: null`, `samples: []`, no `unread_cells` or `unread_corridors`, and
|
|
1698
|
+
its per-pose `reason` (`"not applicable: motion_opened reads the pair"` when
|
|
1699
|
+
`motion_opened` reads the pair on that pose, or
|
|
1700
|
+
`"turn standing is not measured: turn poses have no recomposite oracle, and the pair's turn reading is motion_opened"`
|
|
1701
|
+
when `motion_opened` cannot read the pair on that pose), and the pair summary
|
|
1702
|
+
`turn.pairs[].standing` is `{ status: "SKIP", reason, max_px: 0 }` (carrying the
|
|
1703
|
+
motion-read reason when `turn.pairs[].motion_opened.status !== "SKIP"`, or the
|
|
1704
|
+
turn no-oracle reason when it is `"SKIP"`). Where `motion_opened` cannot read
|
|
1705
|
+
the pair on a turn pose, its existing named `HOLE` in `turn.unmeasured[]` stays
|
|
1706
|
+
in place, and with an authored effective T emits
|
|
1707
|
+
`CHECK_BEHIND_PART_SEAMS_UNMEASURED`. No declared dial persists turn SKIP and a named HOLE;
|
|
1615
1708
|
an effective authored T makes that missing required reading a
|
|
1616
1709
|
`CHECK_BEHIND_PART_SEAMS_UNMEASURED` failure. Legacy `turn.x` has no declared
|
|
1617
1710
|
finite range and is explicitly unread, never given a guessed range. The
|
|
@@ -1630,18 +1723,18 @@ An unavailable poser or source is a HOLE. Other animations, between-sample turns
|
|
|
1630
1723
|
skins remain unmeasured.
|
|
1631
1724
|
|
|
1632
1725
|
Issue #1325 adds the following optional evidence fields to
|
|
1633
|
-
`BEHIND_PART_SEAMS.pairs[].setup.standing` and
|
|
1634
|
-
`
|
|
1635
|
-
relative to that standing record.
|
|
1726
|
+
`BEHIND_PART_SEAMS.pairs[].setup.standing` (idle `frames[].standing` and turn
|
|
1727
|
+
`turn.pairs[].frames[].standing` are never measured). Paths in
|
|
1728
|
+
the table are relative to that standing record.
|
|
1636
1729
|
|
|
1637
1730
|
| Field | Stable meaning |
|
|
1638
1731
|
| --- | --- |
|
|
1639
|
-
| `unread_cells` | Distinct native cells in this frame's unread corridors; cross-axis intersections count once. This is an unread population, not a contrast count. |
|
|
1640
|
-
| `unread_corridors` | Nonempty array of ambiguous-endpoint runs, horizontal rows before vertical columns, each in native scan order. |
|
|
1732
|
+
| `unread_cells` | Distinct native cells in this frame's unread corridors (at setup, leaving out cells within T of the parts' recomposite); cross-axis intersections count once. This is an unread population, not a contrast count. |
|
|
1733
|
+
| `unread_corridors` | Nonempty array of ambiguous-endpoint runs (at setup, those with at least one cell where `dRecomposite > T`), horizontal rows before vertical columns, each in native scan order. |
|
|
1641
1734
|
| `unread_corridors[].axis` | `horizontal` or `vertical`. |
|
|
1642
1735
|
| `unread_corridors[].endpoints` | Two `[grid_x, grid_y, world_x, world_y, owner]` tuples in left/right or top/bottom order. Grid indices are zero-based, x right and y down; world coordinates are cell centres, y up. Owner codes are 0 for neither A/B reaching half alpha, 1 for A only, 2 for B only and 3 for both; no owner is inferred. |
|
|
1643
|
-
| `unread_corridors[].cells` | Interior world-centre `[x, y]` tuples in run order, excluding endpoints.
|
|
1644
|
-
| `unread_corridors[].cell_count` |
|
|
1736
|
+
| `unread_corridors[].cells` | Interior world-centre `[x, y]` tuples in run order, excluding endpoints. On a corridor whose endpoint owner is ambiguous (`0` or `3`) at setup, cells within T of the parts' recomposite (`dRecomposite <= T`) are left out of the unread population; the remaining interior cells are reported without a rear-colour or endpoint-contrast filter; intersections may repeat across corridors. |
|
|
1737
|
+
| `unread_corridors[].cell_count` | The number of reported interior cells in that corridor (at setup, leaving out cells within T of the recomposite), exactly `cells.length`. |
|
|
1645
1738
|
| `unread_corridors[].row_scope` | `pair`. |
|
|
1646
1739
|
| `unread_corridors[].row_kind` | `evidence`. |
|
|
1647
1740
|
| `unread_corridors[].row_subjects` | The two selected part names in producer A/B order. |
|
|
@@ -1650,13 +1743,17 @@ Both fields are omitted when no ambiguous corridor is found, preserving the
|
|
|
1650
1743
|
bytes of fully read frames; no zero or empty-array placeholders are added.
|
|
1651
1744
|
`motion_opened` gains no field. Missing optional unread-corridor evidence does
|
|
1652
1745
|
not certify other unavailable readings or numeric colour underflow as read.
|
|
1653
|
-
A corridor with an ambiguous endpoint owner
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
evidence still makes the combined
|
|
1658
|
-
|
|
1659
|
-
|
|
1746
|
+
A corridor with an ambiguous endpoint owner (and, at setup, at least one cell
|
|
1747
|
+
with `dRecomposite > T`) remains unread without choosing an A/B owner. Readable
|
|
1748
|
+
corridors retain their measured cells: a standing count above allowance remains
|
|
1749
|
+
FAIL even with unread corridors, while unread corridors without a measured
|
|
1750
|
+
excess leave standing SKIP. Required unread evidence still makes the combined
|
|
1751
|
+
line FAIL. Idle `read_frames` counts idle frames where `motion_opened` is read,
|
|
1752
|
+
and turn `read_poses` counts turn poses where `motion_opened` is read (without
|
|
1753
|
+
a `turn.unmeasured[]` row for that pose; idle and turn `standing` are never
|
|
1754
|
+
measured); poses where `motion_opened` is unavailable remain in
|
|
1755
|
+
`unmeasured_poses`. Setup is reported separately at
|
|
1756
|
+
`pairs[].setup`.
|
|
1660
1757
|
A boundary-colour PASS does not prove seam closure. Without `behind_seams`,
|
|
1661
1758
|
existing configurations remain optional and their checks retain their behavior;
|
|
1662
1759
|
no behind-part PASS is claimed. See [Behind-part seams](AUTHORING.md#behind-part-seams-issue-1314).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rig-c/parts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.49.0",
|
|
4
4
|
"description": "AI-authored 2D character parts from one anime painting and its See-through layer decomposition: measured parts, weighted-mesh rig specs, verified through rig-c before anything is written. A CLI for agents that cannot see the image.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
package/src/assembly-reading.ts
CHANGED
|
@@ -108,6 +108,8 @@ interface ReadingContext extends ReturnType<typeof digestFiles>, Required<Assemb
|
|
|
108
108
|
limbs: unknown[];
|
|
109
109
|
hybridWidths: ReadonlyMap<string, Array<{ set: string | null; width?: number }>>;
|
|
110
110
|
setup: SetupPainting | undefined;
|
|
111
|
+
/** The declared tolerance a region take reads, when no setup_painting digest already holds it. */
|
|
112
|
+
regionTolerance: number | undefined;
|
|
111
113
|
setupImage: (declaration: SetupPainting['figure_mask'] | SetupPainting['backdrop'], field: string) => unknown;
|
|
112
114
|
authoredDepths: () => unknown;
|
|
113
115
|
}
|
|
@@ -147,10 +149,15 @@ function nonempty<T>(value: T[] | undefined): T[] | undefined {
|
|
|
147
149
|
return value?.length ? value : undefined;
|
|
148
150
|
}
|
|
149
151
|
|
|
152
|
+
/** The region take's colour limit, bound from `config.requirements` (#1393). */
|
|
153
|
+
export const REGION_TOLERANCE_FIELD = 'requirements.setup_painting.rgb_tolerance';
|
|
154
|
+
|
|
150
155
|
function projectionEntries(cfg: ProjectionSource) {
|
|
151
|
-
//
|
|
152
|
-
//
|
|
153
|
-
//
|
|
156
|
+
// Requirements values reach this config view only through config.requirements.
|
|
157
|
+
// assemble and build refuse a --requirements file the config does not name
|
|
158
|
+
// when its content reaches assembly (#1418), so nothing assembly reads is outside it.
|
|
159
|
+
// Only selected values can be exemptions in the projection, such as the
|
|
160
|
+
// editor receipt ledger below.
|
|
154
161
|
const a = cfg.assemble;
|
|
155
162
|
// These fields used to enter the digest through the enumerable assemble spread.
|
|
156
163
|
const authored = <K extends keyof typeof a>(key: K) => {
|
|
@@ -256,6 +263,7 @@ function projectionEntries(cfg: ProjectionSource) {
|
|
|
256
263
|
figure_mask: ctx.setupImage(ctx.setup.figure_mask, 'figure_mask'),
|
|
257
264
|
backdrop: ctx.setupImage(ctx.setup.backdrop, 'backdrop'),
|
|
258
265
|
},
|
|
266
|
+
[REGION_TOLERANCE_FIELD]: ctx => ctx.regionTolerance,
|
|
259
267
|
}),
|
|
260
268
|
scene: bound(cfg.scene === undefined ? undefined : true),
|
|
261
269
|
// Turn, meshes and regions reach existing carrier helpers as aggregates.
|
|
@@ -375,6 +383,12 @@ function readingContext(cfg: AssemblyView, parts: PartsFile, configPath: string,
|
|
|
375
383
|
const requirementsPath = ground === 'busy' && cfg.requirements !== undefined
|
|
376
384
|
? resolve(base, cfg.requirements) : undefined;
|
|
377
385
|
const setup = requirementsPath === undefined ? undefined : readRequirements(requirementsPath).setup_painting;
|
|
386
|
+
// A region take reads setup_painting.rgb_tolerance whatever the ground. The
|
|
387
|
+
// busy-visible setup_painting digest above already holds it; elsewhere it
|
|
388
|
+
// gets its own field, so no existing stamp moves where it was covered.
|
|
389
|
+
const regionTolerance = setup !== undefined || cfg.requirements === undefined ||
|
|
390
|
+
!(cfg.assemble.take ?? []).some(take => 'seed' in take)
|
|
391
|
+
? undefined : readRequirements(resolve(base, cfg.requirements)).setup_painting?.rgb_tolerance;
|
|
378
392
|
const setupImage = (declaration: SetupPainting['figure_mask'] | SetupPainting['backdrop'], field: string) =>
|
|
379
393
|
declaration === undefined ? undefined : {
|
|
380
394
|
...declaration,
|
|
@@ -422,7 +436,7 @@ function readingContext(cfg: AssemblyView, parts: PartsFile, configPath: string,
|
|
|
422
436
|
// Alternate skeleton and drawn registration also use the hierarchy.
|
|
423
437
|
const bones = posesAlternate ? cfg.bones : geometry.length === 0 ? undefined : geometry;
|
|
424
438
|
return {
|
|
425
|
-
...files, seam, project, ground, setup, setupImage, hasHeadRun,
|
|
439
|
+
...files, seam, project, ground, setup, regionTolerance, setupImage, hasHeadRun,
|
|
426
440
|
basePairs, physicsPairs, bones, limbs, hybridWidths,
|
|
427
441
|
authoredDepths: () => cfg.depth === undefined ? undefined
|
|
428
442
|
: [...authoredUnitDepths(cfg)].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0),
|
|
@@ -457,6 +471,12 @@ export function isSplitTakeMetadataField(name: string): boolean {
|
|
|
457
471
|
return /^assemble\.take\[(?:0|[1-9][0-9]*)\]\.meta$/.test(name);
|
|
458
472
|
}
|
|
459
473
|
|
|
474
|
+
/** Fields added to the reading after stamps were first written, in sentence order. */
|
|
475
|
+
const LATER_BINDINGS: ReadonlyArray<{ field: (name: string) => boolean; binding: string }> = [
|
|
476
|
+
{ field: isSplitTakeMetadataField, binding: 'split-take donor metadata' },
|
|
477
|
+
{ field: name => name === REGION_TOLERANCE_FIELD, binding: 'region-take setup_painting.rgb_tolerance' },
|
|
478
|
+
];
|
|
479
|
+
|
|
460
480
|
export function assemblyConfigReading(configPath: string, parts: PartsFile): AssemblyConfigRecord {
|
|
461
481
|
return readAssemblyConfig(loadEarlyConfig(configPath, 'assemble'), parts, configPath);
|
|
462
482
|
}
|
|
@@ -484,10 +504,16 @@ export function refuseStaleAssembly(configPath: string, parts: PartsFile, loaded
|
|
|
484
504
|
const current = readAssemblyConfig(cfg, parts, configPath, overrides);
|
|
485
505
|
const changes = changedAssemblyFields(previous, current);
|
|
486
506
|
if (changes.length === 0) return;
|
|
487
|
-
const
|
|
488
|
-
const predatesSplitMetadata = changes.every(name => isSplitTakeMetadataField(name) && !recorded.has(name));
|
|
489
|
-
const detail = predatesSplitMetadata
|
|
490
|
-
? `assembly reading changed at ${changes.map(name => `config.${name}`).join(', ')}; the recorded stamp predates split-take donor metadata binding. Re-run assemble once with the same config`
|
|
491
|
-
: assemblyChangeDetail(changes);
|
|
507
|
+
const detail = staleAssemblyDetail(changes, new Set(previous.fields.map(({ name }) => name)));
|
|
492
508
|
throw new PartsError([{ code: 'ASSEMBLY_CONFIG_STALE', object: configPath, detail }]);
|
|
493
509
|
}
|
|
510
|
+
|
|
511
|
+
/** The stale refusal's detail for `changes` against a stamp recording `recorded`; a stamp that lacks only later bindings is told so. */
|
|
512
|
+
export function staleAssemblyDetail(changes: readonly string[], recorded: ReadonlySet<string>): string {
|
|
513
|
+
// A field a newer binding adds, absent from the stamp, means the stamp predates that binding.
|
|
514
|
+
const predated = changes.map(name => recorded.has(name) ? undefined : LATER_BINDINGS.find(later => later.field(name)));
|
|
515
|
+
const bindings = LATER_BINDINGS.filter(later => predated.includes(later)).map(later => later.binding);
|
|
516
|
+
return predated.every(later => later !== undefined)
|
|
517
|
+
? `assembly reading changed at ${changes.map(name => `config.${name}`).join(', ')}; the recorded stamp predates ${bindings.join(' and ')} binding${bindings.length > 1 ? 's' : ''}. Re-run assemble once with the same config`
|
|
518
|
+
: assemblyChangeDetail(changes);
|
|
519
|
+
}
|