rig-parts 2.56.0 → 2.57.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/README.md +44 -134
- package/cli.ts +55 -9
- package/docs/AUTHORING.md +120 -16
- package/docs/STABILITY.md +70 -9
- package/package.json +1 -1
- package/src/build.ts +27 -8
- package/src/bustlandmarks.ts +118 -22
- package/src/check.ts +9 -9
- package/src/config.ts +134 -3
- package/src/configrelocation.ts +3 -0
- package/src/depthworkflow.ts +7 -1
- package/src/outputpaths.ts +107 -0
- package/src/rig.ts +56 -5
- package/src/runstamp.ts +176 -19
- package/src/turn.ts +225 -2
- package/src/turnoverlap.ts +23 -0
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="
|
|
2
|
+
<img src="assets/banner.svg" alt="@rig-c/parts — 2D character parts, weighted meshes and bone chains from one painting" width="100%" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
@@ -24,47 +24,26 @@ numeric findings, a refusal names the object, the value found and the value
|
|
|
24
24
|
required, nothing is written after a red, and no value is invented where the
|
|
25
25
|
input is silent.
|
|
26
26
|
|
|
27
|
+
New to the rig-c toolchain? The [getting-started guide](https://github.com/rig-c/getting-started#the-whole-thing-in-one-glance) shows what each package takes and gives.
|
|
28
|
+
|
|
27
29
|
## What you get
|
|
28
30
|
|
|
29
31
|
<p align="center">
|
|
30
|
-
<img src="
|
|
31
|
-
<img src="
|
|
32
|
+
<img src="assets/demo-source.png" alt="The demo painting: a generated full-body character in a white and pink idol dress with a layered skirt and long pink twin tails, standing with her arms held away from her body and her hands open" height="420" />
|
|
33
|
+
<img src="assets/demo-idle.png" alt="The same character rigged, breathing, blinking once and swaying her hair, sleeves and skirt in a 3.3-second loop" height="420" />
|
|
32
34
|
</p>
|
|
33
35
|
|
|
34
36
|
<p align="center">
|
|
35
|
-
<img src="
|
|
37
|
+
<img src="assets/demo-parts.png" alt="Contact sheet of the painting and the 23 assembled parts it was split into: hair, sleeves, legs, boots, neck, skirt, bodice, earrings, hair ornaments, ears, face, brows, mouth and eyes" width="100%" />
|
|
36
38
|
</p>
|
|
37
39
|
|
|
38
40
|
<p align="center"><em>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
record,
|
|
43
|
-
<a href="
|
|
44
|
-
|
|
45
|
-
Then one command: <code>rig-parts build --loop --lead-in 3</code>. The proposer's bones, meshes,
|
|
46
|
-
regions and motion were used as proposed but for one correction, written in the
|
|
47
|
-
config beside the values it replaced: the two outer skirt chains were moved out to
|
|
48
|
-
0.8 of the skirt's half-width (the proposal's, within 90 px of the centre of a skirt
|
|
49
|
-
449 px wide, swung it about its middle and failed <code>TIP_OVER_ROOT</code>, 0.442
|
|
50
|
-
against 1.4725; moved, 2.425). One input-stage edit: <code>hair_back</code> is taken
|
|
51
|
-
from the full run, because the twin tails leave the head crop sideways (a plan edit).
|
|
52
|
-
<code>check</code> printed, verbatim:<br/>
|
|
53
|
-
<code>50 assertions: 24 measured (24 passed, 0 failed), 26 skipped, 0 not in profile "rig-play"</code><br/>
|
|
54
|
-
<code>loop: idle 41 frame(s) at 12 fps, f0000 vs f0040 (t = 3.333333333333333s) with the rig's 29 physics constraint(s) left out (named on the `loop physics:` line; rendered with them, the ends need not meet — `build --loop --lead-in <n>`): max |d| 0 (0 required)</code><br/>
|
|
55
|
-
<code>seam: setup pose at 654x1216, scale 0.9438: mean |d| 0.147 (<= 1.0), 0 px over 40, 0.00 rig px (the count / s²; <= 50), 0 px over 80 (reported)</code><br/>
|
|
56
|
-
<code>pack: skeleton.png 1051x972, 23 region(s), 96.9% covered, padding 2, page edges free, shape polygon</code><br/>
|
|
57
|
-
The loop is that build's indexed APNG, 40 frames at 12 fps, 703,909 bytes, one
|
|
58
|
-
256-entry palette at a measured error of max 71, mean 0.636 per channel over every
|
|
59
|
-
frame (the lossless APNG beside it, the exactness record, is 4,449,233 bytes; the
|
|
60
|
-
GIF, at the same error, 760,058). The rig's hair, skirt, sleeves, bows and earrings
|
|
61
|
-
carry physics, which rigc's render starts from rest, so the idle is played three
|
|
62
|
-
periods ahead and the loop is the fourth: the frame one period after its first differs
|
|
63
|
-
from it by max 1 level, 0 px over 40 (<code>--lead-in</code>). Frame 29 (2.417 s) is the
|
|
64
|
-
closed eye: the blink holds for 0.084 s, one 12 fps frame rounded up; the painting is
|
|
65
|
-
shown at half size, resampled and written by this package's PNG codec (nothing here
|
|
66
|
-
encodes JPEG). <code>rig-parts sheet</code> made the contact sheet. Its
|
|
67
|
-
<code>expected/</code> is this port's own build (<a href="https://github.com/rig-c/parts/blob/main/examples/demo/README.md">examples/demo</a>).
|
|
41
|
+
A painting generated for this repository, split by See-through twice (the whole figure and
|
|
42
|
+
a square head crop), then built by one command: <code>rig-parts build --loop --lead-in 3</code>.
|
|
43
|
+
The proposer's bones, meshes, regions and motion were used as proposed but for one
|
|
44
|
+
correction. The generation record, the correction, the lines <code>check</code> printed and the
|
|
45
|
+
loop's encoding figures are in <a href="examples/demo/README.md">examples/demo</a>; the layers
|
|
46
|
+
and licence are in <a href="https://github.com/rig-c/examples">rig-c/examples</a>.
|
|
68
47
|
</em></p>
|
|
69
48
|
|
|
70
49
|
<p align="center"><em>
|
|
@@ -74,7 +53,7 @@ with its proposal used unedited — the only hand corrections are four
|
|
|
74
53
|
<code>assemble.patches</code>, each answering an <code>uncovered hole</code> line.
|
|
75
54
|
<code>check</code> passes 9 of 9 with every mesh on the lattice and with every mesh
|
|
76
55
|
switched to the contour mode. It has no reference output: its <code>expected/</code>
|
|
77
|
-
is this port's own build (<a href="
|
|
56
|
+
is this port's own build (<a href="examples/scarf/README.md">examples/scarf</a>).
|
|
78
57
|
</em></p>
|
|
79
58
|
|
|
80
59
|
<p align="center"><em>
|
|
@@ -147,26 +126,12 @@ build: PASS — the packed atlas is the artifact; parts/ and rig/ are the interm
|
|
|
147
126
|
out/check/build/skeleton.png
|
|
148
127
|
```
|
|
149
128
|
|
|
150
|
-
The page's edges are free by default: rigc picks the least-area page the parts need,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
`filter: Linear, Linear` and has no `repeat` line, so `--page-edges pot` is for a
|
|
157
|
-
consumer that mipmaps or repeats the page; it writes exactly the page builds wrote
|
|
158
|
-
before the flag existed. The measurements are in
|
|
159
|
-
[AUTHORING §5, *Page edges*](docs/AUTHORING.md#5-after-each-stage-what-to-read).
|
|
160
|
-
|
|
161
|
-
The pack shape is `polygon` by default (rig-c 2.1): a region only meshes draw is
|
|
162
|
-
packed by its emitted hull, so a neighbour may sit inside its rectangle where the hull
|
|
163
|
-
is not; a region attachment stays its rectangle. On the two examples that takes the
|
|
164
|
-
free page from 967x1338 to 922x1348 (covered 91.2 % to 95.0 %, 3.9 % less area) and
|
|
165
|
-
from 479x1166 to 477x1151 (93.4 % to 95.0 %, 1.7 % less), at the cost class `free`
|
|
166
|
-
already has: every idle frame within 1 level of the `rect` build's, and no figure in
|
|
167
|
-
`check.json` but `pack_mode` moves. `--pack-shape rect` writes the page and atlas
|
|
168
|
-
0.7.0 wrote. The measurements are in
|
|
169
|
-
[AUTHORING §5, *Pack shape*](docs/AUTHORING.md#5-after-each-stage-what-to-read).
|
|
129
|
+
The page's edges are free by default: rigc picks the least-area page the parts need, not
|
|
130
|
+
the next power of two; `--page-edges pot` is for a consumer that mipmaps or repeats the
|
|
131
|
+
page. The pack shape is `polygon` by default: a region only meshes draw is packed by its
|
|
132
|
+
emitted hull; `--pack-shape rect` packs every region by its rectangle. What each costs and
|
|
133
|
+
saves, measured on the reference examples, is in
|
|
134
|
+
[AUTHORING §5, *Page edges*](docs/AUTHORING.md#5-after-each-stage-what-to-read) and *Pack shape*.
|
|
170
135
|
|
|
171
136
|
The packer is rig-c's, and no other: a packed region is a lossless copy, and an
|
|
172
137
|
atlas written by anything else would have no oracle behind it.
|
|
@@ -197,21 +162,15 @@ rig-parts at what it wrote:
|
|
|
197
162
|
| Upstream CLI | `python inference/scripts/inference_psd.py --srcp <image> --save_to_psd` in a checkout of [shitagaki-lab/see-through](https://github.com/shitagaki-lab/see-through) | the `.psd` in `workspace/layerdiff_output/` |
|
|
198
163
|
| ComfyUI wrapper | [jtydhr88/ComfyUI-See-through](https://github.com/jtydhr88/ComfyUI-See-through) on your own ComfyUI box; the optional `comfy` adapter (`rig-parts comfy seethrough`) drives it | the `layers.json` + PNGs it writes |
|
|
199
164
|
|
|
200
|
-
Use the square `inputs` outputs on the Space too.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
pads a non-square upload before resizing; the centre-crop reported in
|
|
204
|
-
[#356](https://github.com/rig-c/parts/issues/356) is not the current source path.
|
|
205
|
-
`st_input_full.png` supplies the explicit white padding that rig-parts maps back
|
|
206
|
-
to the original painting. This is a source inspection, not a new demo run.
|
|
165
|
+
Use the square `inputs` outputs on the Space too: `st_input_full.png` supplies the white
|
|
166
|
+
padding rig-parts maps back to the original painting
|
|
167
|
+
([source reading](docs/AUTHORING.md#see-through-space-input-source-reading)).
|
|
207
168
|
|
|
208
169
|
The [head-run source reading](docs/AUTHORING.md#see-through-head-run-source-reading) explains why a separate head crop is needed.
|
|
209
170
|
|
|
210
171
|
**See-through is required; ComfyUI is not.** The wrapper is one route among
|
|
211
172
|
four, and `rig-parts comfy` is only a convenience for that route: every
|
|
212
|
-
stage after See-through reads files, whichever route wrote them.
|
|
213
|
-
reference examples each run took 171–199 s through the wrapper, and on the demo 179 s (each run's
|
|
214
|
-
`meta.json`, in [rig-c/examples](https://github.com/rig-c/examples)).
|
|
173
|
+
stage after See-through reads files, whichever route wrote them.
|
|
215
174
|
|
|
216
175
|
### The two images See-through is fed: `inputs`
|
|
217
176
|
|
|
@@ -255,19 +214,10 @@ sources and records their declared terms; those declarations do not assign a
|
|
|
255
214
|
blanket licence to output images. The graph's automatic upscaler selection is
|
|
256
215
|
unchanged; the owner decision is tracked separately in [#428](https://github.com/rig-c/parts/issues/428).
|
|
257
216
|
|
|
258
|
-
`--offload` selects the wrapper's CUDA group-offload path on the **ComfyUI host
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
path; it is not a claim that the remaining model stack has been verified on MPS.
|
|
263
|
-
|
|
264
|
-
The [wrapper README at `98d754b`](https://github.com/jtydhr88/ComfyUI-See-through/blob/98d754bf04f668647919ab750eccb0e0640faa81/README.md#L22-L28)
|
|
265
|
-
describes a combined Decompose node and names `24yearsold/seethroughv0.0.1_marigold`
|
|
266
|
-
for depth. The shipped `workflows/seethrough.json` instead sends
|
|
267
|
-
`SeeThrough_GenerateLayers`, `SeeThrough_GenerateDepth` and `SeeThrough_PostProcess`,
|
|
268
|
-
and selects `layerdifforg/seethroughv0.0.1_marigold`, matching the wrapper's
|
|
269
|
-
[implemented depth default](https://github.com/jtydhr88/ComfyUI-See-through/blob/98d754bf04f668647919ab750eccb0e0640faa81/nodes.py#L82-L85).
|
|
270
|
-
Use the graph's node classes and the host's `/object_info` when checking the adapter.
|
|
217
|
+
`--offload` selects the wrapper's CUDA group-offload path on the **ComfyUI host**; omit it
|
|
218
|
+
for a local Mac/MPS host. The source reading behind it, and how the shipped graph differs
|
|
219
|
+
from the wrapper's README, are in
|
|
220
|
+
[AUTHORING, *The optional ComfyUI adapter*](docs/AUTHORING.md#source-readings-for-the-see-through-graph).
|
|
271
221
|
|
|
272
222
|
## The loop, for an agent
|
|
273
223
|
|
|
@@ -302,7 +252,7 @@ rig-parts build --config config.json --source painting.png --full layers/full --
|
|
|
302
252
|
At each step the config holds only what that step reads; the one table of what
|
|
303
253
|
that is, step by step, is [docs/AUTHORING.md §4](docs/AUTHORING.md#4-the-command-order).
|
|
304
254
|
How the selftest runs this block on each example is in
|
|
305
|
-
[CONTRIBUTING.md](
|
|
255
|
+
[CONTRIBUTING.md](CONTRIBUTING.md#the-readme-loop-as-the-selftest-runs-it).
|
|
306
256
|
|
|
307
257
|
`propose` is deliberately not a step of `build`: the proposal is a draft to correct
|
|
308
258
|
against its overlay, and a config with bones is `build`'s input. `rig`, `check` and
|
|
@@ -424,67 +374,27 @@ for each — a config fragment, the `check` lines it passes with, and its limit:
|
|
|
424
374
|
swapped for another; `check` measures the idle alone.
|
|
425
375
|
- [**A soft region driven by physics**](docs/AUTHORING.md#recipe-a-soft-region-driven-by-physics)
|
|
426
376
|
(a bust, the hips): a bone the config authors, a contour-mode region that hands it the patch,
|
|
427
|
-
and a `physics` constraint on it; `examples/reference-sample` carries one.
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
bust up to 6.702 and the hips up to 4.609 rig px; the region's `band` caps how far a patch may
|
|
431
|
-
go before the texture-stretch ceiling, and `check` measures the idle alone.
|
|
377
|
+
and a `physics` constraint on it; `examples/reference-sample` carries one. The spring
|
|
378
|
+
answers faster keys on the body more than a slow idle, the region's `band` caps how far a
|
|
379
|
+
patch may go before the texture-stretch ceiling, and `check` measures the idle alone.
|
|
432
380
|
|
|
433
381
|
### How much of a rig the model painted
|
|
434
382
|
|
|
435
|
-
`parts.json` splits each part's opaque pixels
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
| | opaque px | occluded | visible, not projected | taken from the painting |
|
|
443
|
-
| --- | --- | --- | --- | --- |
|
|
444
|
-
| `demo` | 362,441 | 69,098 (19.1 %) | 67,164 (18.5 %) | 226,179 (62.4 %) |
|
|
445
|
-
| `scarf` | 283,813 | 78,503 (27.7 %) | 56,699 (20.0 %) | 148,611 (52.4 %) |
|
|
446
|
-
| `reference-sample` | 298,363 | 79,122 (26.5 %) | 35,979 (12.1 %) | 183,262 (61.4 %) |
|
|
447
|
-
| `reference-demo` | 765,924 | 202,343 (26.4 %) | 75,626 (9.9 %) | 487,955 (63.7 %) |
|
|
448
|
-
|
|
449
|
-
The occluded share is art the painting does not show — a back-hair layer, a neck, the
|
|
450
|
-
parts of an ear under the hair — and is See-through's synthesis by necessity; it is
|
|
451
|
-
what the decomposition is for. The visible-but-not-projected share is synthesis where
|
|
452
|
-
the painting was there to be taken: a part too thin for the reference rule's 5x5
|
|
453
|
-
eroded core, an anti-aliased fringe below alpha 250, a rim beside a layer in front, a
|
|
454
|
-
pixel refused for drift. `--project visible` keeps the erosion only along a rim with a
|
|
455
|
-
layer in front, which takes that share to 22,476 (7.5 %) on `reference-sample` and 49,672 (6.5 %)
|
|
456
|
-
on `reference-demo` (from the `parts.json` of a `--project visible` build). On the eleven thin
|
|
457
|
-
head parts — brows, lashes, irises, eye whites, ears, mouth — it takes 296 of
|
|
458
|
-
`reference-sample`'s 1,289 visible pixels where `core` takes 110, and 824 of `reference-demo`'s 2,162
|
|
459
|
-
where `core` takes 343. What neither rule takes is the fringe: a per-pixel
|
|
460
|
-
classification of those parts under `visible`, recorded with the change that added
|
|
461
|
-
the flag, puts 813 of `reference-sample`'s 993 still-unprojected pixels and 879 of `reference-demo`'s
|
|
462
|
-
1,338 below alpha 250. Where such a fringe keeps the stack off the painting and a part
|
|
463
|
-
beneath holds the pixel in the painting's colour, `assemble` clears it instead, and
|
|
464
|
-
the assemble line and `parts.json` say how many pixels, of which part, over which
|
|
465
|
-
(AUTHORING §5, *The fringe push-back*; the figures in this section were measured
|
|
466
|
-
before it, at v0.14.0, but for the `demo` row, which is its `expected/parts.json`
|
|
467
|
-
as this port wrote it in issue #227).
|
|
383
|
+
`parts.json` splits each part's opaque pixels into `visible_px` and `occluded_px`, and
|
|
384
|
+
counts the visible ones whose colour was not taken from the painting
|
|
385
|
+
(`visible_not_projected_px`). The occluded share is art the painting does not show — a
|
|
386
|
+
back-hair layer, a neck — and is See-through's synthesis by necessity. The figures for the
|
|
387
|
+
four examples, and what `--project visible` changes, are in
|
|
388
|
+
[AUTHORING §5](docs/AUTHORING.md#how-much-of-a-rig-the-model-painted).
|
|
468
389
|
|
|
469
390
|
## Requirements
|
|
470
391
|
|
|
471
|
-
[Bun](https://bun.sh) 1.4 or later
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
beside `rig-parts` for the transition, the same launcher under both names. On npm
|
|
478
|
-
both compatibility names stay published beside `@rig-c/parts` at every version, as aliases
|
|
479
|
-
carrying the same files with only the `name` in `package.json` changed, so a
|
|
480
|
-
project that depends on either keeps receiving every release; a new
|
|
481
|
-
install names `@rig-c/parts` ([RELEASING.md](https://github.com/rig-c/parts/blob/main/RELEASING.md), *The registry side*). `@rig-c/core`
|
|
482
|
-
comes with it as a dependency, providing the `rigc` command. No Spine runtime does: since
|
|
483
|
-
rig-c 2.0 the installed `rigc` gates every build with its own validator over the
|
|
484
|
-
compiled model document, and `rigc --version` says `entry: cli_core.ts —
|
|
485
|
-
@esotericsoftware/spine-core absent`. With `@esotericsoftware/spine-core` installed
|
|
486
|
-
beside it, the same `rigc` runs the spine-core round trip instead, as this repository's
|
|
487
|
-
selftest and CI do; `check.json`'s `rigc_entry` records which one gated a build.
|
|
392
|
+
[Bun](https://bun.sh) 1.4 or later. `npm i -D @rig-c/parts` installs the `rig-parts`
|
|
393
|
+
command (`npm install -g @rig-c/parts` puts it on `PATH`); it hands off to Bun and says
|
|
394
|
+
so in one sentence if Bun is not on `PATH`. `@rig-c/core` comes with it as a dependency,
|
|
395
|
+
providing the `rigc` command; no Spine runtime does. [docs/STABILITY.md](docs/STABILITY.md#rig-c)
|
|
396
|
+
says what this package relies on in rig-c and which validator gates an install, and
|
|
397
|
+
[RELEASING.md](RELEASING.md#three-names-one-tree) covers the package's earlier install names.
|
|
488
398
|
|
|
489
399
|
## Licence posture
|
|
490
400
|
|
|
@@ -493,7 +403,7 @@ MIT; see [NOTICE.md](NOTICE.md) for third-party terms and the Spine runtime lice
|
|
|
493
403
|
## Development
|
|
494
404
|
|
|
495
405
|
`bun install`, then `bun run typecheck`, `bun run lint` and `bun run selftest`.
|
|
496
|
-
[CONTRIBUTING.md](
|
|
406
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) has every command and what a change has to clear; [CLAUDE.md](CLAUDE.md) is the doctrine, [RELEASING.md](RELEASING.md) the cut, [docs/STABILITY.md](docs/STABILITY.md) the interface it holds.
|
|
497
407
|
|
|
498
408
|
## Licence
|
|
499
409
|
|
package/cli.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { DIFF_DRAFTS_SPEC, diffDraftsCommand } from './src/diffdrafts.ts';
|
|
|
5
5
|
import { applyTakenLayers } from './src/takelayers.ts';
|
|
6
6
|
import { applyDepth, bindDepthMap, prepareDepth } from './src/depthworkflow.ts';
|
|
7
7
|
import { externalReceipt } from './src/externalreceipt.ts';
|
|
8
|
-
import { BUST_LANDMARKS_ACT_SCHEMA, BUST_LANDMARKS_PROVENANCE_SPEC, BUST_LANDMARKS_PROVENANCE_SUFFIX, BUST_POINT_SHAPE_FIELDS, bustShapeClause, type BustSidecar, effectiveBustShape, planBustLandmarks, readBustSidecar, stageBustLandmarks, stageReplacements, type StagedBustLandmarks } from './src/bustlandmarks.ts';
|
|
8
|
+
import { BUST_LANDMARKS_ACT_SCHEMA, BUST_LANDMARKS_COMMENT_ACT_SCHEMA, BUST_LANDMARKS_PROVENANCE_SPEC, BUST_LANDMARKS_PROVENANCE_SUFFIX, BUST_POINT_SHAPE_FIELDS, bustShapeClause, type BustSidecar, effectiveBustShape, planBustLandmarks, readBustSidecar, stageBustLandmarks, stageReplacements, type StagedBustLandmarks } from './src/bustlandmarks.ts';
|
|
9
9
|
import { writeEditedPart } from './tools/edited-part-cli.ts';
|
|
10
10
|
/**
|
|
11
11
|
* rig-parts — one painting and its See-through layers in, Spine-ready parts
|
|
@@ -27,7 +27,7 @@ import { basename, dirname, extname, join, resolve } from 'node:path';
|
|
|
27
27
|
import { DEFAULT_PROJECT_RULE, DEFAULT_SEAM_RULE, headGarmentOverlaps, headGarmentWarning, HOLES_LISTED, PROJECT_RULES, type ProjectRule, proposeFields, proposePlan, proposeSinglePlan, SEAM_RULES, type SeamRule } from './src/assemble.ts';
|
|
28
28
|
import { proposeNeck } from './tools/neck-propose.ts';
|
|
29
29
|
import { parseAltArg } from './tools/alternate-cli.ts';
|
|
30
|
-
import { type AlternateCliInput, assembleStage, build, checkStage, emitFillMasksStage, ERROR_MAP_FILE, loopStage, readRuns, readSource, rigStage, suppliedCheckFlag } from './src/build.ts';
|
|
30
|
+
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';
|
|
31
31
|
import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, PACK_PAGE_SIZE, PACK_SHAPES, rigcRunnerAt, type PackShape, PAGE_EDGES, type PageEdges, parsePageSize, PARTS_HOME_SENTENCE, RIGC_GEOMETRY_VERSION, rigcRanClause, type RigcRunner, NO_PARTS_SENTENCE, SEAM_MEAN_BAR, SOURCE_SENTENCE, SEAM_PX_BAR, SEAM_PX_LEVEL, SPINEBOY_YARDSTICK, TEXTURE_STRETCH_CEILING } from './src/check.ts';
|
|
32
32
|
import { ComfyClient, resolveHost, runBackground, runMatte, runPainting, runSeeThrough } from './src/comfy/index.ts';
|
|
33
33
|
import { coreCfg, DEFAULT_GROW_PX, runForeground } from './src/plate.ts';
|
|
@@ -56,7 +56,7 @@ import { REQUIREMENTS_SENTENCE } from './src/requirements.ts';
|
|
|
56
56
|
import { composeStage, IMAGE_SEP, PLATE, PROVENANCES, SCENE_REPORT_FILE, SCENE_REPORT_SPEC, SCENE_SPEC } from './src/scene.ts';
|
|
57
57
|
import { buildSheet, defaultCaption, type Tile, tilesFrom } from './src/sheet.ts';
|
|
58
58
|
import { loadComparison, requiredProblems, structureLines } from './src/structure.ts';
|
|
59
|
-
import { assembleOutputFiles, clearComposeRun, clearRunStamp, readPackageIdentity, rigOutputFiles, RUN_STAMP_FILE, RUN_STAMP_SPEC, writeRunStamp } from './src/runstamp.ts';
|
|
59
|
+
import { type ArgvTable, assembleOutputFiles, BUILD_RUN_FILE, CHECK_RUN_FILE, clearComposeRun, clearRunRecord, clearRunStamp, readPackageIdentity, recordArgv, rigOutputFiles, RUN_STAMP_FILE, RUN_STAMP_SPEC, writeRunRecord, writeRunStamp } from './src/runstamp.ts';
|
|
60
60
|
import { authorLayerLine } from './src/tags.ts';
|
|
61
61
|
|
|
62
62
|
const EXIT_OK = 0;
|
|
@@ -389,10 +389,13 @@ usage:
|
|
|
389
389
|
rig-parts bust-landmarks --from-act <act.json> --parts <dir> --config <config.json> --out <landmarks.json> [--write-config]
|
|
390
390
|
Write the file propose --bust-landmarks reads (apex_r, apex_l and
|
|
391
391
|
optional cleavage, rig px) from the one chest row of a Review
|
|
392
|
-
${BUST_LANDMARKS_ACT_SCHEMA} act,
|
|
392
|
+
${BUST_LANDMARKS_ACT_SCHEMA} act, or of the one chest-landmarks carrier of a
|
|
393
|
+
${BUST_LANDMARKS_COMMENT_ACT_SCHEMA} comment-only act (its file must equal the act's
|
|
394
|
+
source.model), and <out>${BUST_LANDMARKS_PROVENANCE_SUFFIX} beside it (spec
|
|
393
395
|
"${BUST_LANDMARKS_PROVENANCE_SPEC}": the act's schema, id and
|
|
394
|
-
file sha256, the
|
|
395
|
-
|
|
396
|
+
file sha256, the carrier's file for a comment-only act, the row's
|
|
397
|
+
sha256, verified against the row's edit, the slot, the source hash and
|
|
398
|
+
frame). The row's slot must be a part of
|
|
396
399
|
parts.json whose config mesh is a contour, its frame parts.json's
|
|
397
400
|
rig_size, and its alpha, clearance, spacing, bone_r and bone_l those of
|
|
398
401
|
the config's contour.bust. --write-config instead takes those five into
|
|
@@ -630,6 +633,11 @@ usage:
|
|
|
630
633
|
[--set <name> | --all-sets] [--environment <schedule.json>]
|
|
631
634
|
[--wind-band <spec.json>] [--json]
|
|
632
635
|
--json prints the completed check.json object only, with unchanged exit codes.
|
|
636
|
+
check-run.json (rig-run/2, STABILITY) records a completed run: the package,
|
|
637
|
+
the times, every file written with its sha256, and argv, the command and
|
|
638
|
+
the options as given, each path relative to --out and --out as ".": these
|
|
639
|
+
arguments reproduce the check with the same package version, run from the
|
|
640
|
+
--out directory.
|
|
633
641
|
Build, gate, render and measure a rig through rig-c's CLI (the rigc at
|
|
634
642
|
node_modules/.bin/rigc, or on PATH). --rig holds rig.json and motion.json:
|
|
635
643
|
a rig spec, which rigc build compiles, not a compiled skeleton.json.
|
|
@@ -777,8 +785,8 @@ usage:
|
|
|
777
785
|
reads what a run without the flag reads, and wind [0, 0] is a calm, not
|
|
778
786
|
the default (AUTHORING §6, The world the readings are taken in). One
|
|
779
787
|
environment: line names the path, the step count and the sha256's first
|
|
780
|
-
16 hex; check.json's environment holds path (
|
|
781
|
-
steps. Without the flag no environment provenance key is written.
|
|
788
|
+
16 hex; check.json's environment holds path (relative to --out), sha256
|
|
789
|
+
and steps. Without the flag no environment provenance key is written.
|
|
782
790
|
Physics rigs with readable declared seam pairs also report independent
|
|
783
791
|
default wind [1, 0] and still wind [0, 0], gravity [0, 1], under
|
|
784
792
|
SEAM_OVER_MOTION.worlds: gap/ghost maximum and worst frame only;
|
|
@@ -965,6 +973,9 @@ usage:
|
|
|
965
973
|
[--idle-keys ctl|direct] [--lead-in <periods>] [--seam-pairs] [--keep-stills] [--no-extremes]
|
|
966
974
|
[--alt <name>=<source>:<full>[:<head>]] [--set <name> | --all-sets]
|
|
967
975
|
[--environment <schedule.json>] [--wind-band <spec.json>]
|
|
976
|
+
build-run.json (rig-run/2, as check-run.json for check) records a run whose
|
|
977
|
+
check completed, with argv starting "build": these arguments reproduce the
|
|
978
|
+
check with the same package version, run from the --out directory.
|
|
968
979
|
assemble, then rig, then check, in one process, each stage's own lines
|
|
969
980
|
printed under [assemble], [rig] and [check]; the first stage that refuses
|
|
970
981
|
stops the build with its own FAIL lines. The config must already carry
|
|
@@ -990,7 +1001,7 @@ usage:
|
|
|
990
1001
|
Without the flag, config.requirements (a path beside the config) is
|
|
991
1002
|
read in its place; a flag naming other bytes than the declaration is
|
|
992
1003
|
BUILD_REQUIREMENTS_CONFLICT, before assemble. check.json's
|
|
993
|
-
requirements.file records the path
|
|
1004
|
+
requirements.file records the path relative to <out>/check, its sha256
|
|
994
1005
|
and the file's keys.
|
|
995
1006
|
--environment is forwarded to check (as for check); the schedule is read
|
|
996
1007
|
by rig-c's reader before assemble runs, so a malformed one is refused,
|
|
@@ -1277,6 +1288,21 @@ const TAKES = {
|
|
|
1277
1288
|
|
|
1278
1289
|
type Command = keyof typeof TAKES;
|
|
1279
1290
|
|
|
1291
|
+
/** `check`'s flags as its `check-run.json` record writes them back (issue #1541): its {@link TAKES} row and which values are paths. */
|
|
1292
|
+
const CHECK_ARGV: ArgvTable = { ...TAKES.check, paths: ['--rig', '--out', '--parts', '--source', '--requirements', '--environment', '--wind-band'] };
|
|
1293
|
+
/** `build`'s, for `build-run.json`; `--alt` holds up to three paths after its set name. */
|
|
1294
|
+
const BUILD_ARGV: ArgvTable = {
|
|
1295
|
+
...TAKES.build,
|
|
1296
|
+
paths: ['--config', '--source', '--full', '--head', '--out', '--requirements', '--environment', '--wind-band'],
|
|
1297
|
+
compound: {
|
|
1298
|
+
'--alt': (value, path) => {
|
|
1299
|
+
const alt = parseAltArg(value);
|
|
1300
|
+
if (typeof alt === 'string') throw new Error(`run record: --alt ${JSON.stringify(value)} was accepted and no longer parses: ${alt}`);
|
|
1301
|
+
return `${alt.name}=${path(alt.source)}:${path(alt.full)}${alt.head === undefined ? '' : `:${path(alt.head)}`}`;
|
|
1302
|
+
},
|
|
1303
|
+
},
|
|
1304
|
+
};
|
|
1305
|
+
|
|
1280
1306
|
/** Whether `command` takes `flag` as a valued flag, read off its {@link TAKES} row. */
|
|
1281
1307
|
function takesValued(command: Command, flag: string): boolean {
|
|
1282
1308
|
return (TAKES[command].valued as readonly string[]).includes(flag);
|
|
@@ -1633,19 +1659,28 @@ function cmdCheck(args: string[]): number {
|
|
|
1633
1659
|
if (allSets === 1 && f.has('--set')) return usage('--set and --all-sets are two modes; give one');
|
|
1634
1660
|
const rig = f.get('--rig') as string;
|
|
1635
1661
|
const out = f.get('--out') as string;
|
|
1662
|
+
let fixedClock: string | undefined;
|
|
1663
|
+
try { fixedClock = runStampClock(); } catch (err) { return printRefusal(err); }
|
|
1636
1664
|
const edges = pageEdgesOf(f.get('--page-edges'));
|
|
1637
1665
|
if (!isPageEdges(edges)) return usage(edges);
|
|
1638
1666
|
const shape = packShapeOf(f.get('--pack-shape'));
|
|
1639
1667
|
if (!isPackShape(shape)) return usage(shape);
|
|
1640
1668
|
try {
|
|
1641
1669
|
const size = parsePageSize(f.get('--page-size'));
|
|
1670
|
+
const pkg = readPackageIdentity(join(import.meta.dir, 'package.json'));
|
|
1671
|
+
clearRunRecord(out, CHECK_RUN_FILE);
|
|
1642
1672
|
const bin = findRigc(import.meta.dir, process.env.PATH ?? '');
|
|
1673
|
+
const startedAt = fixedClock ?? new Date().toISOString();
|
|
1643
1674
|
const r = checkStage(
|
|
1644
1675
|
{ rig, parts: f.get('--parts'), source: f.get('--source'), out, pageEdges: edges, packShape: shape, ...(size === undefined ? {} : { pageSize: size }), requirements: f.get('--requirements'), seamPairs: seamPairs === 1, keepStills: keepStills === 1, noExtremes: noExtremes === 1, ...(f.has('--set') ? { set: f.get('--set') as string } : {}), allSets: allSets === 1, ...(f.has('--environment') ? { environment: f.get('--environment') as string } : {}), ...(f.has('--wind-band') ? { windBand: f.get('--wind-band') as string } : {}) },
|
|
1645
1676
|
rigcRunner(bin),
|
|
1646
1677
|
bin,
|
|
1647
1678
|
json === 1 ? () => {} : console.log,
|
|
1648
1679
|
);
|
|
1680
|
+
// Issue #1541: the record of the run, beside the report it completed; never a refusal of its own.
|
|
1681
|
+
const wrote = checkWrote(r, out);
|
|
1682
|
+
writeRunRecord({ pkg, command: 'check', startedAt, finishedAt: fixedClock ?? new Date().toISOString(), outDir: out,
|
|
1683
|
+
outputs: [...wrote.written, ...wrote.dirs.map((d) => `${d}/`)], argv: recordArgv('check', args, CHECK_ARGV, out, process.cwd()) });
|
|
1649
1684
|
if (json === 1) process.stdout.write(`${JSON.stringify(r.figures, null, 1)}\n`);
|
|
1650
1685
|
return r.figures.PASS ? EXIT_OK : EXIT_REFUSED;
|
|
1651
1686
|
} catch (err) {
|
|
@@ -2477,11 +2512,17 @@ function cmdBuild(args: string[]): number {
|
|
|
2477
2512
|
const [config, source, full, out] = ['--config', '--source', '--full', '--out'].map((f) => flags.get(f) as string);
|
|
2478
2513
|
const head = flags.get('--head') ?? null;
|
|
2479
2514
|
let bin: string;
|
|
2515
|
+
let fixedClock: string | undefined;
|
|
2516
|
+
let pkg: { name: string; version: string };
|
|
2480
2517
|
try {
|
|
2518
|
+
fixedClock = runStampClock();
|
|
2519
|
+
pkg = readPackageIdentity(join(import.meta.dir, 'package.json'));
|
|
2481
2520
|
bin = findRigc(import.meta.dir, process.env.PATH ?? '');
|
|
2482
2521
|
} catch (err) {
|
|
2483
2522
|
return printRefusal(err);
|
|
2484
2523
|
}
|
|
2524
|
+
clearRunRecord(out, BUILD_RUN_FILE);
|
|
2525
|
+
const startedAt = fixedClock ?? new Date().toISOString();
|
|
2485
2526
|
const scratch = mkdtempSync(join(tmpdir(), 'rig-parts-build-'));
|
|
2486
2527
|
try {
|
|
2487
2528
|
const r = build(
|
|
@@ -2493,6 +2534,11 @@ function cmdBuild(args: string[]): number {
|
|
|
2493
2534
|
} },
|
|
2494
2535
|
console.log,
|
|
2495
2536
|
);
|
|
2537
|
+
// Issue #1541: written whenever this build's check completed its report, green or not.
|
|
2538
|
+
if (r.check !== null) {
|
|
2539
|
+
writeRunRecord({ pkg, command: 'build', startedAt, finishedAt: fixedClock ?? new Date().toISOString(), outDir: out, configPath: config,
|
|
2540
|
+
outputs: [...BUILD_OWNS, ...BUILD_OWNS_FILES], argv: recordArgv('build', args, BUILD_ARGV, out, process.cwd()) });
|
|
2541
|
+
}
|
|
2496
2542
|
return r.stoppedAt === null ? EXIT_OK : EXIT_REFUSED;
|
|
2497
2543
|
} finally {
|
|
2498
2544
|
rmSync(scratch, { recursive: true, force: true });
|