@rig-c/parts 2.49.0 → 2.49.1
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 +1 -1
- package/docs/AUTHORING.md +21 -1
- package/docs/STABILITY.md +6 -1
- package/package.json +1 -1
- package/src/build.ts +27 -14
- package/src/check.ts +4 -4
- package/src/setuppainting.ts +44 -1
package/cli.ts
CHANGED
|
@@ -2067,7 +2067,7 @@ function cmdAssemble(args: string[]): number {
|
|
|
2067
2067
|
const cfg = loadEarlyConfig(config, 'assemble', project as ProjectRule | undefined);
|
|
2068
2068
|
if ((cfg.assemble.cuts ?? []).length === 0) return usage('assemble --emit-fill-masks requires at least one entry in config.assemble.cuts');
|
|
2069
2069
|
emitFillMasksStage(
|
|
2070
|
-
{ source, full, head, config, outDir: flags.get('--emit-fill-masks') as string, ...(seam === undefined ? {} : { seam: seam as SeamRule }), ...(project === undefined ? {} : { project: project as ProjectRule }) },
|
|
2070
|
+
{ source, full, head, config, outDir: flags.get('--emit-fill-masks') as string, ...(flags.has('--requirements') ? { requirements: flags.get('--requirements') as string } : {}), ...(seam === undefined ? {} : { seam: seam as SeamRule }), ...(project === undefined ? {} : { project: project as ProjectRule }) },
|
|
2071
2071
|
console.log,
|
|
2072
2072
|
);
|
|
2073
2073
|
return EXIT_OK;
|
package/docs/AUTHORING.md
CHANGED
|
@@ -5343,7 +5343,7 @@ continues under that scarf end at all is the author's call: continued as a line
|
|
|
5343
5343
|
its edge just above the polygon (x 306) to its edge at its hem (x 316, row 681), its
|
|
5344
5344
|
outline lies right of every removed pixel, and an image of only that silhouette fills
|
|
5345
5345
|
none of the 15,070 — `ASSEMBLE_UNDER_EMPTY` [observed]. Producing a hand-supplied PNG is the
|
|
5346
|
-
author's; for a receipted plate route (issue #1230), run in order: (1) `rig-parts assemble --source <painting.png> --full <dir> [--head <dir>] --config <config.json> --emit-fill-masks <masks-dir>` to write `<masks-dir>/<into>.png` on the painting's grid (`[255, 255, 255, 255]` where `(polygon ∩ from alpha > 0)`, overlap band included, and `[0, 0, 0, 0]` elsewhere); (2) `rig-parts comfy plate --mode occluder --painting <painting.png> --occluder <masks-dir>/<into>.png --out <plate-dir>`; and (3) set `"under": {"plate": "<plate-dir>"}` on `assemble.cuts[i]` and re-run `rig-parts assemble` (or `build`).
|
|
5346
|
+
author's; for a receipted plate route (issue #1230), run in order: (1) `rig-parts assemble --source <painting.png> --full <dir> [--head <dir>] --config <config.json> [--requirements <file.json>] --emit-fill-masks <masks-dir>` to write `<masks-dir>/<into>.png` on the painting's grid (`[255, 255, 255, 255]` where `(polygon ∩ from alpha > 0)`, overlap band included, and `[0, 0, 0, 0]` elsewhere; where a region take or a busy-visible figure mask reads requirements, `--emit-fill-masks` reads `config.requirements` and optional `--requirements` by the same rule as `--out`); (2) `rig-parts comfy plate --mode occluder --painting <painting.png> --occluder <masks-dir>/<into>.png --out <plate-dir>`; and (3) set `"under": {"plate": "<plate-dir>"}` on `assemble.cuts[i]` and re-run `rig-parts assemble` (or `build`).
|
|
5347
5347
|
|
|
5348
5348
|
**Splitting a horizontal hem between two plan layers (`assemble.edge_splits`, issue #1231).** `assemble.edge_splits` (`[{ "over": "<part>", "under": "<part>", "band": [x0, y0, x1, y1] }, ...]`) takes `assemble.plan` part names only (`over !== under`), so a part made by `assemble.cuts` is refused with `CONFIG_NAME_RESOLVES`. Its effect is a horizontal hem split between two plan layers on the rig grid inside `band` (`x0 < x1`, `y0 < y1`, upper bounds exclusive; `ASSEMBLE_PAINTING_BAND_INSIDE` when the box reaches outside the rig canvas), applied after ghost clean-up and rig-space resampling and before projection: per column `x` in `x0 .. x1 - 1`, `y*` is the first row in `y0 .. y1 - 1` (with `y + 1 < H`) with the largest vertical painting RGB step `max(|R(x,y) - R(x,y+1)|, |G(x,y) - G(x,y+1)|, |B(x,y) - B(x,y+1)|)` among rows where `over` has `alpha >= 128` (`EDGE_SPLIT_OVER_ALPHA`; columns with no such row are skipped), and for every row strictly below `y*` inside `band` (`y* + 1 .. y1 - 1`), where `over` has `alpha >= 128`, `over` is cleared to `[0, 0, 0, 0]` and `under` takes the painting's RGB there with `alpha = 255`, and where `over` has `0 < alpha < 128`, `over` is cleared to `[0, 0, 0, 0]`. It transfers static plan-layer ownership along a painted horizontal hem; it does not close a `cuts` seam that opens in motion.
|
|
5349
5349
|
|
|
@@ -6414,6 +6414,7 @@ outside the consumed inputs pending [#1177](https://github.com/rig-c/parts/issue
|
|
|
6414
6414
|
| <a id="CHECK_BEHIND_PART_SEAMS"></a>`CHECK_BEHIND_PART_SEAMS` | `behind_seams` is declared and a selected pair exceeds its allowance in the independent `motion_opened` reading on an idle frame, in the `standing` reading at setup (compared against the parts' flat recomposite at their painted positions), or in the `motion_opened` reading at an opted-in named turn pose (idle and turn `standing` are not measured); the pair, behind slots, reading, frame, counted seam cells and allowance are named | repair the declared seam in `parts/<part>.png` or `config.json` (`regions`, `meshes`, or `bones`), or author its allowance in `requirements.json` (`behind_seams.allowance` or `behind_seams.pairs[].allowance`); no WARN mode or rest-visible mask; see [Behind-part seams](#behind-part-seams-issue-1314) |
|
|
6415
6415
|
| <a id="CHECK_BEHIND_PART_SEAMS_UNMEASURED"></a>`CHECK_BEHIND_PART_SEAMS_UNMEASURED` | a pair with an authored effective threshold cannot read a mandatory population: selected pair, eligible behind slots, `--parts` manifest (`parts.json` and `parts/*.png`) for setup standing's flat recomposite, idle, readable setup, motion support, boundary population, or verified render/grid/material evidence; mandatory unread evidence makes the combined line FAIL. A missing threshold alone is a nonrequired SKIP and HOLE without this refusal code | for the detail `no --parts manifest was supplied; setup standing compares the setup render with the parts' flat recomposite`, supply `parts.json` and `parts/<part>.png` (or pass `--parts <dir>` on the `rig-parts check` command line). For the detail `standing endpoints include ambiguous half-alpha owners` (measured at setup only), the line names the case and, for each case, the first endpoint in scan order with both members' alpha: *neither* member reaches 128/255 there (both members' soft edges paint the same cell, each below 128/255) or *both* do (the members' overlap reaches the gap's edge). Edit `parts/<part>.png` of one member, or its source layer, so that exactly one member reaches 128/255 at that endpoint and the other is below it or does not paint it; the corridor is then read and may fail [`CHECK_BEHIND_PART_SEAMS`](#CHECK_BEHIND_PART_SEAMS) on a real gap. A threshold at or above the cell's distance to the recomposite removes the cell from the reading altogether; the threshold decides what could count; it does not clear a cell that could. `requirements.json` `behind_seams.allowance` never clears an unread cell; removing `behind_seams.threshold` (or `behind_seams.pairs[].threshold`), or the pair from `behind_seams.pairs[]` in `requirements.json`, only silences the reading (issues #1405, #1408). When a turn pose (or idle frame) reads the `motion_opened` `HOLE` (`stock transported setup-overlap support is unavailable on every named turn pose; motion-opened is not measured`, or `stock transported setup-overlap support is unavailable on every idle frame; motion-opened is not measured`, or `both named front slots must draw on this frame`, or `no eligible slot is drawn strictly behind both pair members (including every fragment)`), give the pair's two front members a setup overlap band in `parts/<part>.png` or `config.json` (`regions`, `meshes`, or `bones`) and ensure both members and at least one rear slot in `behind_slots` draw in consistent order at setup and on every turn pose (or idle frame) so `motion_opened` can transport setup-overlap cells, or — when the pair is not a turn-tracked overlap seam — omit `behind_seams.turn` (or the pair's threshold in `requirements.json` `behind_seams`; issue #1412). For any other detail, supply the named measurement evidence in `parts/<part>.png`, `config.json` or `requirements.json` `behind_seams`; an invalid selected-pair override in `requirements.json` `behind_seams.pairs[]` also refuses by name, and existing renderer or sidecar refusals remain refusals |
|
|
6416
6416
|
| <a id="SETUP_PAINTING_REQUIRED_LIMIT"></a>`SETUP_PAINTING_REQUIRED_LIMIT` | `setup_painting.required` is `true` and a limit the check needs is absent: `rgb_tolerance`, `regions`, or a region's `max_pixels` (the object names the region). Refused when the requirements file is read, before anything is built (issue #943) | author the named limit; none is derived from the art. Without `required` the same region reports SKIP |
|
|
6417
|
+
| <a id="SETUP_PAINTING_MOSTLY_UNCOVERED"></a>`SETUP_PAINTING_MOSTLY_UNCOVERED` | WARN only, never a refusal and never a bar (issue #1421): with neither `setup_painting.figure_mask` nor `setup_painting.backdrop` declared, more than half of a region's counted pixels are uncovered (`2 × uncovered > counted`, read off the region's `(uncovered)` slot row and its `pixel_count`; exactly half, or a region that counts nothing, does not warn). The line names the region and both figures. Without either declaration the count cannot tell painted background from missing figure, so on a scene painting the region's limit mostly measures background the rig does not draw | declare `setup_painting.figure_mask` (a figure-only rig on a scene painting) or `setup_painting.backdrop` (a full-frame painting over an opaque plate) to make the limit bind the figure; the verdict, `problems` and `check.json` do not change, and the summary line names the warning |
|
|
6417
6418
|
| <a id="CHECK_SOURCE_GRID"></a>`CHECK_SOURCE_GRID` | the setup-pose still and its black-tinted twin (the coverage `SETUP_POSE_VS_SOURCE` reads) did not come back on one grid over one opaque background | a rigc problem; report it |
|
|
6418
6419
|
| <a id="CHECK_RIGC_VERSION"></a>`CHECK_RIGC_VERSION` | `rigc --version` is below 1.4.0, or prints no version: its `render` has no `--geometry`, which `TEXTURE_STRETCH` reads. Refused before anything is built | `bun install` (this package depends on rig-c ^2.20.4), or put a newer `rigc` first on `PATH` |
|
|
6419
6420
|
| <a id="CHECK_RIGC_ENTRY"></a><a id="CHECK_RIGC_ENTRY_READS"></a>`CHECK_RIGC_ENTRY`, `CHECK_RIGC_ENTRY_READS` | `rigc --version` names no entry (a rigc below 2.0.0), or names one in neither launcher form (`entry: cli.ts — @esotericsoftware/spine-core <v> present`, `entry: cli_core.ts — @esotericsoftware/spine-core absent — …`); `check.json`'s `rigc_entry` records the one that gated the build | `bun install` |
|
|
@@ -8020,6 +8021,25 @@ value. The region passes when its total count is at most its authored
|
|
|
8020
8021
|
nonnegative integer `max_pixels`. Without that limit the region reports
|
|
8021
8022
|
**SKIP**, including a zero-count region. An undeclared region has no verdict.
|
|
8022
8023
|
|
|
8024
|
+
A region counts the figure domain described below, owned and uncovered alike:
|
|
8025
|
+
its `(uncovered)` slot row is the counted pixels no setup piece draws. Without
|
|
8026
|
+
`figure_mask` or `backdrop` that row cannot tell painted background from
|
|
8027
|
+
missing figure, so on a scene painting (a painted background behind a
|
|
8028
|
+
figure-only rig) a limit taken from a build's `pixel_count` can mostly measure
|
|
8029
|
+
background, and a figure that moves or loses pixels inside the region still
|
|
8030
|
+
passes. When more than half of a region's counted pixels are uncovered
|
|
8031
|
+
(`2 × uncovered > counted`; exactly half, or no counted pixel, does not warn),
|
|
8032
|
+
`check` prints
|
|
8033
|
+
[`SETUP_PAINTING_MOSTLY_UNCOVERED`](#SETUP_PAINTING_MOSTLY_UNCOVERED) under the
|
|
8034
|
+
region, with both figures, and names it in the summary line. Declare
|
|
8035
|
+
`figure_mask` or `backdrop` to make the limit bind the figure. The warning is
|
|
8036
|
+
not a bar: the verdict, the problems and `check.json` are unchanged, and both
|
|
8037
|
+
figures are already there (`regions[].pixel_count` and the `(uncovered)` row of
|
|
8038
|
+
`regions[].slots`). With either declaration the warning is not read: a figure
|
|
8039
|
+
mask counts mask pixels only, and a backdrop leaves out painting within
|
|
8040
|
+
`rgb_tolerance` of the plate, so an uncovered pixel there is missing figure
|
|
8041
|
+
(or a plate that does not match the painting), which is what the limit reads.
|
|
8042
|
+
|
|
8023
8043
|
An author for whom a SKIP here is not an acceptable outcome declares it:
|
|
8024
8044
|
`"required": true` inside `setup_painting` (issue #943). The field states the
|
|
8025
8045
|
requirement, not a kind of rig. With it, every limit must be authored: an
|
package/docs/STABILITY.md
CHANGED
|
@@ -1539,7 +1539,12 @@ Busy-ground visible assembly validates config.requirements and its flag correspo
|
|
|
1539
1539
|
The optional `setup_painting` key in `spine-parts-requirements/1` adds a
|
|
1540
1540
|
`SETUP_MATCHES_PAINTING` measurement when declared. It requires authored
|
|
1541
1541
|
`rgb_tolerance` and named native-stage boxes. Each optional `max_pixels` is
|
|
1542
|
-
that whole region's limit; omission is SKIP, never PASS.
|
|
1542
|
+
that whole region's limit; omission is SKIP, never PASS. With neither
|
|
1543
|
+
`figure_mask` nor `backdrop` declared, a region whose `(uncovered)` slot row is
|
|
1544
|
+
more than half its `pixel_count` adds one console line,
|
|
1545
|
+
`SETUP_PAINTING_MOSTLY_UNCOVERED` (issue #1421, a warning and not a bar), and
|
|
1546
|
+
the summary line names it; no exit code, problem or `check.json` byte moves.
|
|
1547
|
+
The optional boolean
|
|
1543
1548
|
`setup_painting.required` (issue #943, additive) is the author's declaration
|
|
1544
1549
|
that the check may not SKIP: with `true`, an absent `rgb_tolerance`, `regions`
|
|
1545
1550
|
or region `max_pixels` is refused by name as `SETUP_PAINTING_REQUIRED_LIMIT`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rig-c/parts",
|
|
3
|
-
"version": "2.49.
|
|
3
|
+
"version": "2.49.1",
|
|
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/build.ts
CHANGED
|
@@ -382,6 +382,7 @@ function verifyUnderPlateMasks(
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
export interface EmitFillMasksInput {
|
|
385
|
+
requirements?: string;
|
|
385
386
|
source: string;
|
|
386
387
|
full: string;
|
|
387
388
|
head: string | null;
|
|
@@ -391,15 +392,39 @@ export interface EmitFillMasksInput {
|
|
|
391
392
|
project?: ProjectRule;
|
|
392
393
|
}
|
|
393
394
|
|
|
395
|
+
function resolveAssemblyRequirements(
|
|
396
|
+
input: { requirements?: string; config: string },
|
|
397
|
+
cfg: Pick<ReturnType<typeof loadEarlyConfig>, 'requirements' | 'assemble'>,
|
|
398
|
+
project: ProjectRule,
|
|
399
|
+
requirementsFile: ReturnType<typeof readRequirements> | null = input.requirements === undefined ? null : readRequirements(input.requirements),
|
|
400
|
+
): { requirements: BuildRequirements | null; effectiveSetup: ReturnType<typeof readRequirements>['setup_painting'] } {
|
|
401
|
+
const busyVisible = cfg.assemble.ground === 'busy' && project === 'visible';
|
|
402
|
+
const regionTake = (cfg.assemble.take ?? []).some(take => 'seed' in take);
|
|
403
|
+
// Issue #1418: a requirements file whose content reaches assembly must be the one config.requirements names,
|
|
404
|
+
// because assembly_config reads only config.requirements.
|
|
405
|
+
refuseUnnamedAssemblyRequirements(input.requirements, cfg.requirements, input.config, [
|
|
406
|
+
...(regionTake ? ['setup_painting.rgb_tolerance (a region take)'] : []),
|
|
407
|
+
...(busyVisible && requirementsFile?.setup_painting?.figure_mask !== undefined ? ['setup_painting.figure_mask (busy-visible)'] : []),
|
|
408
|
+
]);
|
|
409
|
+
// Where requirements reach assembly, assemble reads them as build does: config.requirements, or the flag when the
|
|
410
|
+
// config declares none, the two being one file when both are given (buildRequirements). Elsewhere nothing here reads them.
|
|
411
|
+
const requirements = busyVisible || regionTake
|
|
412
|
+
? buildRequirements(input.requirements, cfg.requirements, input.config) : null;
|
|
413
|
+
const effectiveSetup = requirements === null ? undefined : readRequirements(requirements.read).setup_painting;
|
|
414
|
+
return { requirements, effectiveSetup };
|
|
415
|
+
}
|
|
416
|
+
|
|
394
417
|
export function emitFillMasksStage(input: EmitFillMasksInput, log: Log): Array<{ into: string; path: string; sha256: string; opaquePx: number }> {
|
|
418
|
+
const requirementsFile = input.requirements === undefined ? null : readRequirements(input.requirements);
|
|
395
419
|
const cfg = loadEarlyConfig(input.config, 'assemble', input.project);
|
|
396
420
|
const { seam, project } = effectiveAssemblyRules(cfg.assemble, input);
|
|
421
|
+
const { requirements, effectiveSetup } = resolveAssemblyRequirements(input, cfg, project, requirementsFile);
|
|
397
422
|
const src = readSource(input.source);
|
|
398
423
|
const read = readRuns(input.full, input.head);
|
|
399
424
|
const takenRuns = applyTakenLayers(read, src, cfg, input.config);
|
|
400
425
|
const receipts = readEditorReceipts(cfg.assemble.editor_receipts, input.config);
|
|
401
426
|
const editedParts = readEditedParts(cfg.assemble.edited_parts, input.config, cfg.assemble.plan ?? []);
|
|
402
|
-
const runs = applyTakenRegions(takenRuns, src, cfg, input.config,
|
|
427
|
+
const runs = applyTakenRegions(takenRuns, src, cfg, input.config, effectiveSetup, receipts, input.source, requirements?.read);
|
|
403
428
|
const fields = stageFields(cfg, runs.single ? { w: src.width, h: src.height } : null);
|
|
404
429
|
const strippedCuts = fields.cuts.map((q) => ({ from: q.from, into: q.into, polygon: q.polygon, draw: q.draw, overlap: q.overlap }));
|
|
405
430
|
const caps = fields.limbs === undefined ? undefined : readCaps(input.config, fields.limbs);
|
|
@@ -517,19 +542,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
517
542
|
const cfg = { ...projection.config, seethrough: projection.config.seethrough! };
|
|
518
543
|
const supportDeclarations = JSON.stringify(cfg.assemble.cuts ?? []);
|
|
519
544
|
const { seam, project } = effectiveAssemblyRules(cfg.assemble, input);
|
|
520
|
-
const
|
|
521
|
-
const regionTake = (cfg.assemble.take ?? []).some(take => 'seed' in take);
|
|
522
|
-
// Issue #1418: a requirements file whose content reaches assembly must be the one config.requirements names,
|
|
523
|
-
// because assembly_config reads only config.requirements.
|
|
524
|
-
refuseUnnamedAssemblyRequirements(input.requirements, cfg.requirements, input.config, [
|
|
525
|
-
...(regionTake ? ['setup_painting.rgb_tolerance (a region take)'] : []),
|
|
526
|
-
...(busyVisible && requirementsFile?.setup_painting?.figure_mask !== undefined ? ['setup_painting.figure_mask (busy-visible)'] : []),
|
|
527
|
-
]);
|
|
528
|
-
// Where requirements reach assembly, assemble reads them as build does: config.requirements, or the flag when the
|
|
529
|
-
// config declares none, the two being one file when both are given (buildRequirements). Elsewhere nothing here reads them.
|
|
530
|
-
const requirements = busyVisible || regionTake
|
|
531
|
-
? buildRequirements(input.requirements, cfg.requirements, input.config) : null;
|
|
532
|
-
const effectiveSetup = requirements === null ? undefined : readRequirements(requirements.read).setup_painting;
|
|
545
|
+
const { requirements, effectiveSetup } = resolveAssemblyRequirements(input, cfg, project, requirementsFile);
|
|
533
546
|
const src = readSource(input.source);
|
|
534
547
|
const read = readRuns(input.full, input.head);
|
|
535
548
|
// Issue #946: every declared receipt is held to its file, and under `required` every edited image needs one, before anything is assembled.
|
package/src/check.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { readSetupFigureMask } from './setupfiguremask.ts';
|
|
|
4
4
|
import { readSetupBackdrop } from './setupbackdrop.ts';
|
|
5
5
|
import { COINCIDE_LINE, type SupportReport } from './coincide.ts';
|
|
6
6
|
import { observeSupport } from './coincideio.ts';
|
|
7
|
-
import { SETUP_PAINTING_LINE, UNDECLARED_SETUP_PAINTING_REASON, setupPaintingBounds, setupPaintingLine, type SetupPainting, type SetupPaintingLine, type SetupPaintingObservation } from './setuppainting.ts';
|
|
7
|
+
import { SETUP_PAINTING_LINE, SETUP_PAINTING_UNCOVERED_WARNING, UNDECLARED_SETUP_PAINTING_REASON, setupPaintingBounds, setupPaintingLine, setupPaintingWarningCount, type SetupPainting, type SetupPaintingLine, type SetupPaintingObservation } from './setuppainting.ts';
|
|
8
8
|
import { readMaterialSources } from './cutmaterialio.ts';
|
|
9
9
|
import { CUT_MATERIAL_LINE, checkJointMaterial, type MaterialLine } from './cutmaterial.ts';
|
|
10
10
|
import { ART_JOINT_LINE, artJointLine, type ArtJointLine } from './artjoints.ts';
|
|
@@ -3289,9 +3289,9 @@ export function barsSummary(r: Pick<CheckReport, 'bars'>): string {
|
|
|
3289
3289
|
return `${measured.length} of ${measured.length + skipped.length} bar(s) measured, ${skipped.length} skipped${skipped.length === 0 ? '' : ` (${skipped.map((s) => s.bar).join(', ')})`}`;
|
|
3290
3290
|
}
|
|
3291
3291
|
|
|
3292
|
-
/** The summary's warning clause: each warning line that read something, named, with the warnings they printed together; empty when none read. */
|
|
3293
|
-
export function warningsClause(r: Pick<CheckReport, 'motionSeam' | 'cloth'>): string {
|
|
3294
|
-
const read = [...(r.motionSeam.status === 'SKIP' || (r.motionSeam.roots !== undefined && r.motionSeam.pairs.every(p => p.root !== undefined)) ? [] : [{ name: MOTION_SEAM_LINE, n: r.motionSeam.warnings }]), ...(r.cloth.status === 'SKIP' ? [] : [{ name: CLOTH_LINE, n: r.cloth.warnings }])];
|
|
3292
|
+
/** The summary's warning clause: each warning line that read something, named, with the warnings they printed together, and `SETUP_PAINTING_MOSTLY_UNCOVERED` only when it printed one (issue #1421); empty when none read. */
|
|
3293
|
+
export function warningsClause(r: Pick<CheckReport, 'motionSeam' | 'cloth' | 'figures'>): string {
|
|
3294
|
+
const read = [...(r.motionSeam.status === 'SKIP' || (r.motionSeam.roots !== undefined && r.motionSeam.pairs.every(p => p.root !== undefined)) ? [] : [{ name: MOTION_SEAM_LINE, n: r.motionSeam.warnings }]), ...(r.cloth.status === 'SKIP' ? [] : [{ name: CLOTH_LINE, n: r.cloth.warnings }]), ...(setupPaintingWarningCount(r.figures[SETUP_PAINTING_LINE]) === 0 ? [] : [{ name: SETUP_PAINTING_UNCOVERED_WARNING, n: setupPaintingWarningCount(r.figures[SETUP_PAINTING_LINE]) }])];
|
|
3295
3295
|
if (read.length === 0) return '';
|
|
3296
3296
|
return `; ${read.reduce((a, x) => a + x.n, 0)} warning(s) (${read.map((x) => x.name).join(', ')}, not a bar)`;
|
|
3297
3297
|
}
|
package/src/setuppainting.ts
CHANGED
|
@@ -184,13 +184,56 @@ export function setupPaintingLine(
|
|
|
184
184
|
...(noLimit ? { reason: 'a region has no declared max_pixels; it is measured as SKIP, never PASS' } : {}) };
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
/** Issue #1421: the named warning for a region whose count is mostly pixels no setup piece draws. A warning, never a bar. */
|
|
188
|
+
export const SETUP_PAINTING_UNCOVERED_WARNING = 'SETUP_PAINTING_MOSTLY_UNCOVERED';
|
|
189
|
+
export interface SetupPaintingUncovered {
|
|
190
|
+
region: string;
|
|
191
|
+
/** The region's `(uncovered)` slot row: counted pixels no setup piece draws (0 when the row is absent). */
|
|
192
|
+
uncovered: number;
|
|
193
|
+
/** The region's `pixel_count`: every counted pixel, owned or uncovered. */
|
|
194
|
+
counted: number;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Issue #1421: the regions whose counted pixels are mostly uncovered, read off
|
|
199
|
+
* the line alone, so every figure it names is already in check.json
|
|
200
|
+
* (`regions[].pixel_count` and the `(uncovered)` row of `regions[].slots`).
|
|
201
|
+
* "Mostly" is a strict majority, `2 * uncovered > counted`: exactly half does
|
|
202
|
+
* not warn, and a region that counts no pixel does not warn. It applies only
|
|
203
|
+
* when neither `figure_mask` nor `backdrop` is declared. With a figure mask a
|
|
204
|
+
* region counts mask pixels only, so its uncovered pixels are missing figure;
|
|
205
|
+
* with a backdrop a painted background within `rgb_tolerance` of the plate is
|
|
206
|
+
* not counted, so its uncovered pixels are painting that differs from the
|
|
207
|
+
* plate. Without either the count cannot tell painted background from missing
|
|
208
|
+
* figure, and that is what the warning says. The verdict never reads it.
|
|
209
|
+
*/
|
|
210
|
+
export function setupPaintingUncovered(line: SetupPaintingLine): SetupPaintingUncovered[] {
|
|
211
|
+
if (line.figure_mask !== undefined || line.backdrop !== undefined) return [];
|
|
212
|
+
return line.regions.flatMap(r => {
|
|
213
|
+
const uncovered = r.slots.find(s => s.slot === '(uncovered)')?.pixel_count ?? 0;
|
|
214
|
+
return 2 * uncovered > r.pixel_count ? [{ region: r.name, uncovered, counted: r.pixel_count }] : [];
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** How many regions {@link setupPaintingUncovered} warns about; 0 for an observation without regions. */
|
|
219
|
+
export function setupPaintingWarningCount(line: SetupPaintingObservation | undefined): number {
|
|
220
|
+
return line === undefined || !('regions' in line) ? 0 : setupPaintingUncovered(line).length;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** The console line for one {@link SetupPaintingUncovered}: the rule, the region, uncovered of counted, and the two declarations that make the limit bind the figure. */
|
|
224
|
+
export function setupPaintingUncoveredText(w: SetupPaintingUncovered): string {
|
|
225
|
+
return `${SETUP_PAINTING_LINE}: WARN ${SETUP_PAINTING_UNCOVERED_WARNING} region "${w.region}" — ${w.uncovered} of ${w.counted} counted pixels are uncovered (no setup piece draws them), more than half; without a figure mask or a backdrop this count cannot tell painted background from missing figure, so the region's limit mostly measures pixels the rig does not draw. To make it bind the figure, declare setup_painting.figure_mask (the figure's support on the painting grid) or setup_painting.backdrop (the opaque plate behind the figure); a warning, not a bar`;
|
|
226
|
+
}
|
|
227
|
+
|
|
187
228
|
export function setupPaintingLines(line: SetupPaintingObservation): string[] {
|
|
188
229
|
if (!('regions' in line)) return [`${SETUP_PAINTING_LINE}: SKIP — ${line.reason}`];
|
|
230
|
+
const warned = setupPaintingUncovered(line);
|
|
189
231
|
return [`${SETUP_PAINTING_LINE}: ${line.status}${line.reason === undefined ? '' : ` — ${line.reason}`}; ${line.registration}; ${line.compositing}`,
|
|
190
232
|
...(line.outside_figure === undefined ? [] : [`${SETUP_PAINTING_LINE}: slot "(uncovered)" outside figure mask — pixelcount ${line.outside_figure.pixel_count}; UNBARRED, outside every region limit`]),
|
|
191
233
|
...(line.outside_figure_owned === undefined ? [] : [`${SETUP_PAINTING_LINE}: owned pixels outside figure mask — pixelcount ${line.outside_figure_owned.pixel_count}; UNBARRED, outside every region limit`]),
|
|
192
234
|
...line.regions.flatMap(r => [`${SETUP_PAINTING_LINE}: region "${r.name}" ${r.status} — box [${r.box.join(', ')}], pixelcount ${r.pixel_count}, limit ${r.limit ?? 'undeclared (SKIP)'}, RGB tolerance ${line.rgb_tolerance}`,
|
|
193
|
-
...r.slots.map(s => `${SETUP_PAINTING_LINE}: slot "${s.slot}" region "${r.name}" — box [${s.box.join(', ')}], pixelcount ${s.pixel_count}; region total ${r.pixel_count}, limit ${r.limit ?? 'undeclared (SKIP)'}`)
|
|
235
|
+
...r.slots.map(s => `${SETUP_PAINTING_LINE}: slot "${s.slot}" region "${r.name}" — box [${s.box.join(', ')}], pixelcount ${s.pixel_count}; region total ${r.pixel_count}, limit ${r.limit ?? 'undeclared (SKIP)'}`),
|
|
236
|
+
...warned.filter(w => w.region === r.name).map(setupPaintingUncoveredText)])];
|
|
194
237
|
}
|
|
195
238
|
|
|
196
239
|
/** Resolve an authored setup image against the requirements file that names it. */
|