rig-parts 2.70.0 → 2.72.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 +12 -5
- package/docs/AUTHORING.md +11 -7
- package/docs/STABILITY.md +89 -21
- package/package.json +6 -5
- package/src/assemble.ts +2 -2
- package/src/build.ts +53 -29
- package/src/clipstretch.ts +0 -1
- package/src/configwrite.ts +1 -2
- package/src/depthsheets.ts +9 -2
- package/src/diagnostics.ts +1 -2
- package/src/edgesplit.ts +1 -2
- package/src/layers.ts +34 -6
- package/src/meshdraft.ts +3 -4
- package/src/paintingextension.ts +1 -2
- package/src/propose.ts +1 -2
- package/src/requirements.ts +1 -2
- package/src/rig.ts +9 -12
- package/src/runstamp.ts +96 -10
- package/src/scene.ts +1 -1
- package/src/structure.ts +1 -2
- package/src/turn.ts +1 -3
- package/src/visibility.ts +16 -11
- package/tools/build-process.ts +59 -8
package/cli.ts
CHANGED
|
@@ -22,7 +22,6 @@ import { replaceParts } from './src/replaceparts.ts';
|
|
|
22
22
|
* 1 it refused its input — every refusal is printed as a FAIL line
|
|
23
23
|
* 2 a usage error, or a command this version does not implement
|
|
24
24
|
*/
|
|
25
|
-
import { spawnSync } from 'node:child_process';
|
|
26
25
|
import { runBuildProcess, processRigcRunner as rigcRunner } from './tools/build-process.ts';
|
|
27
26
|
import { existsSync, linkSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
28
27
|
import { tmpdir } from 'node:os';
|
|
@@ -31,7 +30,7 @@ import { DEFAULT_PROJECT_RULE, DEFAULT_SEAM_RULE, headGarmentOverlaps, headGarme
|
|
|
31
30
|
import { proposeNeck } from './tools/neck-propose.ts';
|
|
32
31
|
import { parseAltArg } from './tools/alternate-cli.ts';
|
|
33
32
|
import { type AlternateCliInput, assembleStage, build, BUILD_OWNS, BUILD_OWNS_FILES, checkStage, checkWrote, emitFillMasksStage, ERROR_MAP_FILE, loopStage, readRuns, readSource, rigStage, suppliedCheckFlag } from './src/build.ts';
|
|
34
|
-
import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, LOOP_SEAM_BAR_UNMET, type LoopSeamRequest, PACK_PAGE_SIZE, PACK_SHAPES,
|
|
33
|
+
import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, LOOP_SEAM_BAR_UNMET, type LoopSeamRequest, PACK_PAGE_SIZE, PACK_SHAPES, type PackShape, PAGE_EDGES, type PageEdges, parsePageSize, PARTS_HOME_SENTENCE, RIGC_GEOMETRY_VERSION, rigcRanClause, NO_PARTS_SENTENCE, SEAM_MEAN_BAR, SOURCE_SENTENCE, SEAM_PX_BAR, SEAM_PX_LEVEL, SPINEBOY_YARDSTICK, TEXTURE_STRETCH_CEILING } from './src/check.ts';
|
|
35
34
|
import { checkClipStretch } from './src/clipstretch.ts';
|
|
36
35
|
import { ComfyClient, resolveHost, runBackground, runMatte, runPainting, runSeeThrough } from './src/comfy/index.ts';
|
|
37
36
|
import { coreCfg, DEFAULT_GROW_PX, runForeground } from './src/plate.ts';
|
|
@@ -62,7 +61,7 @@ import { replacementTreeDigest } from './src/replacementrecord.ts';
|
|
|
62
61
|
import { type ComposeInput, composeStage, IMAGE_SEP, PLATE, PROVENANCES, refusePreviewLoopSeam, SCENE_CAMERA_REPORT_SPEC, SCENE_REPORT_FILE, SCENE_REPORT_SPEC, SCENE_SPEC } from './src/scene.ts';
|
|
63
62
|
import { buildSheet, defaultCaption, type Tile, tilesFrom } from './src/sheet.ts';
|
|
64
63
|
import { loadComparison, requiredProblems, structureLines } from './src/structure.ts';
|
|
65
|
-
import { type ArgvTable, assembleOutputFiles, BUILD_RUN_FILE, CHECK_RUN_FILE, clearComposeRun, clearRunRecord, clearRunStamp, readPackageIdentity, realWhereItExists, recordArgv, rigOutputFiles, RUN_STAMP_FILE, RUN_STAMP_SPEC, type RunStampFileEntry, writeRunRecord, writeRunStamp } from './src/runstamp.ts';
|
|
64
|
+
import { type ArgvTable, assembleOutputFiles, bindAssembleWrapperInputs, BUILD_RUN_FILE, type BuildWrapperRole, CHECK_RUN_FILE, clearComposeRun, clearRunRecord, clearRunStamp, readPackageIdentity, realWhereItExists, recordArgv, rigOutputFiles, RUN_STAMP_FILE, RUN_STAMP_SPEC, type RunStampFileEntry, type RunStampInputEntry, writeRunRecord, writeRunStamp } from './src/runstamp.ts';
|
|
66
65
|
import { authorLayerLine } from './src/tags.ts';
|
|
67
66
|
|
|
68
67
|
const EXIT_OK = 0;
|
|
@@ -2357,13 +2356,15 @@ function cmdAssemble(args: string[]): number {
|
|
|
2357
2356
|
clearRunStamp(out);
|
|
2358
2357
|
const pkg = readPackageIdentity(join(import.meta.dir, 'package.json'));
|
|
2359
2358
|
const startedAt = fixedClock ?? new Date().toISOString();
|
|
2359
|
+
let wrapperInputs: ReturnType<typeof bindAssembleWrapperInputs>;
|
|
2360
2360
|
const result = assembleStage(
|
|
2361
2361
|
{ source, full, head, config, ...(flags.has('--requirements') ? { requirements: flags.get('--requirements') as string } : {}), ...(seam === undefined ? {} : { seam: seam as SeamRule }), ...(project === undefined ? {} : { project: project as ProjectRule }), ...(alts.length === 0 ? {} : { alts }) },
|
|
2362
2362
|
{ partsJson: join(out, 'rig', 'parts.json'), partsDir: join(out, 'rig', 'parts'), recomposite: join(out, 'render', 'recomposite_rig.png'), errorMap: join(out, 'render', ERROR_MAP_FILE) },
|
|
2363
2363
|
console.log,
|
|
2364
|
+
(readings) => { wrapperInputs = bindAssembleWrapperInputs(readings); },
|
|
2364
2365
|
);
|
|
2365
2366
|
const finishedAt = fixedClock ?? new Date().toISOString();
|
|
2366
|
-
writeRunStamp({ pkg, command: 'assemble', startedAt, finishedAt, outDir: out, configPath: config, inputs: { cwd: process.cwd(), source, full, head }, outputPaths: assembleOutputFiles(out, result) });
|
|
2367
|
+
writeRunStamp({ pkg, command: 'assemble', startedAt, finishedAt, outDir: out, configPath: config, inputs: { cwd: process.cwd(), source, full, head }, wrapperInputs, outputPaths: assembleOutputFiles(out, result) });
|
|
2367
2368
|
return EXIT_OK;
|
|
2368
2369
|
} catch (err) {
|
|
2369
2370
|
if (staged !== null) {
|
|
@@ -2663,10 +2664,15 @@ function cmdBuild(args: string[]): number {
|
|
|
2663
2664
|
const startedAt = fixedClock ?? new Date().toISOString();
|
|
2664
2665
|
const scratch = mkdtempSync(join(tmpdir(), 'rig-parts-build-'));
|
|
2665
2666
|
try {
|
|
2667
|
+
let wrapperPngs: RunStampInputEntry<BuildWrapperRole>[] | undefined;
|
|
2666
2668
|
const r = build(
|
|
2667
2669
|
{ config, source, full, head, out, ...(seam === undefined ? {} : { seam: seam as SeamRule }), ...(project === undefined ? {} : { project: project as ProjectRule }), loop, pageEdges: edges, packShape: shape, ...(size === undefined ? {} : { pageSize: size }), ...(requirements === undefined ? {} : { requirements }), idleKeys: keys, ...(leadText === undefined ? {} : { leadIn: Number(leadText) }), seamPairs: on.has('--seam-pairs'), keepStills: on.has('--keep-stills'), noExtremes: on.has('--no-extremes'), ...(alts.length === 0 ? {} : { alts }), ...(flags.has('--set') ? { set: flags.get('--set') as string } : {}), allSets: on.has('--all-sets'), ...(environment === undefined ? {} : { environment }), ...(windBand === undefined ? {} : { windBand }) },
|
|
2668
2670
|
{ rig: rigcRunner(bin), check: rigcRunner(bin), checkBin: bin, scratch: join(scratch, 'rig-gate'), stages: {
|
|
2669
|
-
assemble: (input, outputs) =>
|
|
2671
|
+
assemble: (input, outputs) => {
|
|
2672
|
+
const reading = runBuildProcess({ stage: 'assemble', bin, input, outputs }, join(scratch, 'workers'));
|
|
2673
|
+
wrapperPngs = reading?.wrapperPngs;
|
|
2674
|
+
return reading;
|
|
2675
|
+
},
|
|
2670
2676
|
rig: (input, _rigc, gateScratch) => runBuildProcess({ stage: 'rig', bin, input, scratch: gateScratch }, join(scratch, 'workers')),
|
|
2671
2677
|
check: (input, _rigc, checkBin) => runBuildProcess({ stage: 'check', bin: checkBin, input }, join(scratch, 'workers')),
|
|
2672
2678
|
} },
|
|
@@ -2677,6 +2683,7 @@ function cmdBuild(args: string[]): number {
|
|
|
2677
2683
|
const cwd = process.cwd();
|
|
2678
2684
|
writeRunRecord({ pkg, command: 'build', startedAt, finishedAt: fixedClock ?? new Date().toISOString(), outDir: out, configPath: config,
|
|
2679
2685
|
inputs: { cwd, source, full, head, requirements, environment, windBand, alts },
|
|
2686
|
+
...(wrapperPngs === undefined ? {} : { wrapperPngs }),
|
|
2680
2687
|
outputs: [...BUILD_OWNS, ...BUILD_OWNS_FILES], argv: recordArgv('build', args, BUILD_ARGV, out, cwd) });
|
|
2681
2688
|
}
|
|
2682
2689
|
return r.stoppedAt === null ? EXIT_OK : EXIT_REFUSED;
|
package/docs/AUTHORING.md
CHANGED
|
@@ -5890,6 +5890,8 @@ row in this page's `rule` and `line` tables; the selftest holds that (`TY16`).
|
|
|
5890
5890
|
| <a id="LAYERS_EXPORT_DIR_EMPTY"></a>`LAYERS_EXPORT_DIR_EMPTY` | `layers --export <dir>` was given a file, or a directory that is not empty (issue #359): a file left there could be read in place of the one written | a new directory, or empty it |
|
|
5891
5891
|
| <a id="LAYERS_EXPORT_ROUND_TRIP"></a>`LAYERS_EXPORT_ROUND_TRIP` | the export, read back, differs from the input's reading (the detail names the first difference) — an exporter bug, not an input problem | report it with the input named |
|
|
5892
5892
|
| <a id="ASSEMBLE_SOURCE_PRESENT"></a><a id="ASSEMBLE_SOURCE_DECODES"></a>`ASSEMBLE_SOURCE_PRESENT`, `ASSEMBLE_SOURCE_DECODES` | the painting is missing or not a PNG | `--source` |
|
|
5893
|
+
| <a id="ASSEMBLE_WRAPPER_PNG_CONFLICT"></a>`ASSEMBLE_WRAPPER_PNG_CONFLICT` | standalone `assemble` decoded PNG bytes with two different SHA-256 digests for the same wrapper role (`full` or `head`) and manifest-relative path | keep the PNG bytes stable throughout the run, then re-run `assemble` |
|
|
5894
|
+
| <a id="ASSEMBLE_WRAPPER_PNG_PATH"></a>`ASSEMBLE_WRAPPER_PNG_PATH` | standalone `assemble` cannot record the selected PNG as a canonical slash-delimited path within its wrapper manifest's directory | place the PNG within that directory and use a relative path free of drive prefixes, backslashes and NUL characters |
|
|
5893
5895
|
| <a id="ASSEMBLE_GROUND_PLAIN"></a>`ASSEMBLE_GROUND_PLAIN` | WARN only, never a refusal (issue #996): under project: visible, where paintingEdges reads the ground, with `assemble.ground` absent or `plain`, more than 2 % of the painting's border ring is not one colour (the ring is `SILHOUETTE_BORDER` px wide; a pixel counts when it differs from the ring's median by more than `SILHOUETTE_LIMIT`). Two causes: the ground is not plain, or the figure crosses the border | if it is the ground, declare `assemble.ground: busy`; if the figure crosses the border, leave the ground as it is (the WARN never changes output) |
|
|
5894
5896
|
| <a id="SHEET_SOURCE_PRESENT"></a><a id="SHEET_PNG_PRESENT"></a>`SHEET_SOURCE_PRESENT`, `SHEET_PNG_PRESENT` | `sheet`'s painting, or a part PNG a `parts.json` lists, is missing | `--source`, `--layers` |
|
|
5895
5897
|
|
|
@@ -8536,9 +8538,10 @@ If a clip passes alone but the idle fails, change one input, such as the
|
|
|
8536
8538
|
wind key's peak, and rerun the same command on the edited build and scene.
|
|
8537
8539
|
Read both lines before running the regular character check and `compose`,
|
|
8538
8540
|
which still makes the shipping decision. The diagnostic prints only text.
|
|
8539
|
-
Exit 0 means every played take
|
|
8540
|
-
[slider rows](#slider-applied-clip-stretch-issue-1627)
|
|
8541
|
-
|
|
8541
|
+
Exit 0 means every played take (`CHECK_CLIP_STRETCH`, including `idle`) was
|
|
8542
|
+
measured and passed; [slider rows](#slider-applied-clip-stretch-issue-1627) are
|
|
8543
|
+
advisory and do not set a failing exit (issue #1648).
|
|
8544
|
+
Exit 1 means a `CHECK_CLIP_STRETCH` failure, refusal or missing required reading. Exit 2 means a usage error.
|
|
8542
8545
|
|
|
8543
8546
|
Literal `false` is accepted at any character scale. The side clip still passes
|
|
8544
8547
|
through the character's scale checks, which refuse nonzero `wind` or `gravity`
|
|
@@ -8673,12 +8676,13 @@ extreme dial angle can be told apart from broad interior stretch.
|
|
|
8673
8676
|
|
|
8674
8677
|
Stock `check` reports a measured dial `FAIL` at the existing `WARN` level and
|
|
8675
8678
|
counts slider outcomes separately from the ordinary bars. The dial report is
|
|
8676
|
-
advisory
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
+
advisory in `check --clip-stretch <scene.json>` as well (issue #1648): the
|
|
8680
|
+
diagnostic prints each `CHECK_SLIDER_STRETCH` row with its `PASS`, `FAIL` or
|
|
8681
|
+
`SKIP` verdict on the composed rig, and none of those rows sets a failing exit.
|
|
8679
8682
|
A slider-only clip has a dial row only. A separate played role
|
|
8680
8683
|
explicit in the source or composition produces both a dial row and a played
|
|
8681
|
-
row
|
|
8684
|
+
`CHECK_CLIP_STRETCH` row, and the played row still gates the exit. The declared
|
|
8685
|
+
idle and existing `with_idle` readings still apply.
|
|
8682
8686
|
|
|
8683
8687
|
When `rig` writes a rig with a slider, its notice reads
|
|
8684
8688
|
|
package/docs/STABILITY.md
CHANGED
|
@@ -1287,7 +1287,7 @@ execution in historical evidence is inferred from a current export.
|
|
|
1287
1287
|
| keyed scene camera | `compose` | optional `camera` in `spine-parts-scene/1` (issue #1596). A camera scene writes `spine-parts-scene-report/2` at the existing `scene.json` path with its keyed camera, sampled coverage and framing verdict, and packed model SHA-256. Scenes without a camera write report /1. Both report specs include `scene_driven` on new writes. The camera path uses Core animation easing and the posed backdrop at each sampled frame. Rig, motion and stock check outputs retain their existing semantics. The compose input receipt stays `rig-compose-run/1`. See [Keyed scene camera](AUTHORING.md#keyed-scene-camera-issue-1596) |
|
|
1288
1288
|
| physics clips and scene repeats | `compose` | Issue #1615 adds `characters[].with_idle` and top-level `repeats` to `spine-parts-scene/1`. Each physics-only side clip requires literal `false` at any character scale or a safe integer count of at least 1 at scale 1. Numeric declarations fold whole periods into `idle` with exact duration equality. Both values retain `<id>:<clip>` subject to the character's scale checks, and the character report row echoes `with_idle` when declared. A scene repeat count is a safe integer of at least 2 on an authored take. Its duration remains the whole take length. Its tracks, deforms and camera keys use the exact duration divided by the count as their period. Repeated camera keys are expanded in report /2, with coverage on the full take clock and per-frame figure measurements. See [Physics clips and scene repeats](AUTHORING.md#physics-clips-and-scene-repeats-issue-1615) |
|
|
1289
1289
|
| `idle.png`, `idle-indexed.png`, `idle.gif` | `loop`, `build --loop` | APNG and GIF encodings of the rendered idle |
|
|
1290
|
-
| `run.json` | `rig`, `assemble` | spec `rig-run/1` (issue #1165, additive): `spec`, `package` (`name`, `version`), `command` (`"rig"` or `"assemble"`), `started_at` and `finished_at` (UTC ISO-8601 millisecond timestamps ending in `Z`, read in the CLI layer), `config` (`path` relative to `--out`, `sha256` of the config file on disk), `parts_input` on standalone `rig` (`path`, `sha256`, issue #1636), `inputs` on `assemble` (issues #1316, #1554,
|
|
1290
|
+
| `run.json` | `rig`, `assemble` | spec `rig-run/1` (issue #1165, additive): `spec`, `package` (`name`, `version`), `command` (`"rig"` or `"assemble"`), `started_at` and `finished_at` (UTC ISO-8601 millisecond timestamps ending in `Z`, read in the CLI layer), `config` (`path` relative to `--out`, `sha256` of the config file on disk), `parts_input` on standalone `rig` (`path`, `sha256`, issue #1636), `inputs` on `assemble` (issues #1316, #1554), `wrapper_pngs` on standalone `assemble` with a wrapper (issue #1645), and `outputs` (`path` relative to `--out`, `sha256` of each written output file on disk, sorted by `path` in code-unit order and excluding `run.json` itself). See the [run stamp contract](#run-stamp-runjson-spec-rig-run1) for the input bindings. The stamp is written only after the command's gate is green. |
|
|
1291
1291
|
| `check-run.json` | `check` | spec `rig-run/2`. Fixed keys in order are `spec`, `package`, `command`, `started_at`, `finished_at`, optional `parts_input` (`path`, `sha256`, issue #1636), `outputs` and `argv`. See the [run record contract](#run-record-check-runjson-and-build-runjson-spec-rig-run2). |
|
|
1292
1292
|
| the difference inventory (`--out`) | `diff-components` | spec `rig-parts-diff-components/1` by default (issue #1005: `stack`, `painting`, `definition`, `error_px`, `uncovered_error_px`, `components` — each `id`, `px`, `box`, `coverage`, `uncovered_px`, `borders` — and `below_floor`, byte-identical to 2.38.1), and spec `rig-parts-diff-components/2` under `--owners` (issue #1291: adds `owners` — each `{part, px}`, the topmost `parts.json` part above `COVERED_ALPHA` per covered pixel, back to front — before `borders` on every component); `--verify` verifies both `/1` and `/2` reports (with `--owners`, `/2` is required), while a `/1`-only reader (`readDiffComponents(text, input, [DIFF_COMPONENTS_SPEC])`) refuses `/2` by name |
|
|
1293
1293
|
| the draft comparison (`--out`) | `diff-drafts` | spec `rig-parts-draft-diff/1` (issue #1369), a stable contract as of 2.45.0: fixed keys in order `spec`, `left` and `right` (each `parts_sha256`, `part_count`, `composite_sha256`), `canvas` (`width`, `height`), `order` (`"same"` or `"changed"`), `parts` (one entry per part name in the union of both sides, sorted by `name` in code-unit order: `name`, `status`, then `left` and `right` on the sides that hold the part, each `sha256`, `box`, `index`, then `pixels_equal` and `pixels` on `changed` only), `composite` and `summary`; no clock and no file paths. The command records no threshold and judges nothing; it exits 0 whenever the report is written. [Draft-to-draft assemble comparison](AUTHORING.md#draft-to-draft-assemble-comparison-issue-1369) defines each field. |
|
|
@@ -1463,9 +1463,12 @@ inherit a scene-keyed parent, and a constraint can read a scene-keyed input. See
|
|
|
1463
1463
|
### Check report (`rig-parts-check/1`)
|
|
1464
1464
|
|
|
1465
1465
|
`check --clip-stretch <scene.json>` has its own text and exit status. It exits
|
|
1466
|
-
0 when every played take
|
|
1467
|
-
|
|
1468
|
-
2 on usage errors.
|
|
1466
|
+
0 when every played take (`CHECK_CLIP_STRETCH`, including `idle`) has a
|
|
1467
|
+
measurable passing peak, 1 on a refusal, failing `CHECK_CLIP_STRETCH` bar or
|
|
1468
|
+
missing required played-take reading, and 2 on usage errors. `CHECK_SLIDER_STRETCH`
|
|
1469
|
+
rows are still printed with their `PASS`, `FAIL` or `SKIP` verdicts, and are
|
|
1470
|
+
advisory (they do not affect the exit status, issue #1648). It writes no
|
|
1471
|
+
`check.json`, `check-run.json`, or scene output.
|
|
1469
1472
|
The ordinary check report, verdict and compose admission retain their existing meanings.
|
|
1470
1473
|
The [slider stretch contract](#slider-stretch-diagnostic-issue-1627) defines
|
|
1471
1474
|
the dial rows and their effect on the verdict.
|
|
@@ -1606,11 +1609,12 @@ or compose admission. The report retains spec `rig-parts-check/1`.
|
|
|
1606
1609
|
`check --clip-stretch` opts into the same reset-pose measurement on the composed
|
|
1607
1610
|
rig, with each dial sampled independently and compared with canonical rest
|
|
1608
1611
|
using the stock stretch metric. It prints `CHECK_SLIDER_STRETCH` rows using
|
|
1609
|
-
composed names
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
`
|
|
1613
|
-
|
|
1612
|
+
composed names, keeping their `PASS`, `FAIL` and `SKIP` verdict words.
|
|
1613
|
+
Slider-only clips have dial rows. Clips with an explicitly declared played role
|
|
1614
|
+
also have `CHECK_CLIP_STRETCH` rows. The diagnostic still writes only text.
|
|
1615
|
+
`CHECK_SLIDER_STRETCH` rows are advisory here too and leave the exit status
|
|
1616
|
+
unchanged (issue #1648); existing played take and idle `CHECK_CLIP_STRETCH`
|
|
1617
|
+
verdicts decide exit 0 vs 1. See [the authoring guide](AUTHORING.md#slider-applied-clip-stretch-issue-1627).
|
|
1614
1618
|
|
|
1615
1619
|
### Run stamp (`run.json`, spec `rig-run/1`)
|
|
1616
1620
|
|
|
@@ -1643,14 +1647,15 @@ additive): one `{ "role", "path", "sha256" }` entry (keys in that order) for eac
|
|
|
1643
1647
|
`--source`, `--full` and `--head` that was given, in the fixed order `source`, `full`,
|
|
1644
1648
|
`head` (an input not given is absent from the list, never `null` or guessed), with
|
|
1645
1649
|
`/`-separated `path` relative to `--out` by the `rig-run/2` link rule (naming
|
|
1646
|
-
`<dir>/layers.json` when the input is a directory, issue #1554)
|
|
1647
|
-
`
|
|
1650
|
+
`<dir>/layers.json` when the input is a directory, issue #1554). For wrapper `full`
|
|
1651
|
+
and `head` entries, `sha256` hashes the exact manifest bytes consumed by assemble.
|
|
1652
|
+
The existing paths and PSD file bindings are preserved. Standalone `rig` writes
|
|
1648
1653
|
`parts_input` immediately after `config` (issue #1636), with `path` and `sha256`
|
|
1649
1654
|
in that order. The directory named by `--parts` is rebased relative to `--out`
|
|
1650
1655
|
by the same realpath rule as `config.path`. A directory that coincides with
|
|
1651
1656
|
`--out` is recorded as `.`. The digest follows the [parts input snapshot](#parts-input-snapshot)
|
|
1652
|
-
contract. The config,
|
|
1653
|
-
after writing. A refused run writes no `run.json`. By default, `started_at` and
|
|
1657
|
+
contract. The config, source, PSD input and output hashes use the file bytes on
|
|
1658
|
+
disk after writing. A refused run writes no `run.json`. By default, `started_at` and
|
|
1654
1659
|
`finished_at` record wall-clock
|
|
1655
1660
|
time read in `cli.ts` (`src/` remains pure). With that default, `run.json` is outside
|
|
1656
1661
|
the byte-for-byte
|
|
@@ -1658,6 +1663,25 @@ determinism comparisons (`RG03`, `RG19`, `AS07`); for the same input at the same
|
|
|
1658
1663
|
receipt-relative input layout, two `run.json` files differ only in `started_at` and
|
|
1659
1664
|
`finished_at`.
|
|
1660
1665
|
|
|
1666
|
+
Standalone `assemble` adds the optional top-level `wrapper_pngs` after `inputs`
|
|
1667
|
+
and before `outputs` whenever it uses a wrapper (issue #1645). Each row is
|
|
1668
|
+
`{ "role", "path", "sha256" }`, in that key order. The role is `full` or `head`
|
|
1669
|
+
and identifies the corresponding wrapper manifest. `path` is the canonical,
|
|
1670
|
+
slash-separated path relative to that manifest's directory. It names the PNG
|
|
1671
|
+
selected for decoding, including a fallback when used. `sha256` is the lowercase
|
|
1672
|
+
hex SHA-256 digest of the exact PNG file bytes passed to the decoder. An edit to a PNG
|
|
1673
|
+
at the same path mid-run leaves the recorded digest bound to the bytes consumed.
|
|
1674
|
+
|
|
1675
|
+
Rows cover decoded drawn and hidden layer PNGs and decoded `depth_filename`
|
|
1676
|
+
PNGs when depth is active. Omitting `--head` yields only `full` rows when the
|
|
1677
|
+
full input is a wrapper. Rows sort `full` before `head`, then by `path` in
|
|
1678
|
+
UTF-16 code-unit order within each role. Repeated reads with the same role, path,
|
|
1679
|
+
and digest collapse to one row. Distinct digests for the same role and path
|
|
1680
|
+
refuse the run as `ASSEMBLE_WRAPPER_PNG_CONFLICT`. A selected path that cannot be
|
|
1681
|
+
represented in the required form refuses the run as `ASSEMBLE_WRAPPER_PNG_PATH`.
|
|
1682
|
+
An older wrapper stamp without `wrapper_pngs` leaves its PNGs unbound. An
|
|
1683
|
+
all-PSD run omits `wrapper_pngs`.
|
|
1684
|
+
|
|
1661
1685
|
Set `SOURCE_DATE_EPOCH` to opt into a fixed clock: both timestamps equal that
|
|
1662
1686
|
instant in UTC ISO format, without adding a stamp field. The value must match
|
|
1663
1687
|
`^(0|[1-9][0-9]*)$` and be at most 253402300799 seconds
|
|
@@ -1677,8 +1701,8 @@ neither hashed nor listed. Before the stage starts, the command removes an earli
|
|
|
1677
1701
|
`package.json` without a non-empty `name` and `version` refuses `RUN_STAMP_PACKAGE`
|
|
1678
1702
|
and writes no stamp. `build` and the in-process stages write no `run.json`.
|
|
1679
1703
|
|
|
1680
|
-
`
|
|
1681
|
-
|
|
1704
|
+
The optional `parts_input` and `wrapper_pngs` are additive to `rig-run/1`.
|
|
1705
|
+
Older stamps may omit them.
|
|
1682
1706
|
|
|
1683
1707
|
### Run record (`check-run.json` and `build-run.json`, spec `rig-run/2`)
|
|
1684
1708
|
|
|
@@ -1759,17 +1783,19 @@ resolved parts directory refuses the receipt as `RUN_PARTS_INPUT_CHANGED`.
|
|
|
1759
1783
|
|
|
1760
1784
|
`build` writes `<out>/build-run.json` when its check report completes, including a
|
|
1761
1785
|
report with failing bars. Issue #1556 advances `spec` to `rig-run/3` and adds
|
|
1762
|
-
`inputs` between `config` and `outputs
|
|
1763
|
-
|
|
1764
|
-
|
|
1786
|
+
`inputs` between `config` and `outputs`; issue #1669 adds optional `wrapper_pngs`
|
|
1787
|
+
between `inputs` and `outputs`. The fixed key order is `spec`, `package`,
|
|
1788
|
+
`command`, `started_at`, `finished_at`, `config`, `inputs`, optional
|
|
1789
|
+
`wrapper_pngs`, `outputs`, `argv`. The other fields and the write timing follow
|
|
1790
|
+
the `rig-run/2` build contract above.
|
|
1765
1791
|
|
|
1766
1792
|
This example shows a build with full and head layer directories and one alternate tuple.
|
|
1767
|
-
The version and digests are illustrative, and the output
|
|
1793
|
+
The version and digests are illustrative, and the wrapper PNG and output lists are abbreviated.
|
|
1768
1794
|
|
|
1769
1795
|
```json
|
|
1770
1796
|
{
|
|
1771
1797
|
"spec": "rig-run/3",
|
|
1772
|
-
"package": { "name": "@rig-c/parts", "version": "2.
|
|
1798
|
+
"package": { "name": "@rig-c/parts", "version": "2.71.0" },
|
|
1773
1799
|
"command": "build",
|
|
1774
1800
|
"started_at": "2026-11-25T00:00:00.000Z",
|
|
1775
1801
|
"finished_at": "2026-11-25T00:00:01.000Z",
|
|
@@ -1809,6 +1835,28 @@ The version and digests are illustrative, and the output list is abbreviated.
|
|
|
1809
1835
|
"sha256": "66778899aabbccddeeff00112233445566778899aabbccddeeff001122334455"
|
|
1810
1836
|
}
|
|
1811
1837
|
],
|
|
1838
|
+
"wrapper_pngs": [
|
|
1839
|
+
{
|
|
1840
|
+
"role": "full",
|
|
1841
|
+
"path": "parts/topwear.png",
|
|
1842
|
+
"sha256": "8899aabbccddeeff00112233445566778899aabbccddeeff0011223344556677"
|
|
1843
|
+
},
|
|
1844
|
+
{
|
|
1845
|
+
"role": "head",
|
|
1846
|
+
"path": "parts/face.png",
|
|
1847
|
+
"sha256": "99aabbccddeeff00112233445566778899aabbccddeeff001122334455667788"
|
|
1848
|
+
},
|
|
1849
|
+
{
|
|
1850
|
+
"role": "alt[0].full",
|
|
1851
|
+
"path": "parts/topwear.png",
|
|
1852
|
+
"sha256": "aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899"
|
|
1853
|
+
},
|
|
1854
|
+
{
|
|
1855
|
+
"role": "alt[0].head",
|
|
1856
|
+
"path": "parts/face.png",
|
|
1857
|
+
"sha256": "bbccddeeff00112233445566778899aabbccddeeff00112233445566778899aa"
|
|
1858
|
+
}
|
|
1859
|
+
],
|
|
1812
1860
|
"outputs": [
|
|
1813
1861
|
{
|
|
1814
1862
|
"path": "check/check.json",
|
|
@@ -1841,9 +1889,29 @@ order regardless of where each flag appears in `argv`.
|
|
|
1841
1889
|
`i` is zero-based and counts the `--alt` occurrences. Entries for optional flags
|
|
1842
1890
|
or tuple members appear only when supplied. The array inventories CLI file
|
|
1843
1891
|
inputs. References declared only inside the config and files referenced by a
|
|
1844
|
-
layer manifest are outside
|
|
1892
|
+
layer manifest are outside `inputs`. `config` binds `--config` separately,
|
|
1845
1893
|
and `--out` is the output root.
|
|
1846
1894
|
|
|
1895
|
+
`wrapper_pngs` is additive to `rig-run/3` (issue #1669) and appears whenever the
|
|
1896
|
+
build decodes at least one wrapper manifest across the primary tuple or any `--alt`
|
|
1897
|
+
tuple. Each row is `{ "role", "path", "sha256" }` in that key order, matching
|
|
1898
|
+
`assemble`'s `wrapper_pngs` (#1645). `role` is `full`, `head`, `alt[i].full` or
|
|
1899
|
+
`alt[i].head`, equal to the `role` of the `inputs` row whose manifest the PNG
|
|
1900
|
+
belongs to. `path` is canonical and `/`-separated, relative to that manifest's
|
|
1901
|
+
directory, naming the file actually decoded (including the `parts/<name>.png`
|
|
1902
|
+
fallback when used). `sha256` is the lowercase hex SHA-256 digest of the exact
|
|
1903
|
+
bytes passed to the decoder. Coverage spans every decoded drawn and hidden layer
|
|
1904
|
+
PNG and every decoded `depth_filename` PNG when depth is active, across the
|
|
1905
|
+
primary tuple and every `--alt` tuple; a role whose input is a PSD contributes no
|
|
1906
|
+
rows. Rows sort by role in `inputs` order (`full`, `head`, `alt[0].full`,
|
|
1907
|
+
`alt[0].head`, …) and then by `path` in UTF-16 code-unit order, collapsing
|
|
1908
|
+
repeated reads with the same role, path and digest to one row. Distinct digests
|
|
1909
|
+
for the same role and path refuse the build as `ASSEMBLE_WRAPPER_PNG_CONFLICT`,
|
|
1910
|
+
and a selected path outside the canonical relative form refuses as
|
|
1911
|
+
`ASSEMBLE_WRAPPER_PNG_PATH`, writing no record in either case. An all-PSD build
|
|
1912
|
+
omits `wrapper_pngs`, and an older `rig-run/3` record without `wrapper_pngs`
|
|
1913
|
+
leaves its wrapper PNGs unbound.
|
|
1914
|
+
|
|
1847
1915
|
The run-record writer reads and hashes the raw bytes on disk of the file named by
|
|
1848
1916
|
`path` after the check report completes. Keep input files and link targets unchanged
|
|
1849
1917
|
from the start of the build until it exits so these digests describe the bytes the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rig-parts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.72.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": {
|
|
@@ -71,8 +71,9 @@
|
|
|
71
71
|
"selftest:pre": "bun selftest.ts --pre",
|
|
72
72
|
"smoke": "bun scripts/install_smoke.ts",
|
|
73
73
|
"verify:nova": "bun scripts/verify_nova.ts",
|
|
74
|
-
"
|
|
75
|
-
"
|
|
74
|
+
"hooks": "([ -e .git ] && [ -f .githooks/pre-commit ] && [ \"$(git config --get core.hooksPath 2>/dev/null)\" != .githooks ] && git rev-parse --git-dir >/dev/null 2>&1 && git config core.hooksPath .githooks >/dev/null 2>&1 || true)",
|
|
75
|
+
"typecheck": "bun run hooks && bunx tsc --noEmit",
|
|
76
|
+
"lint": "bun run hooks && bunx eslint .",
|
|
76
77
|
"prepublishOnly": "node scripts/prepublish.cjs"
|
|
77
78
|
},
|
|
78
79
|
"dependencies": {
|
|
@@ -82,8 +83,8 @@
|
|
|
82
83
|
"devDependencies": {
|
|
83
84
|
"@esotericsoftware/spine-core": "4.3.13",
|
|
84
85
|
"@types/bun": "^1.4.2",
|
|
85
|
-
"eslint": "
|
|
86
|
+
"eslint": "10.11.0",
|
|
86
87
|
"typescript": "^5.9.3",
|
|
87
|
-
"typescript-eslint": "
|
|
88
|
+
"typescript-eslint": "8.70.1"
|
|
88
89
|
}
|
|
89
90
|
}
|
package/src/assemble.ts
CHANGED
|
@@ -5906,7 +5906,7 @@ function assembleParts(input: AssembleInput, targets?: ReadonlySet<string>, befo
|
|
|
5906
5906
|
const cutMaterial: MaterialRow[] = [];
|
|
5907
5907
|
const materialSources: MaterialSource[] = [];
|
|
5908
5908
|
plan.forEach(([name], pi) => {
|
|
5909
|
-
const mine = cuts.map((
|
|
5909
|
+
const mine = cuts.map((_q, i) => i).filter((i) => cuts[i].from === name);
|
|
5910
5910
|
const b = built[pi];
|
|
5911
5911
|
if (mine.length === 0 || b === null) return;
|
|
5912
5912
|
const before = opaqueOf(b.r);
|
|
@@ -7097,7 +7097,7 @@ export function bodiesWithPixels(mask: Mask, minPx: number): { bodies: Uncovered
|
|
|
7097
7097
|
for (let p = 0; p < opened.data.length; p++) if (mask.data[p] === 0) opened.data[p] = 0;
|
|
7098
7098
|
const cc = connectedComponents(opened, 8);
|
|
7099
7099
|
const keep = cc.stats.map((s, l) => l > 0 && s.area > 0 && s.area >= minPx);
|
|
7100
|
-
const all = cc.stats.filter((
|
|
7100
|
+
const all = cc.stats.filter((_s, l) => keep[l]);
|
|
7101
7101
|
all.sort((a, b) => b.area - a.area || a.top - b.top || a.left - b.left);
|
|
7102
7102
|
const pixels = newMask(mask.width, mask.height);
|
|
7103
7103
|
for (let p = 0; p < pixels.data.length; p++) if (keep[cc.labels[p]]) pixels.data[p] = 1;
|
package/src/build.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { changedAssemblyFields, effectiveAssemblyRules, projectAssemblyConfig, readProjectedAssemblyConfig, type AssemblyLimb, refuseStaleAssembly, type AssemblyRules } from './assembly-reading.ts';
|
|
2
2
|
import { editedPartFrontColourLines, readEditedParts } from './editedparts.ts';
|
|
3
3
|
import { SOURCE_COVER_FILE, sourceCoverReport, type SourceCoverSet } from './sourcecover.ts';
|
|
4
|
-
import { STAGE_MAP_FILE } from './provenance.ts';
|
|
4
|
+
import { ownershipLines, provenanceLines, STAGE_MAP_FILE } from './provenance.ts';
|
|
5
5
|
import { withoutCheckRows } from './checkrow.ts';
|
|
6
6
|
import { readSetupFigureMask } from './setupfiguremask.ts';
|
|
7
7
|
import { EDGE_RESIDUAL_FILE, edgeResidualLines } from './edgeresidual.ts';
|
|
8
8
|
import { SUPPORT_DOMAINS_FILE, writeSupportDomains } from './supportdomains.ts';
|
|
9
9
|
import { COINCIDE_LINE, SETUP_SEAM_TRANSMISSION_LINE, setupSeamTransmissionLine, supportLines } from './coincide.ts';
|
|
10
|
-
import { DEFAULT_PROJECT_RULE } from './projectrule.ts';
|
|
11
10
|
import { type PaintingAllocationReading, type PaintingAllocationEvent, EDGE_CONTRAST, PAINTING_ALLOCATION_FILE, PAINTING_EDGE_COVERAGE_TRANSFER } from './paintingedges.ts';
|
|
12
11
|
import { SETUP_PAINTING_LINE, setupPaintingLines } from './setuppainting.ts';
|
|
13
12
|
import { boundaryColourLines } from './boundarycolour.ts';
|
|
@@ -20,7 +19,6 @@ import { applyTakenLayers } from './takelayers.ts';
|
|
|
20
19
|
import { applyTakenRegions } from './takeregion.ts';
|
|
21
20
|
import { bindOccluderPlates, occluderStageWarnings, readOccluderInputs } from './occluderstage.ts';
|
|
22
21
|
import { PLATE_RECEIPT_FILE, type PlateReceipt, verifyPlateReceipt } from './plate.ts';
|
|
23
|
-
import { ownershipLines, provenanceLines } from './provenance.ts';
|
|
24
22
|
import { readSourceDepth } from './depthsheets.ts';
|
|
25
23
|
import { orderedBaseAnchor } from './baseanchor.ts';
|
|
26
24
|
import { alternateLayerSources, alternateLayerIslands, alternateLayerOthers } from './alternatelayers.ts';
|
|
@@ -72,7 +70,7 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, wri
|
|
|
72
70
|
import { basename, dirname, join, relative, resolve, sep } from 'node:path';
|
|
73
71
|
import { makeOutDir } from './outputpaths.ts';
|
|
74
72
|
import { type AnimFrame, EncodeError, encodeApng, encodeIndexedApng, INDEXED_DEFAULTS } from './apng.ts';
|
|
75
|
-
import { assemble, type AssembleResult, boxOf, cutLines, edgeSplitLines, ERROR_LIMIT, type ExcludedCount, excludedLines, setExclusions, islandLines, setIslandSources, type IslandCount, hiddenLines, SINGLE_RUN_FACE_TAGS, singleRunHeadBox, softOcclusionLine, driftLine, limbLines, FIGURE_MASK_FILE, figureMaskLines, figuresLine, groundWarning, holeKindsLine, holeLines, measurePinholes, measureRecomposite, pinholeProblems, pinholesLine, type ProjectRule, recomposite, recompositeRecord, scenePhrase, type SeamRule, sourceInRig, projectedStageFields, stageFields, uncoveredLine, underBox } from './assemble.ts';
|
|
73
|
+
import { assemble, type AssembleResult, boxOf, capOwnershipLines, cutLines, edgeSplitLines, ERROR_LIMIT, type ExcludedCount, excludedLines, setExclusions, islandLines, setIslandSources, type IslandCount, hiddenLines, type OtherLimbs, SINGLE_RUN_FACE_TAGS, singleRunHeadBox, softOcclusionLine, splitLines, type SplitCount, driftLine, limbLines, FIGURE_MASK_FILE, figureMaskLines, figuresLine, groundWarning, holeKindsLine, holeLines, measurePinholes, measureRecomposite, pinholeProblems, pinholesLine, type ProjectRule, recomposite, recompositeRecord, scenePhrase, type SeamRule, sourceInRig, projectedStageFields, stageFields, uncoveredLine, underBox } from './assemble.ts';
|
|
76
74
|
import { allocationClause, type Reducer, stageBClause, unboundedClause } from './automesh.ts';
|
|
77
75
|
import { residualClause } from './autoenvelope.ts';
|
|
78
76
|
import { type AutoMotionCase, failingRows, idleSchedule, localRow, motionClause, motionDeformation, motionDocument, motionInput, motionRowText, motionStimulus, motionVerdict, noStimulusProblem, prepareComparison, type ReplayCandidate, runComparison, runPreparedComparison, sourceSelfFailure, stimulusMotion, withStimulus } from './automotion.ts';
|
|
@@ -100,9 +98,8 @@ import {
|
|
|
100
98
|
untestedIntervals,
|
|
101
99
|
} from './autoreplay.ts';
|
|
102
100
|
import { physicsLines } from './physicscontrib.ts';
|
|
103
|
-
import { besideIdleLine, checkSummaryLine, inputFileRecord, type InputFileRecord, CLOTH_LINE, type ClothLine, clothWarnText, figureOpeningLines, frameRuns, MOTION_SEAM_LINE, type MotionSeamLine, type MotionSeamPlant, motionSeamRequiredLine, motionSeamWarnText, motionJointContactLines, FOLD_LINE, type FoldsLine, LEVEL_LINE, type LevelLine, LIMB_LINE, type LimbLine, STRESS_LINE, SWEEP_LINE, type SweepLine, buildGateLines, causeLines, environmentLine, IDLE_FPS, IDLE_MAX_PX, maxRgbDiff, REQUIREMENTS_DIR, type CheckReport, type PackLine, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, GATE_PROFILE, JUDGEMENT_LINES, type JudgementLine, packedBuildArgs, packedBuildLabel, type PackMode, parsePageSize, readCheckEnvironment, readWindBand, type PackShape, type PageEdges, readFrameSet, rigcFailed, rigcIdentity, rigcRanClause, REPORTED_LINES, type ReportedLine, type RigcRunner, runCheck, SEAM_DIR, SEAM_MEAN_BAR, seamPairText, seamRigPxText, SOURCE_LINE, SEAM_PX_BAR, SEAM_PX_LEVEL, SEAM_PX_LEVEL_HIGH, SPINEBOY_YARDSTICK, STILL_DIR, WIND_BAND_LINE, windBandLines } from './check.ts';
|
|
104
|
-
import {
|
|
105
|
-
import { type CharacterConfig, type Cut, type Extend, loadConfigAndAnimations, loadConfigWithBytes, loadEarlyConfig, type Patch, type PlanEntry } from './config.ts';
|
|
101
|
+
import { besideIdleLine, checkSummaryLine, inputFileRecord, type InputFileRecord, CLOTH_LINE, type ClothLine, clothWarnText, figureOpeningLines, frameRuns, type LoopSeamRequest, MOTION_SEAM_LINE, type MotionSeamLine, type MotionSeamPlant, motionSeamRequiredLine, motionSeamWarnText, motionJointContactLines, FOLD_LINE, type FoldsLine, LEVEL_LINE, type LevelLine, LIMB_LINE, type LimbLine, sliderStretchLine, STRESS_LINE, SWEEP_LINE, type SweepLine, buildGateLines, causeLines, environmentLine, IDLE_FPS, IDLE_MAX_PX, maxRgbDiff, REQUIREMENTS_DIR, type CheckReport, type PackLine, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, GATE_PROFILE, JUDGEMENT_LINES, type JudgementLine, packedBuildArgs, packedBuildLabel, type PackMode, parsePageSize, readCheckEnvironment, readWindBand, type PackShape, type PageEdges, readFrameSet, rigcFailed, rigcIdentity, rigcRanClause, REPORTED_LINES, type ReportedLine, type RigcRunner, runCheck, SEAM_DIR, SEAM_MEAN_BAR, seamPairText, seamRigPxText, SOURCE_LINE, SEAM_PX_BAR, SEAM_PX_LEVEL, SEAM_PX_LEVEL_HIGH, SPINEBOY_YARDSTICK, STILL_DIR, WIND_BAND_LINE, windBandLines } from './check.ts';
|
|
102
|
+
import { type BoneEntry, type CharacterConfig, type Cut, type Extend, loadConfigAndAnimations, loadConfigWithBytes, loadEarlyConfig, type Patch, type PlanEntry } from './config.ts';
|
|
106
103
|
import { coreCompileGuideLine, failLine, foldName, PartsError, type Problem, refuseIfAny } from './errors.ts';
|
|
107
104
|
import { editedConfigImages, editedRunImages, missingReceipts, readEditorReceipts } from './editreceipt.ts';
|
|
108
105
|
import { untracedPartSources } from './partsource.ts';
|
|
@@ -112,16 +109,12 @@ import { CONTROL_SUFFIX, withAnimations } from './motion.ts';
|
|
|
112
109
|
import type { PaletteError } from './palette.ts';
|
|
113
110
|
import { PartVisibility } from './partvisibility.ts';
|
|
114
111
|
import { readRunVisibility } from './visibility.ts';
|
|
115
|
-
import { type LayerSet, readLayers } from './layers.ts';
|
|
112
|
+
import { type LayerSet, OPAQUE_ALPHA_ABOVE, readLayers, type WrapperReadings } from './layers.ts';
|
|
116
113
|
import { placeBoneEntriesForSkeleton, poseBoneEntriesForDrawn, REGISTER_OFFSET_BAR, REGISTER_SCALE_BAR, registeredWithinBar, registerSkeleton, SKELETON_LIMB_BONES, skeletonDrawnLength, skeletonLimbJoints } from './limbs.ts';
|
|
117
114
|
import { type AlternatePartsRecord, PAINTING_IN_RIG_FILE, FRONT_SUFFIX, type OccluderPlateRecord, type PartRecord, partImageReference, depthImageReference, readParts, readPartsManifest, type RecompositeRecord, type SingleRunPad, tagOf, writeParts } from './parts.ts';
|
|
118
115
|
import { encodePngBytes, readPng, writePng } from './raster/png.ts';
|
|
119
116
|
import { verifyReplacementRecord } from './replaceparts.ts';
|
|
120
|
-
import type
|
|
121
|
-
import { type Mask, newMask } from './raster/types.ts';
|
|
122
|
-
import { type OtherLimbs, splitLines, capOwnershipLines, type SplitCount } from './assemble.ts';
|
|
123
|
-
import type { BoneEntry } from './config.ts';
|
|
124
|
-
import { OPAQUE_ALPHA_ABOVE } from './layers.ts';
|
|
117
|
+
import { type Mask, newMask, type Raster } from './raster/types.ts';
|
|
125
118
|
import { pinholesRequired, readRequirements, type RequirementLine, summaryText } from './requirements.ts';
|
|
126
119
|
import { type AutoMeshReport, buildRig, DEFAULT_IDLE_KEYS, type FaceAxis, type IdleKeys, type MeshReport, rebindRigMotion, type RigCommand, rigJsonText, type RigOutput, type RigSpec, SETS_FILE, type StrayCleared, type TurnRow } from './rig.ts';
|
|
127
120
|
import { KEYPOINT_NAMES, type KeypointName, type PosePoints } from './skeleton.ts';
|
|
@@ -149,26 +142,39 @@ export function readSource(path: string): Raster {
|
|
|
149
142
|
}
|
|
150
143
|
}
|
|
151
144
|
|
|
145
|
+
export type BuildWrapperRole = 'full' | 'head' | `alt[${number}].full` | `alt[${number}].head`;
|
|
146
|
+
|
|
147
|
+
export interface AssembleWrapperReadings {
|
|
148
|
+
full: WrapperReadings;
|
|
149
|
+
head: WrapperReadings;
|
|
150
|
+
alts?: Array<{ full: WrapperReadings; head: WrapperReadings }>;
|
|
151
|
+
}
|
|
152
|
+
|
|
152
153
|
/**
|
|
153
154
|
* Read both runs, collecting the refusals of both before throwing. With no
|
|
154
155
|
* head run (`head` null, issue #359) the full run is read once and stands for
|
|
155
156
|
* both, and `single` says so: the stage then holds it to `checkSingleRun`.
|
|
156
157
|
*/
|
|
157
|
-
export function readRuns(full: string, head: string | null, recordVisibility = false): {
|
|
158
|
+
export function readRuns(full: string, head: string | null, recordVisibility = false, wrapperReadings?: Record<'full' | 'head', WrapperReadings>): {
|
|
158
159
|
full: LayerSet; head: LayerSet; single: boolean; visibility?: PartVisibility;
|
|
159
160
|
} {
|
|
160
161
|
const problems: Problem[] = [];
|
|
161
162
|
let recorded: ReturnType<typeof readRunVisibility>;
|
|
162
|
-
const one = (path: string, verify
|
|
163
|
+
const one = (path: string, verify: boolean, readings?: WrapperReadings): LayerSet | null => {
|
|
163
164
|
try {
|
|
164
165
|
if (verify && !/\.psd$/i.test(path) && existsSync(path)) {
|
|
165
|
-
const
|
|
166
|
+
const isDirectory = statSync(path).isDirectory();
|
|
167
|
+
const wrapperDir = isDirectory ? path : basename(path) === 'layers.json' ? dirname(path) : undefined;
|
|
166
168
|
if (wrapperDir !== undefined) {
|
|
167
|
-
recorded = readRunVisibility(wrapperDir);
|
|
168
|
-
if (recorded !== undefined)
|
|
169
|
+
recorded = readRunVisibility(wrapperDir, readings);
|
|
170
|
+
if (recorded !== undefined) {
|
|
171
|
+
// Visibility takes the wrapper directory even when the CLI names its manifest.
|
|
172
|
+
if (readings?.manifest !== undefined) readings.manifest.givenAsDirectory = isDirectory;
|
|
173
|
+
return recorded.set;
|
|
174
|
+
}
|
|
169
175
|
}
|
|
170
176
|
}
|
|
171
|
-
return readLayers(path);
|
|
177
|
+
return readLayers(path, undefined, readings);
|
|
172
178
|
} catch (err) {
|
|
173
179
|
if (err instanceof PartsError) {
|
|
174
180
|
problems.push(...err.problems);
|
|
@@ -177,8 +183,8 @@ export function readRuns(full: string, head: string | null, recordVisibility = f
|
|
|
177
183
|
throw err;
|
|
178
184
|
}
|
|
179
185
|
};
|
|
180
|
-
const f = one(full, recordVisibility);
|
|
181
|
-
const h = head === null ? f : one(head);
|
|
186
|
+
const f = one(full, recordVisibility, wrapperReadings?.full);
|
|
187
|
+
const h = head === null ? f : one(head, false, wrapperReadings?.head);
|
|
182
188
|
if (problems.length > 0) throw new PartsError(problems);
|
|
183
189
|
const runs = { full: f as LayerSet, head: h as LayerSet, single: head === null };
|
|
184
190
|
if (recorded === undefined) return runs;
|
|
@@ -538,12 +544,12 @@ export function frontOrdered<T extends { record: { name: string } }>(items: read
|
|
|
538
544
|
|
|
539
545
|
/** Bind the pure owner reading to the exact stage inputs. */
|
|
540
546
|
function sourceCoverSet(result: AssembleResult, set: string | null, painting: string,
|
|
541
|
-
runs: ReturnType<typeof readRuns>): SourceCoverSet {
|
|
547
|
+
runs: ReturnType<typeof readRuns>, wrapperReadings?: Record<'full' | 'head', WrapperReadings>): SourceCoverSet {
|
|
542
548
|
const inputs: SourceCoverSet['inputs'] = [];
|
|
543
549
|
for (const run of (runs.single ? ['full'] : ['full', 'head']) as Array<'full' | 'head'>) {
|
|
544
550
|
const layers = runs[run];
|
|
545
551
|
inputs.push({ run, file: basename(layers.source),
|
|
546
|
-
sha256: createHash('sha256').update(readFileSync(layers.source)).digest('hex'),
|
|
552
|
+
sha256: wrapperReadings?.[run].manifest?.sha256 ?? createHash('sha256').update(readFileSync(layers.source)).digest('hex'),
|
|
547
553
|
layers: layers.layers.map(layer => ({ layer: layer.name,
|
|
548
554
|
image: layer.file === null ? null : relative(dirname(layers.source), layer.file).split(sep).join('/') })) });
|
|
549
555
|
}
|
|
@@ -554,7 +560,9 @@ function sourceCoverSet(result: AssembleResult, set: string | null, painting: st
|
|
|
554
560
|
}
|
|
555
561
|
|
|
556
562
|
/** Read, assemble, and write only after every refusal has had its chance. Throws a PartsError on a refusal, having written nothing. */
|
|
557
|
-
export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs, log: Log
|
|
563
|
+
export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs, log: Log,
|
|
564
|
+
onWrapperReadings?: (readings: AssembleWrapperReadings) => void,
|
|
565
|
+
): AssembleResult {
|
|
558
566
|
// A --requirements file that reaches assembly must be the one config.requirements
|
|
559
567
|
// names (#1418), so the assembly reading sees what assemble read.
|
|
560
568
|
const requirementsFile = input.requirements === undefined ? null : readRequirements(input.requirements);
|
|
@@ -570,7 +578,15 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
570
578
|
const { seam, project } = effectiveAssemblyRules(cfg.assemble, input);
|
|
571
579
|
const { requirements, effectiveSetup } = resolveAssemblyRequirements(input, cfg, project, requirementsFile);
|
|
572
580
|
const src = readSource(input.source);
|
|
573
|
-
const
|
|
581
|
+
const cliAlts = input.alts ?? [];
|
|
582
|
+
const wrapperReadings: AssembleWrapperReadings | undefined = onWrapperReadings === undefined
|
|
583
|
+
? undefined
|
|
584
|
+
: {
|
|
585
|
+
full: { pngs: [] },
|
|
586
|
+
head: { pngs: [] },
|
|
587
|
+
...(cliAlts.length === 0 ? {} : { alts: cliAlts.map(() => ({ full: { pngs: [] }, head: { pngs: [] } })) }),
|
|
588
|
+
};
|
|
589
|
+
const read = readRuns(input.full, input.head, true, wrapperReadings);
|
|
574
590
|
// Issue #946: every declared receipt is held to its file, and under `required` every edited image needs one, before anything is assembled.
|
|
575
591
|
const receipts = readEditorReceipts(cfg.assemble.editor_receipts, input.config);
|
|
576
592
|
const editedParts = readEditedParts(cfg.assemble.edited_parts, input.config, cfg.assemble.plan ?? []);
|
|
@@ -603,16 +619,20 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
603
619
|
if (boundPlates.length > 0) result.parts.occluder_plates = boundPlates;
|
|
604
620
|
}
|
|
605
621
|
|
|
606
|
-
const sourceCoverSets = [sourceCoverSet(result, null, input.source, read)];
|
|
622
|
+
const sourceCoverSets = [sourceCoverSet(result, null, input.source, read, wrapperReadings)];
|
|
607
623
|
|
|
608
624
|
// Issue #454: alternate painting sets, assembled before any file is written.
|
|
609
625
|
const configDir = dirname(resolve(input.config));
|
|
610
|
-
const cliAlts = input.alts ?? [];
|
|
611
626
|
const cfgAlts = cfg.assemble.alternates ?? [];
|
|
612
627
|
const cliByName = new Map<string, AlternateCliInput>();
|
|
613
|
-
|
|
628
|
+
const cliIndexByName = new Map<string, number>();
|
|
629
|
+
cliAlts.forEach((a, idx) => {
|
|
630
|
+
cliByName.set(a.name, a);
|
|
631
|
+
cliIndexByName.set(a.name, idx);
|
|
632
|
+
});
|
|
614
633
|
const mergedAlts: Array<{
|
|
615
634
|
name: string;
|
|
635
|
+
cliIndex?: number;
|
|
616
636
|
base_anchor?: NonNullable<typeof cfg.assemble.alternates>[number]['base_anchor'];
|
|
617
637
|
at: string;
|
|
618
638
|
source?: string;
|
|
@@ -634,6 +654,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
634
654
|
if (cli !== undefined) cliByName.delete(a.name);
|
|
635
655
|
return {
|
|
636
656
|
name: a.name,
|
|
657
|
+
...(cli === undefined ? {} : { cliIndex: cliIndexByName.get(cli.name) }),
|
|
637
658
|
base_anchor: a.base_anchor,
|
|
638
659
|
at: `config.assemble.alternates[${i}] (set "${a.name}")`,
|
|
639
660
|
source: cli?.source ?? (a.source === undefined ? undefined : resolve(configDir, a.source)),
|
|
@@ -655,6 +676,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
655
676
|
for (const cli of cliByName.values()) {
|
|
656
677
|
mergedAlts.push({
|
|
657
678
|
name: cli.name,
|
|
679
|
+
cliIndex: cliIndexByName.get(cli.name),
|
|
658
680
|
at: `--alt ${cli.name}`,
|
|
659
681
|
source: cli.source,
|
|
660
682
|
full: cli.full,
|
|
@@ -760,7 +782,8 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
760
782
|
const invalidFocus = setFocusProblems(alt.focus, `${alt.at}.focus`, [altSrc.width, altSrc.height]);
|
|
761
783
|
if (invalidFocus.length > 0) { altProblems.push(...invalidFocus); continue; }
|
|
762
784
|
}
|
|
763
|
-
const
|
|
785
|
+
const altWrapperReadings = alt.cliIndex === undefined ? undefined : wrapperReadings?.alts?.[alt.cliIndex];
|
|
786
|
+
const altRuns = readRuns(alt.full, alt.head ?? null, true, altWrapperReadings);
|
|
764
787
|
altProblems.push(...missingReceipts(receipts, [...editedRunImages(altRuns, `alternate set "${alt.name}" `), ...editedConfigImages(input.config, alt.cuts ?? [], undefined, `${alt.at}.cuts`)]));
|
|
765
788
|
const hidesSet = new Set(alt.hides ?? []);
|
|
766
789
|
const declaredSlots = alt.parts !== undefined ? alt.parts.filter((p) => !hidesSet.has(p)) : baseSlots.filter((p) => !hidesSet.has(p));
|
|
@@ -1170,6 +1193,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
1170
1193
|
}
|
|
1171
1194
|
}
|
|
1172
1195
|
|
|
1196
|
+
if (wrapperReadings !== undefined) onWrapperReadings?.(wrapperReadings);
|
|
1173
1197
|
// Emit only after green: every refusal above has already thrown.
|
|
1174
1198
|
if (input.resetBuildOutput === true) resetBuildOutput(dirname(outs.partsJson));
|
|
1175
1199
|
makeOutDir(outs.partsDir);
|
package/src/clipstretch.ts
CHANGED
|
@@ -90,7 +90,6 @@ export function checkClipStretch(scene: string, scratch: string, rigc: RigcRunne
|
|
|
90
90
|
}
|
|
91
91
|
for (const row of readSliderStretch(build, bindings, provide)?.rows ?? []) {
|
|
92
92
|
log(sliderStretchLine(row));
|
|
93
|
-
if (row.status === 'FAIL') passed = false;
|
|
94
93
|
}
|
|
95
94
|
} catch (err) {
|
|
96
95
|
if (!(err instanceof api.CandidateAtlasError || err instanceof api.CandidatePairError || err instanceof api.CoreInputError ||
|
package/src/configwrite.ts
CHANGED
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { PlanProposal } from './assemble.ts';
|
|
12
12
|
import type { HeadBoxProposal } from './headbox.ts';
|
|
13
|
-
import type { CharacterConfig } from './config.ts';
|
|
14
13
|
import { orderedEditedPartReceipt, type EditedPartReceipt } from './editedparts.ts';
|
|
15
14
|
import type { Proposal, PROPOSAL_CONFIG_SECTIONS } from './propose.ts';
|
|
16
15
|
import { PartsError } from './errors.ts';
|
|
17
|
-
import { parseConfig, parseEarlyConfig, parseProposalSections } from './config.ts';
|
|
16
|
+
import { type CharacterConfig, parseConfig, parseEarlyConfig, parseProposalSections } from './config.ts';
|
|
18
17
|
import type { ConfigEdit } from './meshdraft.ts';
|
|
19
18
|
|
|
20
19
|
/** Required point fields and optional shape fields of `meshes.<part>.contour.bust`, in the shorthand order `src/config.ts` validates (issues #475, #1428). */
|