rig-parts 1.58.0 → 1.60.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 +12 -1
- package/cli.ts +36 -2
- package/docs/AUTHORING.md +71 -4
- package/docs/MIGRATION.md +70 -0
- package/docs/STABILITY.md +5 -4
- package/package.json +1 -1
- package/src/build.ts +40 -5
- package/src/check.ts +83 -26
- package/src/config.ts +101 -6
- package/src/configwrite.ts +51 -3
- package/src/meshdraft.ts +17 -4
- package/src/parts.ts +27 -0
- package/src/rig.ts +102 -12
- package/src/scene.ts +3 -2
- package/tools/configwrite.ts +1 -1
package/README.md
CHANGED
|
@@ -338,7 +338,7 @@ agent skill.
|
|
|
338
338
|
| `assemble --propose-plan … [--write-config <config>]` | propose `assemble.plan` and `extend_below_crop` from the two runs, leaving out an implausible layer with a note naming the rule, naming in a note any full-run body no planned part covers, and naming every layer no row takes with why (empty, taken from the other run only, a plausibility rule; `nose`, never planned, with the row that lets `propose` read the head's pitch) |
|
|
339
339
|
| `assemble --source --full --head --config --out [--seam] [--project]` | merge the two runs into rig-space parts, `parts.json`, the recomposite and its error map, and list the uncovered holes |
|
|
340
340
|
| `propose --head-box --full <run> --canvas WxH [--no-back-hair] [--write-config <config>]` | propose `seethrough.head_box` from the full run, held inside the painting; `--no-back-hair` leaves the back-hair layer out of that proposal |
|
|
341
|
-
| `propose --parts --source --out [--compare <config>] [--write-config <config>]` | propose bones, meshes, regions and an idle; draw the overlay; print, per bone, which check read it or that none did and why (its role, its kind of segment), and write `basis.json` beside the proposal — what each bone rests on (a joint, a part's mask, a ratio, other bones) and, with `--compare`, whether the config's bone differs |
|
|
341
|
+
| `propose --parts --source --out [--compare <config>] [--write-config <config> [--only-missing]]` | propose bones, meshes, regions and an idle; draw the overlay; print, per bone, which check read it or that none did and why (its role, its kind of segment), and write `basis.json` beside the proposal — what each bone rests on (a joint, a part's mask, a ratio, other bones) and, with `--compare`, whether the config's bone differs |
|
|
342
342
|
| `propose … --keypoints <file> [--person <id>]` | read a posed figure's joints from one explicit file (space, image size, people, each joint observed, occluded or missing, its source): a joint with a position places the neck, hip, chest or a sleeve chain as given, a note says how every joint was used or which rule stood in, and LINT reads the torso and sleeves along the joints instead of by screen y ([AUTHORING §3](docs/AUTHORING.md)) |
|
|
343
343
|
| `propose … --grid-rule figure\|part` | how each drafted lattice's spacing is chosen: `figure` (the default) one spacing for the figure, round(H / 37) rig px, a part already coarser keeping its own, with a note on its calibration and cost; `part` the reference's rule, a tenth of the part's short side (the oracle examples are proposed under it) |
|
|
344
344
|
| `propose … --from-config <config>` | draw and LINT the config's current bones (by the joints too, given `--keypoints`) |
|
|
@@ -385,6 +385,17 @@ runs. Its already-checked splice text may be a partial config; it is not passed
|
|
|
385
385
|
through the full-config loader. If removing the staged temporary fails after
|
|
386
386
|
publication, the error may accompany an already-published complete config.
|
|
387
387
|
`--from <previous.json>` retains the previous-recipe comparison.
|
|
388
|
+
With `--only-missing` (issue #671), an ordinary proposal's `--write-config` adds
|
|
389
|
+
only `meshes.<part>` or `regions.<part>` for each proposed part the config
|
|
390
|
+
attaches by neither, entry by entry, and, for a part the 1.37.0 arm split makes
|
|
391
|
+
(`full:drape-<s>`, `full:hand-<s>`) that `assemble.plan` does not name, its plan
|
|
392
|
+
row beside the arm's row; every existing row and entry and every other byte
|
|
393
|
+
stays as read, and nothing else of the proposal is written. The candidate passes
|
|
394
|
+
the full loader first, so an entry on a bone the config does not declare is
|
|
395
|
+
refused naming the part and the bone; nothing missing leaves bytes and mtime
|
|
396
|
+
untouched. It is the upgrade path for a config proposed before the 1.37.0 arm
|
|
397
|
+
split ([MIGRATION](docs/MIGRATION.md#after-1370-merged-arm-layers-are-split-issue-490)),
|
|
398
|
+
and a usage error with `--head-box`, `--cloth` or `--from-config`.
|
|
388
399
|
`--from-config` proposes nothing and cannot be combined with `--write-config`.
|
|
389
400
|
[AUTHORING §4](docs/AUTHORING.md#4-the-command-order) describes all four modes.
|
|
390
401
|
|
package/cli.ts
CHANGED
|
@@ -279,6 +279,24 @@ usage:
|
|
|
279
279
|
keeps the original bytes and mtime. A changed source, an artifact alias
|
|
280
280
|
or a failed write is refused by name. Change lines go to stderr.
|
|
281
281
|
|
|
282
|
+
rig-parts propose --parts <dir> --source <painting.png> --out <dir> --write-config <config.json> --only-missing
|
|
283
|
+
Add to the existing config only what it lacks for the parts it attaches
|
|
284
|
+
by neither meshes.<part> nor regions.<part> (issue #671: a config proposed
|
|
285
|
+
before 1.37.0 meets the drape_<s> and hand_<s> parts the arm split makes,
|
|
286
|
+
issue #490; docs/MIGRATION.md). A part from full:drape-<s> or
|
|
287
|
+
full:hand-<s> that assemble.plan does not name gains its plan row where
|
|
288
|
+
assemble's rewrite puts it: the drape just before the full run's
|
|
289
|
+
handwear-<s> row, the hand just after it. Each part then gains its entry
|
|
290
|
+
as the proposal drafts it. Each row and entry is spliced in alone; every
|
|
291
|
+
existing row and entry and every other byte stays as read, and nothing
|
|
292
|
+
else of the proposal (bones, motion, …) is written. An unplanned part of
|
|
293
|
+
any other origin gets no row. The full config loader validates the
|
|
294
|
+
candidate first, so an added entry on a bone the config does not declare
|
|
295
|
+
is refused naming the part and the bone, and nothing is written. Nothing
|
|
296
|
+
missing keeps the bytes and mtime. One change line per added row and
|
|
297
|
+
entry goes to stderr. A usage error with --head-box, --cloth or
|
|
298
|
+
--from-config, or without --parts or --write-config.
|
|
299
|
+
|
|
282
300
|
rig-parts propose --head-box --full <dir | layers.json | file.psd> --canvas <W>x<H> [--no-back-hair]
|
|
283
301
|
[--write-config <config.json>]
|
|
284
302
|
Propose seethrough.head_box (source px, square) from the full run's
|
|
@@ -984,7 +1002,7 @@ const TAKES = {
|
|
|
984
1002
|
layers: { valued: ['--export', '--template', '--canvas'], switches: [] },
|
|
985
1003
|
sheet: { valued: ['--source', '--layers', '--out', '--cell', '--cols'], switches: [] },
|
|
986
1004
|
rig: { valued: ['--config', '--parts', '--out', '--idle-keys', '--page-edges', '--pack-shape'], switches: [] },
|
|
987
|
-
propose: { valued: ['--parts', '--source', '--out', '--from-config', '--compare', '--full', '--head', '--canvas', '--keypoints', '--person', '--wrist-snap', '--grid-rule', '--cloth', '--write-config', '--from'], switches: ['--head-box', '--no-back-hair'] },
|
|
1005
|
+
propose: { valued: ['--parts', '--source', '--out', '--from-config', '--compare', '--full', '--head', '--canvas', '--keypoints', '--person', '--wrist-snap', '--grid-rule', '--cloth', '--write-config', '--from'], switches: ['--head-box', '--no-back-hair', '--only-missing'] },
|
|
988
1006
|
compare: { valued: ['--left', '--right', '--map'], switches: [] },
|
|
989
1007
|
check: { valued: ['--rig', '--out', '--parts', '--source', '--page-edges', '--pack-shape', '--requirements', '--set', '--environment'], switches: ['--seam-pairs', '--keep-stills', '--all-sets'] },
|
|
990
1008
|
loop: { valued: ['--frames', '--out'], switches: ['--palette'] },
|
|
@@ -1306,12 +1324,18 @@ function cmdPropose(args: string[]): number {
|
|
|
1306
1324
|
const flags = new Map<string, string>();
|
|
1307
1325
|
let headBox = false;
|
|
1308
1326
|
let noBackHair = false;
|
|
1327
|
+
let onlyMissing = false;
|
|
1309
1328
|
for (let i = 0; i < args.length; i++) {
|
|
1310
1329
|
const flag = args[i];
|
|
1311
1330
|
if (flag === '--head-box') {
|
|
1312
1331
|
headBox = true;
|
|
1313
1332
|
continue;
|
|
1314
1333
|
}
|
|
1334
|
+
if (flag === '--only-missing') {
|
|
1335
|
+
if (onlyMissing) return usage('--only-missing is given twice');
|
|
1336
|
+
onlyMissing = true;
|
|
1337
|
+
continue;
|
|
1338
|
+
}
|
|
1315
1339
|
if (flag === '--no-back-hair') {
|
|
1316
1340
|
if (noBackHair) return usage('--no-back-hair is given twice');
|
|
1317
1341
|
noBackHair = true;
|
|
@@ -1324,6 +1348,16 @@ function cmdPropose(args: string[]): number {
|
|
|
1324
1348
|
flags.set(flag, value);
|
|
1325
1349
|
i++;
|
|
1326
1350
|
}
|
|
1351
|
+
// Issue #671: --only-missing adds entries to an existing config for the parts it attaches by neither section; it
|
|
1352
|
+
// belongs to the ordinary proposal's --write-config alone.
|
|
1353
|
+
if (onlyMissing) {
|
|
1354
|
+
const mode = 'propose --parts … --write-config <config.json> --only-missing';
|
|
1355
|
+
if (headBox) return usage(`--only-missing belongs to ${mode}; --head-box writes seethrough.head_box only`);
|
|
1356
|
+
if (!flags.has('--parts')) return usage(`--only-missing belongs to ${mode}; give --parts <dir>, the parts the entries are drafted from`);
|
|
1357
|
+
if (flags.has('--from-config')) return usage(`--only-missing belongs to ${mode}; --from-config proposes nothing`);
|
|
1358
|
+
if (flags.has('--cloth')) return usage(`--only-missing belongs to ${mode}; --cloth writes a new config with the recipe's entries spliced in`);
|
|
1359
|
+
if (!flags.has('--write-config')) return usage(`--only-missing belongs to ${mode}; give --write-config <config.json>, the existing config the entries are added to`);
|
|
1360
|
+
}
|
|
1327
1361
|
let staged: StagedConfigWrite | null = null;
|
|
1328
1362
|
try {
|
|
1329
1363
|
if (headBox) {
|
|
@@ -1480,7 +1514,7 @@ function cmdPropose(args: string[]): number {
|
|
|
1480
1514
|
})();
|
|
1481
1515
|
const bfile = basisFile(P, prop, basis, cfg === null || cmpPath === undefined ? null : { where: cmpPath, config: cfg });
|
|
1482
1516
|
const img = drawLandmarks(P, painting, prop.bones, 'PROPOSAL - CORRECT ME');
|
|
1483
|
-
if (target !== null) staged = stageConfigWrite(target, { kind: 'proposal', proposal: prop, sections: PROPOSAL_CONFIG_SECTIONS });
|
|
1517
|
+
if (target !== null) staged = stageConfigWrite(target, onlyMissing ? { kind: 'proposal-missing', proposal: prop, parts: P.recs } : { kind: 'proposal', proposal: prop, sections: PROPOSAL_CONFIG_SECTIONS });
|
|
1484
1518
|
else if (written !== null) staged = stageConfigWrite({ kind: 'fresh', path: written.at, text: written.text });
|
|
1485
1519
|
mkdirSync(render, { recursive: true });
|
|
1486
1520
|
writeFileSync(join(out, 'proposal.json'), serializeProposal(prop));
|
package/docs/AUTHORING.md
CHANGED
|
@@ -118,9 +118,9 @@ read by no CPU stage).
|
|
|
118
118
|
| `assemble.extend_below_crop` | assemble | **proposed** with the plan: `{part, run, tag}` — a head-run part that reaches the bottom of the head crop is continued from a full-run layer, whole connected components |
|
|
119
119
|
| `assemble.patches` | assemble; `meshes`/`regions` keys may name them too | **authored**, optional: `[{name, box, alpha, draw}]` — an extra part cut from the **painting** itself, for figure no See-through layer holds (a hem both runs dropped). `box` is `[x0, y0, x1, y1]` in **rig** pixels, `x1`/`y1` exclusive — the space of `parts.json` and `recomposite_rig.png`, where the hole is found; `alpha` is `"silhouette"` (the painting's figure silhouette inside the box, the one `--seam silhouette` uses) or `"box"` (the whole box); `draw` is `"back"`, `"front"` or `{"before": "<plan part>"}`. A patch is always a region: its bone is `regions.<name>`, in the one place every region's bone lives, and a `meshes` entry for it is refused. `draw` sets assembled part order; an exclusively bound limb rider's final rig slot joins that limb's block (see the limbs subsection). See §5 for how to place one |
|
|
120
120
|
| `assemble.cuts` | assemble; `meshes`/`regions` keys may name the new parts too, and must (each is a part like any other) | **authored**, optional (issue #170): `[{from, into, polygon, draw, overlap, under, under_fill}]`, `under` and `under_fill` optional — a plan part's layer cut by a polygon the author draws: the pixels of plan part `from` whose **centre** lies inside `polygon` (even-odd; a centre exactly on an edge is outside) leave `from` and make the new part `into`, colour and alpha, so every pixel of the layer ends in exactly one of the two. `polygon` is `[[x, y], …]`, at least three points, non-negative integer **rig** pixels — the space of `parts.json` and of the patches' boxes. The file that shows the layer in those coordinates is `assemble`'s own `rig/parts/<from>.png`, placed at its `parts.json` `x`, `y` (the PNG's pixel `(i, j)` is rig pixel `(x + i, y + j)`), or `render/recomposite_rig.png`, the whole rig 1:1; the contact sheets (`sheet`) are scaled and carry no coordinates. `draw` is `"back"`, `"front"` or `{"before": "<plan part>"}`, as for a patch (to keep the setup pose, draw the piece immediately in front of `from` — `{"before": "<the plan part after from>"}`, or `"front"` when `from` is the last plan part; `{"before": "<from>"}` draws it behind `from`, which `under` refuses as `ASSEMBLE_UNDER_DRAW` because the fill would hide it). `from` must be a plan part (`CONFIG_NAME_RESOLVES`; a patch or another cut's piece is refused; a part a limb takes may be cut where no segment of the limb holds it, issue #564, §5 *Limbs*), `into` a new name (`CONFIG_PART_UNIQUE`), the polygon three or more integer points (`CONFIG_FIELD_TYPE`). The piece's `parts.json` record carries `from`'s `<run>:<tag>` and its own counts, each split from the layer's by where the pixel lies; it is a mesh or a region under its own name, and the coverage rule holds it like a plan part. What the config cannot know the stage refuses: a polygon point past the rig (`ASSEMBLE_CUT_INSIDE`), two cuts of one part sharing a pixel (`ASSEMBLE_CUT_OVERLAP`), a cut that takes none of the layer's opaque pixels or leaves `from` none (`ASSEMBLE_CUT_PIXELS`), a cut of a part a limb takes that takes a pixel a segment of the limb holds (`ASSEMBLE_CUT_CROSSES_LIMB`). `overlap` is required, a non-negative integer of rig pixels with no default (`CONFIG_FIELD_TYPE`): the **band** — the polygon's pixels within `overlap` px of its edge by Chebyshev distance (the polygon's mask less its erosion by a `2 * overlap + 1` square) — stays in `from` as well as going to the piece, so the piece's resampled edge has art under it; the counts stay a strict partition and the band is the base's extra copy, printed on the `cut:` line. At `0` the two abut and `check`'s seam bar judges the edge between them (`CHECK_SEAM_WITHIN_BAR`, §5). A band only covers the edge at rest: a piece that swings well clear of where it was painted shows the hole it leaves, and a thin piece's band shows a ghost of the piece. `under` (issue #193), optional, is the author's image of what lies under the piece: a PNG path relative to the config's directory (`CONFIG_FIELD_TYPE` unless a non-empty string), in rig pixels over the polygon's **bounding box** — the least and greatest polygon x and y, so the image is `max x − min x` by `max y − min y` and its pixel `(i, j)` is rig pixel `(min x + i, min y + j)`. Where the cut removed pixels from `from` — the piece's pixels (alpha above 0) less the band — `from` takes the image's pixel, colour and alpha wherever the image's alpha is at least the alpha the cut removed there (**filled**); elsewhere `from` stays empty there (**left empty**): a transparent pixel is the author's statement that nothing lies under it (the background, or a part drawn behind), and a less opaque one is not half-filled. The image is read nowhere else, so its pixels over the band, over the box outside the polygon or where the layer had no art never change `from`. The `cut:` line then ends `; under <n> px filled, <m> px left empty` (`n + m` is every removed pixel), so an unintended hole is a number in the log, not a guess; the filled pixels count in `from`'s `opaque_px` and `occluded_px` (the piece is drawn over them), never as visible or projected. The stage refuses: a file that is not there (`ASSEMBLE_UNDER_PRESENT`) or not a PNG (`ASSEMBLE_UNDER_DECODES`), an image not exactly the box's size (`ASSEMBLE_UNDER_SIZE`, both sizes given), an image that fills none of the removed pixels — all transparent there, or another file (`ASSEMBLE_UNDER_EMPTY`; to leave the whole hole, drop `under`), and a piece drawn behind `from` (`ASSEMBLE_UNDER_DRAW`: the fill would hide it; draw it `"front"` or `{"before": "<the plan part after from>"}`). Producing the image is the author's, by whatever means; absent, `from` keeps only its band. `under_fill` (issue #360), optional, is the one value `"colour"` (`CONFIG_FIELD_TYPE` on any other): the same pixels are filled and left empty, and a filled pixel takes the image's **colour** at the alpha the cut removed there instead of the image's alpha, so `from`'s alpha is the uncut layer's wherever the image fills and its silhouette does not grow — an opaque image over a soft edge leaves the edge soft. It applies to the part's hidden-art layer as well as to a file; a cut with neither is refused (`ASSEMBLE_UNDER_FILL_SOURCE`). The `cut:` line's filled count then says how many took the colour only: `; under 190 px filled (190 colour only, at the alpha the cut removed), 0 px left empty`. Absent, a filled pixel takes the image's colour and alpha, as above |
|
|
121
|
-
| `assemble.alternates` | assemble, rig, check (`--set`, `--all-sets`) | **authored**, optional (issues #454, #465, #472, #473, #476): `[{name, source?, full?, head?, head_box?, parts?, hides?, cuts?, skeleton?, drawn?, tips?}]` — alternate painting sets assembled into `<out>/rig/parts/<set>_<part>.png` (`parts.json` `alternates`), attached on each covered slot in `rig.json` as `<set>_<part>` beside the base attachment, and indexed in `<out>/rig/sets.json` (`rig-parts-sets/1`: `sets.<set>.slots`, `.hides`, `.drawn` when present, and `.threshold: {yaw: 15, pitch: 12}` when the set replaces `face` on a rig with `turn` or `turn`/`tilt` slider animations). `source`, `full` and `head` may instead be given on the CLI with `--alt <name>=<source>:<full>[:<head>]`. `parts` lists the subset of parts the set replaces (default: every part not in `hides`); a **subset set** (issue #473, e.g. mouth visemes `a`, `i`, `u` with `"parts": ["mouth"]`) cuts only its covered parts from the alternate runs (refusing with `ASSEMBLE_ALT_INPUT_PRESENT` if a covered part's layer is missing or empty), writes only `{slot: "<set>_<slot>"}` in `sets.json` so `@rig-c/play`'s `setSet(name)` switches those slots while leaving every other slot on its base attachment (and `setSet(null)` restores the base pose), may be keyed on a slot attachment track in `motion.animations_from` as `{"t": …, "set": "<name>" \| null}` (`CONFIG_SET_COVERS_SLOT` if `"set"` is undeclared or does not cover the track's slot), and under `check --set <name>` counts `ANIMATIONS_DO_NOT_FOLD` only on its own covered slots; `hides` lists slots the set hides (`null` in `sets.json`). A **gesture subset set** (issue #476) covers a limb chain declared in `config.limbs.<limb>` (all of its segment `part`s; with `drawn` alone, cut at the base's joints posed to the set's own `drawn` angles by `poseBoneEntriesForDrawn`, each segment keeping the base's length; with `skeleton` (issue #539), cut at the skeleton's own joint positions by `placeBoneEntriesForSkeleton` — each covered bone the body-18 table names (`sleeve_*`, `arm_*0`/`arm_*1`, `leg_*0`/`leg_*1`) at its skeleton origin with the skeleton segment's own length and direction (`drawn` overriding the direction of a bone it names), and a covered bone the table does not name (a hand link `arm_r2`, a single `foot_r`) placed from its parent's new place — its base offset from the parent, stretched along the parent by the parent's length change and turned by its turn, so a link or a foot at the parent's end lands on the skeleton's end — with its base length and the drawn or base direction, so a foreshortened shin or forearm is cut where it is painted; naming the unsplit `from` layer, covering only some segments of the limb, or declaring polygon `cuts` on a limb set is refused with `CONFIG_LIMB_SET_JOINTS`) and carries `drawn` (or `skeleton`) for the covered bones only (giving `drawn` for an uncovered bone is refused with `CONFIG_SET_COVERS_BONE` / `RIG_SET_COVERS_BONE`; uncovered bones keep the base's `drawn`). A subset set's limb part takes no pixel that a base part drawn after it, which the set neither covers nor hides, covers at setup (issue #587): the set's attachment is drawn in the base slot's place, so that base part is drawn over it and what the set's painting shows there is that base part (shorts over a leg set's thigh top, which See-through synthesised in the set's leg layer); `assemble` clears those pixels — the base part's PNG at alpha above 8, at its `parts.json` x, y, on the shared canvas — from the set's part once its limbs are cut, before any count — its `merged_px` and its cap's record too (issue #603): a cap pixel it clears leaves the count it was in (`layer_px`, `image_px`, `upper_px`, `lower_px`, `lower_kept_px`) for the cap's `excluded_px`, written only when above 0, so every count is the written PNG's — and prints `LINT set "<set>" <part>: <n> px under <base part> excluded` per part and base part that took a pixel (n counts alpha above 8); a set that carries that base part itself (`"parts": ["thigh_l", "shin_l", "bottomwear"]`) excludes nothing and writes what it wrote before. A subset set that names one limb side of a layer more limbs take (issue #588: `"parts": ["thigh_r", "shin_r"]` where `leg_r` and `leg_l` both take the one `legs` layer) would put every pixel of that layer on its one limb, so each of its parts would hold a piece of both legs; when the set's layer holds more than one island (8-connected pixels with alpha above 8) of at least 1 % of its largest (issue #608: the ghost clean-up's own share; a smaller island is a speck, which goes with the island nearest it — the one holding the pixel centre nearest one of the speck's, none when two are equally near — and is never an island of its own), each segment part keeps the island its joints fall on — its bone's origin and the next segment's bone's origin, at the set's own bones, a joint on the island of a pixel whose square holds the point, and a joint on no island on the one island whose nearest pixel centre lies within the radius of the cap cut at that joint (`cap.radius`: an ankle just past the legwear's edge, on the shoe) — and drops the rest, once its limbs are cut and before the exclusion above, and `assemble` prints `LINT set "<set>" <part>: <layer part> holds <n> islands (8-connected, alpha above 8)[, and <s> speck(s) under 1 % of the largest (<f> px), each with the island nearest it], kept the one under <bone> [x, y] and <bone> [x, y][ (<e> px off it, within its cap's radius <r>)] (<k> px), dropped <m> (<d> px)` per part (k and d count the part's pixels above alpha 8, m the islands it lost one from, and `dropped none` when it lost none); a joint on no island with none or two within that radius, or with no cap cut at it (a limb's first joint), and a segment whose joints fall on two, are refused with `ASSEMBLE_ALT_LIMB_ISLAND` rather than guessed. A layer of one island — specks aside — may hold both legs over each other (a folded shin across the standing leg; issue #609): each of the set's segment parts then keeps the pixels nearer its own limb's segment line — the polyline of only its segments taking that source, their bone origins and the last segment's supplied tip or following segment's joint (issue #638) — than the other limb's, both in the set's pose, and gives the rest away, once its limbs are cut and before the exclusion above; a pixel whose two distances differ by 0.5 px or less (the overlap band: half a pixel, the reach by which a pixel centre is read as on a line) goes to the limb whose part there is drawn later in the base's draw order, and the `LINT set` line above counts what each part kept, gave and held in the band. The other limb stands where the set's `skeleton` places it — its keypoints place every limb bone of the body-18 table, the other leg's as well as the set's own (its `drawn` and `drawnLength` stay the covered bones') — and never at the base's place: a set that does not place it (a `drawn` set, which may not name a bone it does not cover, or a set with neither) is refused with `ASSEMBLE_ALT_LIMB_POSE` when its layer has art where the base draws that limb, and when it has none nothing says the layer holds it and the layer is cut as before; two limbs whose segment lines run closer than the limb's half-width over most of where their art can meet are refused with `ASSEMBLE_ALT_LIMB_OVERLAP`. A set that carries every limb of the layer is cut as before. For a subset set, where a limb's own source layer holds art (`alpha > 8`) under another layer of that run drawn in front (`alpha > 8`, by the projection's plan/depth order), the limb keeps its own layer pixels through projection, limb cutting, island/nearest-line assignment, base-footprint exclusion, fringe clearing and seam correction (issue #637). Those pixels are occluded, never counted as painting projection; no base footprint or painting colour replaces them. After source-art island/nearest-line assignment, a source-transparent cap pixel is assigned before protection, in both doors: its centre is compared against only the segments taking the recipient's source, at the set's supplied bones (ankle-to-toe for a separate foot source), with the existing 0.5 px overlap band and base draw order. A missing last endpoint is refused with `ASSEMBLE_ALT_LIMB_POSE`; an actual following joint may supply that endpoint, never a guessed point. An unposed other limb with base art beneath these cap pixels is likewise refused; without such overlap the existing compatible path retains the cap without inventing the other limb's pose. A pixel cleared by this assignment is never restored. `CAP_FROM_UPPER` records a copy made before assignment and alone proves no ownership: only a retained copy is protected beneath the upper segment, which is drawn over it. The source-art island selection itself is unchanged. Other retained cap pixels (from the layer or a supplied cap image) are protected under an actual front layer even where the lower source is transparent. Protection follows each assigned piece through exclusion, fringe clearing and seam correction; it never restores a pixel ownership removed. Cap pixels removed during ownership leave their original counts for `excluded_px`, just as excluded pixels do, so the cap ledger describes the written PNG. Target assignment reconciles this ledger even when there are no source-transparent cap candidates and when a direct caller does not request cover protection. Unprotected source pixels still obey the base-footprint exclusion. Missing limb/cap art is never extended or guessed. Base builds and uncovered, unexcluded sets keep their existing bytes. `skeleton` (a pose file path relative to the config's directory, `{"width": W, "height": H, "points": {…}}` with all 18 body-18 keypoints on the canvas, validated by the same rules as `generation.control.skeleton`: `CONFIG_FILE_PRESENT`, `CONFIG_IS_JSON`, `CONFIG_FIELD_TYPE`, `CONFIG_KEY_KNOWN`, `CONFIG_KEY_UNIQUE`, `CONFIG_POSE_CANVAS`, `CONFIG_POSE_KEYPOINTS`, `CONFIG_POSE_IN_CANVAS`) or `drawn` (`{<bone>: <worldDegrees>}`, each bone resolved against `bones`, `CONFIG_NAME_RESOLVES`) declares the posed angles the alternate was painted at (issue #465); when `skeleton` is given, `assemble` derives `drawn` from its 18 keypoints (filtered to covered bones on a subset set, with `drawn` overriding any bone named in both), records both `skeleton` (scaled by `assemble.rig_scale` to rig px) and `drawn` in `parts.json` `alternates` — and, when the skeleton placed the set's limb bones (issue #539), `drawnLength` (`{<bone>: <ratio>}`, each covered table bone's skeleton segment length over its base length, 6 places) and `registration` (`{offset: [dx, dy], scale}`: the similarity without rotation, about the canvas origin, that maps the skeleton's torso — the mean of its shoulders `r_shoulder`/`l_shoulder` to the mean of its hips `r_hip`/`l_hip`, read where the base declares the bone rooted there, `sleeve_*0`/`arm_*0` and `leg_*0` — onto those base bones' origins, 6 places), both also written to `sets.json`; the set's painting must be registered, its torso within 1 rig px and 1 % in scale of the base's, or the set is refused by name before any joint is cut (`ASSEMBLE_ALT_SKELETON_REGISTERED`, with the offset and scale the painting would need) — and the `rig` stage writes `<set>_*` region and mesh attachments in the bone-local frame of `poseRigBonesForDrawn(bones, drawn)` (weighting limb segments directly from `skeleton`'s joint endpoints when `skeleton` is present) and emits `drawn` in `sets.json` so `rig-pose` and `check --set <name>` / `--all-sets` pose the bones at `drawn` without rotating the already-posed art a second time |
|
|
121
|
+
| `assemble.alternates` | assemble, rig, check (`--set`, `--all-sets`) | **authored**, optional (issues #454, #465, #472, #473, #476): `[{name, source?, full?, head?, head_box?, parts?, hides?, cuts?, skeleton?, drawn?, tips?, front?}]` — alternate painting sets assembled into `<out>/rig/parts/<set>_<part>.png` (`parts.json` `alternates`), attached on each covered slot in `rig.json` as `<set>_<part>` beside the base attachment, and indexed in `<out>/rig/sets.json` (`rig-parts-sets/1`: `sets.<set>.slots`, `.hides`, `.drawn` when present, and `.threshold: {yaw: 15, pitch: 12}` when the set replaces `face` on a rig with `turn` or `turn`/`tilt` slider animations). `source`, `full` and `head` may instead be given on the CLI with `--alt <name>=<source>:<full>[:<head>]`. `parts` lists the subset of parts the set replaces (default: every part not in `hides`); a **subset set** (issue #473, e.g. mouth visemes `a`, `i`, `u` with `"parts": ["mouth"]`) cuts only its covered parts from the alternate runs (refusing with `ASSEMBLE_ALT_INPUT_PRESENT` if a covered part's layer is missing or empty), writes only `{slot: "<set>_<slot>"}` in `sets.json` so `@rig-c/play`'s `setSet(name)` switches those slots while leaving every other slot on its base attachment (and `setSet(null)` restores the base pose), may be keyed on a slot attachment track in `motion.animations_from` as `{"t": …, "set": "<name>" \| null}` (`CONFIG_SET_COVERS_SLOT` if `"set"` is undeclared or does not cover the track's slot), and under `check --set <name>` counts `ANIMATIONS_DO_NOT_FOLD` only on its own covered slots; `hides` lists slots the set hides (`null` in `sets.json`). A **gesture subset set** (issue #476) covers a limb chain declared in `config.limbs.<limb>` (all of its segment `part`s; with `drawn` alone, cut at the base's joints posed to the set's own `drawn` angles by `poseBoneEntriesForDrawn`, each segment keeping the base's length; with `skeleton` (issue #539), cut at the skeleton's own joint positions by `placeBoneEntriesForSkeleton` — each covered bone the body-18 table names (`sleeve_*`, `arm_*0`/`arm_*1`, `leg_*0`/`leg_*1`) at its skeleton origin with the skeleton segment's own length and direction (`drawn` overriding the direction of a bone it names), and a covered bone the table does not name (a hand link `arm_r2`, a single `foot_r`) placed from its parent's new place — its base offset from the parent, stretched along the parent by the parent's length change and turned by its turn, so a link or a foot at the parent's end lands on the skeleton's end — with its base length and the drawn or base direction, so a foreshortened shin or forearm is cut where it is painted; naming the unsplit `from` layer, covering only some segments of the limb, or declaring polygon `cuts` on a limb set is refused with `CONFIG_LIMB_SET_JOINTS`) and carries `drawn` (or `skeleton`) for the covered bones only (giving `drawn` for an uncovered bone is refused with `CONFIG_SET_COVERS_BONE` / `RIG_SET_COVERS_BONE`; uncovered bones keep the base's `drawn`). A subset set's limb part takes no pixel that a base part drawn after it, which the set neither covers nor hides, covers at setup (issue #587): the set's attachment is drawn in the base slot's place, so that base part is drawn over it and what the set's painting shows there is that base part (shorts over a leg set's thigh top, which See-through synthesised in the set's leg layer); `assemble` clears those pixels — the base part's PNG at alpha above 8, at its `parts.json` x, y, on the shared canvas — from the set's part once its limbs are cut, before any count — its `merged_px` and its cap's record too (issue #603): a cap pixel it clears leaves the count it was in (`layer_px`, `image_px`, `upper_px`, `lower_px`, `lower_kept_px`) for the cap's `excluded_px`, written only when above 0, so every count is the written PNG's — and prints `LINT set "<set>" <part>: <n> px under <base part> excluded` per part and base part that took a pixel (n counts alpha above 8); a set that carries that base part itself (`"parts": ["thigh_l", "shin_l", "bottomwear"]`) excludes nothing and writes what it wrote before. A subset set that names one limb side of a layer more limbs take (issue #588: `"parts": ["thigh_r", "shin_r"]` where `leg_r` and `leg_l` both take the one `legs` layer) would put every pixel of that layer on its one limb, so each of its parts would hold a piece of both legs; when the set's layer holds more than one island (8-connected pixels with alpha above 8) of at least 1 % of its largest (issue #608: the ghost clean-up's own share; a smaller island is a speck, which goes with the island nearest it — the one holding the pixel centre nearest one of the speck's, none when two are equally near — and is never an island of its own), each segment part keeps the island its joints fall on — its bone's origin and the next segment's bone's origin, at the set's own bones, a joint on the island of a pixel whose square holds the point, and a joint on no island on the one island whose nearest pixel centre lies within the radius of the cap cut at that joint (`cap.radius`: an ankle just past the legwear's edge, on the shoe) — and drops the rest, once its limbs are cut and before the exclusion above, and `assemble` prints `LINT set "<set>" <part>: <layer part> holds <n> islands (8-connected, alpha above 8)[, and <s> speck(s) under 1 % of the largest (<f> px), each with the island nearest it], kept the one under <bone> [x, y] and <bone> [x, y][ (<e> px off it, within its cap's radius <r>)] (<k> px), dropped <m> (<d> px)` per part (k and d count the part's pixels above alpha 8, m the islands it lost one from, and `dropped none` when it lost none); a joint on no island with none or two within that radius, or with no cap cut at it (a limb's first joint), and a segment whose joints fall on two, are refused with `ASSEMBLE_ALT_LIMB_ISLAND` rather than guessed. A layer of one island — specks aside — may hold both legs over each other (a folded shin across the standing leg; issue #609): each of the set's segment parts then keeps the pixels nearer its own limb's segment line — the polyline of only its segments taking that source, their bone origins and the last segment's supplied tip or following segment's joint (issue #638) — than the other limb's, both in the set's pose, and gives the rest away, once its limbs are cut and before the exclusion above; a pixel whose two distances differ by 0.5 px or less (the overlap band: half a pixel, the reach by which a pixel centre is read as on a line) goes to the limb whose part there is drawn later in the base's draw order, and the `LINT set` line above counts what each part kept, gave and held in the band. The other limb stands where the set's `skeleton` places it — its keypoints place every limb bone of the body-18 table, the other leg's as well as the set's own (its `drawn` and `drawnLength` stay the covered bones') — and never at the base's place: a set that does not place it (a `drawn` set, which may not name a bone it does not cover, or a set with neither) is refused with `ASSEMBLE_ALT_LIMB_POSE` when its layer has art where the base draws that limb, and when it has none nothing says the layer holds it and the layer is cut as before; two limbs whose segment lines run closer than the limb's half-width over most of where their art can meet are refused with `ASSEMBLE_ALT_LIMB_OVERLAP`. A set that carries every limb of the layer is cut as before. For a subset set, where a limb's own source layer holds art (`alpha > 8`) under another layer of that run drawn in front (`alpha > 8`, by the projection's plan/depth order), the limb keeps its own layer pixels through projection, limb cutting, island/nearest-line assignment, base-footprint exclusion, fringe clearing and seam correction (issue #637). Those pixels are occluded, never counted as painting projection; no base footprint or painting colour replaces them. After source-art island/nearest-line assignment, a source-transparent cap pixel is assigned before protection, in both doors: its centre is compared against only the segments taking the recipient's source, at the set's supplied bones (ankle-to-toe for a separate foot source), with the existing 0.5 px overlap band and base draw order. A missing last endpoint is refused with `ASSEMBLE_ALT_LIMB_POSE`; an actual following joint may supply that endpoint, never a guessed point. An unposed other limb with base art beneath these cap pixels is likewise refused; without such overlap the existing compatible path retains the cap without inventing the other limb's pose. A pixel cleared by this assignment is never restored. `CAP_FROM_UPPER` records a copy made before assignment and alone proves no ownership: only a retained copy is protected beneath the upper segment, which is drawn over it. The source-art island selection itself is unchanged. Other retained cap pixels (from the layer or a supplied cap image) are protected under an actual front layer even where the lower source is transparent. Protection follows each assigned piece through exclusion, fringe clearing and seam correction; it never restores a pixel ownership removed. Cap pixels removed during ownership leave their original counts for `excluded_px`, just as excluded pixels do, so the cap ledger describes the written PNG. Target assignment reconciles this ledger even when there are no source-transparent cap candidates and when a direct caller does not request cover protection. Unprotected source pixels still obey the base-footprint exclusion. Missing limb/cap art is never extended or guessed. Base builds and uncovered, unexcluded sets keep their existing bytes. `skeleton` (a pose file path relative to the config's directory, `{"width": W, "height": H, "points": {…}}` with all 18 body-18 keypoints on the canvas, validated by the same rules as `generation.control.skeleton`: `CONFIG_FILE_PRESENT`, `CONFIG_IS_JSON`, `CONFIG_FIELD_TYPE`, `CONFIG_KEY_KNOWN`, `CONFIG_KEY_UNIQUE`, `CONFIG_POSE_CANVAS`, `CONFIG_POSE_KEYPOINTS`, `CONFIG_POSE_IN_CANVAS`) or `drawn` (`{<bone>: <worldDegrees>}`, each bone resolved against `bones`, `CONFIG_NAME_RESOLVES`) declares the posed angles the alternate was painted at (issue #465); when `skeleton` is given, `assemble` derives `drawn` from its 18 keypoints (filtered to covered bones on a subset set, with `drawn` overriding any bone named in both), records both `skeleton` (scaled by `assemble.rig_scale` to rig px) and `drawn` in `parts.json` `alternates` — and, when the skeleton placed the set's limb bones (issue #539), `drawnLength` (`{<bone>: <ratio>}`, each covered table bone's skeleton segment length over its base length, 6 places) and `registration` (`{offset: [dx, dy], scale}`: the similarity without rotation, about the canvas origin, that maps the skeleton's torso — the mean of its shoulders `r_shoulder`/`l_shoulder` to the mean of its hips `r_hip`/`l_hip`, read where the base declares the bone rooted there, `sleeve_*0`/`arm_*0` and `leg_*0` — onto those base bones' origins, 6 places), both also written to `sets.json`; the set's painting must be registered, its torso within 1 rig px and 1 % in scale of the base's, or the set is refused by name before any joint is cut (`ASSEMBLE_ALT_SKELETON_REGISTERED`, with the offset and scale the painting would need) — and the `rig` stage writes `<set>_*` region and mesh attachments in the bone-local frame of `poseRigBonesForDrawn(bones, drawn)` (weighting limb segments directly from `skeleton`'s joint endpoints when `skeleton` is present) and emits `drawn` in `sets.json` so `rig-pose` and `check --set <name>` / `--all-sets` pose the bones at `drawn` without rotating the already-posed art a second time. `front` (issue #664) lists covered limb segment parts the set draws on their **front slot** instead of the base slot: each must be in the set's `parts` and not its `hides`, and listed in some `config.limbs.<limb>.front.parts` (`CONFIG_SET_FRONT`); the set then maps `<part>_front` (never `<part>`) to `<set>_<part>` in `parts.json` and `sets.json` and hides `<part>` (and `<part>_still`), its #587 exclusion counts only base parts drawn after the front slot's target, and keying that part's set on a slot track is refused (`CONFIG_SET_FRONT_KEYED`) — *Front slots (issue #664)* below |
|
|
122
122
|
| `assemble.head_face_underfill` | assemble, `assemble --propose-plan` | **authored**, optional (issue #492): `boolean` (`CONFIG_FIELD_TYPE` on any other). When both runs exist and `full:face` has at least `200` opaque run px (`PROPOSE_MIN_PX`), the stage maps `full:face` into the head canvas via `fullLayerToHead` and measures how much of its hole-filled silhouette (`alpha > 8`) is covered by `head:face` (`alpha > 8`). A head-run `face` covering less than `75 %` (`HEAD_FACE_COVERAGE_FLOOR`, measured `0.0 %..48.6 %` on hollow/omitted head runs vs `84.8 %..99.6 %` on clean head runs across the 4 public examples and 9-standee corpus) is refused with `SEETHROUGH_HEAD_RUN_HOLLOW` unless `head_face_underfill: true` is declared. When `head_face_underfill: true` is declared and `head:face` exists (`opaqueRunPx >= 200`), `fullLayerToHead(full:face)` is composited under `head:face` on the head canvas (`alpha = max(headAlpha, fullAlpha)`, RGB blended by `headAlpha / 255`) before `head:face` is placed in rig space (`underfill=<N>px(full:face)` on the `face` part log line and a `face: head_face_underfill composited …` note in `assemble --propose-plan`). The fill restores transparent pixels only and leaves the cut's own edge where it is — a hollow whose edge is not under hair stays visible, and that is the author's to fix at the cut. When `head:face` has fewer than `200` opaque pixels, `SEETHROUGH_HEAD_RUN_HOLLOW` still fires even under `head_face_underfill: true` because the head run omitted the face layer and cannot supply a jawline |
|
|
123
|
-
| `limbs` | assemble (the cut and the caps), rig (through `regions`), check (`LIMB_ONE_BONE`) | **proposed** by `propose --keypoints` (issue #349), then checked: `{<limb>: {segments: [{part, from, bone}, {part, from, bone, joint, range?, cap?, edge?, cap_shape?, cut_band?}, …]}}`, the upper segment first. The rule is *Limbs: cut at their joints* below the table. `part` is a new part (`CONFIG_PART_NAME`, `CONFIG_PART_UNIQUE` against the plan, patches, cuts and every other limb part); `from` a plan part or a cut's piece (`CONFIG_NAME_RESOLVES`) — the layer the segment's pixels come from, which is cut into the limb parts and is not itself made: a `meshes` or `regions` entry for it is `CONFIG_NAME_RESOLVES`, and the segments of one limb that take one part are consecutive (`CONFIG_LIMB_FROM_RUN`); `bone` a declared bone, each segment's the child of the one before (`CONFIG_LIMB_BONES_CHAIN`); the upper segment names no `joint`, `range`, `cap`, `edge`, `cap_shape` or `cut_band` (`CONFIG_KEY_KNOWN`), every other names its `joint` (`CONFIG_FIELD_PRESENT`) — the joint is its bone's origin; `range` is `[min, max]` degrees from rest with `min <= 0 <= max` (`CONFIG_LIMB_RANGE`), which `assemble` writes into the lower part's `parts.json` record and `check` poses the joint at — its two ends and its middle — reading the seam there (`SEAM_OVER_RANGE`, issue #360; rig-c needs no rotation limit); `cap` a PNG path relative to the config's directory (`CONFIG_FIELD_TYPE`); `edge` `"feather"` (issue #360), the one value it takes, and `cap_shape` `"disc"` (issue #360) or `"ball"` (issue #579) (`CONFIG_FIELD_TYPE` on any other) — the cut's geometry at that joint, *Limbs: cut at their joints* below; absent, the cut is hard and the cap the layer's half-disc of half the limb's width; `cut_band` a whole number of px, 1 or more (`CONFIG_FIELD_TYPE`), on a segment that takes the segment above's part — between two layers nothing is cut, so a band there is `CONFIG_KEY_KNOWN` — places the cut within that many px of the joint line (issue #360, *Limbs: cut at their joints*); absent, the cut is the joint line. Each limb part is attached like any part — `regions.<part>`, which must be the segment's `bone` (`CONFIG_LIMB_BONE`), or a mesh, which `check` holds to that bone alone (`LIMB_ONE_BONE`). With `limbs`, `assemble` reads `bones` too (`CONFIG_FIELD_PRESENT` without it). Absent, nothing is cut at a joint and no byte of any output moves |
|
|
123
|
+
| `limbs` | assemble (the cut and the caps), rig (through `regions`), check (`LIMB_ONE_BONE`) | **proposed** by `propose --keypoints` (issue #349), then checked: `{<limb>: {segments: [{part, from, bone}, {part, from, bone, joint, range?, cap?, edge?, cap_shape?, cut_band?}, …], split?, layout?, front?}}`, the upper segment first. The rule is *Limbs: cut at their joints* below the table. `part` is a new part (`CONFIG_PART_NAME`, `CONFIG_PART_UNIQUE` against the plan, patches, cuts and every other limb part); `from` a plan part or a cut's piece (`CONFIG_NAME_RESOLVES`) — the layer the segment's pixels come from, which is cut into the limb parts and is not itself made: a `meshes` or `regions` entry for it is `CONFIG_NAME_RESOLVES`, and the segments of one limb that take one part are consecutive (`CONFIG_LIMB_FROM_RUN`); `bone` a declared bone, each segment's the child of the one before (`CONFIG_LIMB_BONES_CHAIN`); the upper segment names no `joint`, `range`, `cap`, `edge`, `cap_shape` or `cut_band` (`CONFIG_KEY_KNOWN`), every other names its `joint` (`CONFIG_FIELD_PRESENT`) — the joint is its bone's origin; `range` is `[min, max]` degrees from rest with `min <= 0 <= max` (`CONFIG_LIMB_RANGE`), which `assemble` writes into the lower part's `parts.json` record and `check` poses the joint at — its two ends and its middle — reading the seam there (`SEAM_OVER_RANGE`, issue #360; rig-c needs no rotation limit); `cap` a PNG path relative to the config's directory (`CONFIG_FIELD_TYPE`); `edge` `"feather"` (issue #360), the one value it takes, and `cap_shape` `"disc"` (issue #360) or `"ball"` (issue #579) (`CONFIG_FIELD_TYPE` on any other) — the cut's geometry at that joint, *Limbs: cut at their joints* below; absent, the cut is hard and the cap the layer's half-disc of half the limb's width; `cut_band` a whole number of px, 1 or more (`CONFIG_FIELD_TYPE`), on a segment that takes the segment above's part — between two layers nothing is cut, so a band there is `CONFIG_KEY_KNOWN` — places the cut within that many px of the joint line (issue #360, *Limbs: cut at their joints*); absent, the cut is the joint line. Each limb part is attached like any part — `regions.<part>`, which must be the segment's `bone` (`CONFIG_LIMB_BONE`), or a mesh, which `check` holds to that bone alone (`LIMB_ONE_BONE`). With `limbs`, `assemble` reads `bones` too (`CONFIG_FIELD_PRESENT` without it). Absent, nothing is cut at a joint and no byte of any output moves. Optional `front` (issue #664), `{parts: [<own segment part>, …], after: "<produced part>"}`, gives each named segment a second slot `<part>_front`, empty at setup, placed after `after`'s slot family, for a gesture set to draw on (`CONFIG_FRONT_SCOPE`, `CONFIG_FRONT_NAME`, `CONFIG_FRONT_LAYOUT`; *Front slots (issue #664)* below) |
|
|
124
124
|
| `bones` | rig; `propose --from-config` | **proposed** by `propose`, then corrected. A single bone `{name, parent, at, tip?}` or a chain `{chain, parent, points, tip, link_inherit?}` whose links are named `<chain>0 … <chain>n`. Parents come before children. In `rig.json` each link is **turned along its chain** — `rotation` is the direction from its origin to the next link's (the last link's to `tip`) and `length` that distance (issue #73), so a physics constraint added downstream finds a lever; under `--idle-keys ctl` the link's `<link>_ctl` carries the turn and the length and the link sits at local rotation 0 beneath it. A single bone with a `tip` is turned the same way, towards its tip, with that distance as its length (issue #239); a tip on the bone's own origin is refused (`RIG_TIP_DISTINCT`). The five face bones `eye_r`, `eye_l`, `brow_r`, `brow_l` and `mouth` (by name, when one has no tip of its own) are turned to the eye line — the line through the origins of `eye_r` and `eye_l` as `bones` writes them, read image-left to image-right, drawn when parts.json holds both an `eyewhite-r` and an `eyewhite-l` part — so the blink's `scaley` squashes across the eye line on a tilted head; move an eye bone and the line moves with it. With one eyewhite or none, or an eye bone missing, the rig stage's `face axis:` line says so and they keep the page's axes. A bone under a face bone keeps the face's axis. With the line, `rig.json` also declares `invariants.axes` — one entry, `"face"`, through `eye_r` and `eye_l`, holding the turned face bones (and their controls) — so rig-c's gate holds the build to the line; the line is the one rigc draws through the same two bones, so the tolerance is only the float floor — the largest gap the emitted (float32) bones have to it, rounded up to 6 places plus one 6-place unit — and the `face axis:` line prints it. With the line the rig stage also adds `head_up` (issue #250): a slotless bone under `head`, at head's origin, turned to the eye line + 90 degrees and as long as the eye midpoint lies from head's origin along that axis — the head's frame, which a rule that needs it reads; `head` keeps its own frame, so no key on it or under it changes meaning, and a config bone of that name is refused (`RIG_HEAD_UP_NAME_FREE`). A face bone with its own `tip` is held too (issue #258), in a second entry, `"face_tips"`, when its tip lies along the line within whole-pixel rounding — a tip written in whole pixels sits at most sqrt(2)/2 px off the point of the line it stands for, so its direction may sit up to asin((sqrt(2)/2) / length) degrees off — with its tolerance measured the same way; a tip further off is the bone's own axis, and the `face axis:` line names it with its gap and that bound. A failure is rig-c's `A51_BONES_LIE_ALONG_THEIR_DECLARED_AXIS` line, which names the bone and the fix (rig-c's `docs/AUTHORING.md` §3.7 and §5.2); with no line no entry is written and A51 reports SKIP. Every region on a turned bone is turned back, so the setup pose does not move. Any other single bone keeps world rotation 0; one whose parent is a link is turned back upright. A single bone may declare `inherit` (issue #348): what it takes from its parent's transform, one of rig-c's own mode names exactly as rig-c's table spells them — `normal`, `onlyTranslation`, `noRotationOrReflection`, `noScale`, `noScaleOrReflection` (rig-c's `RigBone.inherit`) — written to that bone in `rig.json` as declared; any other spelling, `"NoScale"` included (the runtime would fold its first letter; nothing here folds or maps), is refused (`CONFIG_BONE_INHERIT`), and a chain takes no `inherit` (`CONFIG_KEY_KNOWN`). A chain may instead declare `link_inherit` (issue #369), an object mapping its own expanded link names to those same modes, for example `"link_inherit": {"leg_r1": "noScale"}`. Only the named link changes; omitted links inherit normally. A key outside this chain is `CONFIG_NAME_RESOLVES`, with this chain's valid link names in the detail; a non-object or non-string mode is `CONFIG_FIELD_TYPE`, and another mode spelling is `CONFIG_BONE_INHERIT`. The mode is forwarded to the expanded link, or to its control under `--idle-keys ctl`, by the same rule as a single bone. This is an authored opt-in: `propose` does not add it. Its setup rotation is the turn from where rig-c's own poser puts the bone with no rotation of its own under that mode, so it still stands upright (or along its tip) at the setup pose. Where the idle gives the bone a `<bone>_ctl`, the mode goes on the control: the control is the bone the parent's rotation reaches, and the bone under it inherits normally, so the idle's keys moved onto the control still turn it. A foot that does not take its shin's rotation (`noRotationOrReflection` or `onlyTranslation`) keeps its shoe level while the leg is posed (`FEET_STAY_LEVEL`, §7); which mode is the author's. `noScale` keeps a shin or shoe's shape under a scaled parent but still takes the parent's rotation: a shoe that must also stay level needs a separate rotation constraint, for example a transform constraint from an unrotated bone. This does not change the proposed feet's existing inheritance or `FEET_STAY_LEVEL` default. An automatic mesh weighted through a bone with a mode other than `normal` gets no derived amplitude (its row names the bone) and no residual envelope (rig-c's `SKINNING_RANGE_UNSUPPORTED`). Absent, `rig.json` carries no `inherit` and no byte moves |
|
|
125
125
|
| `meshes.<part>` | rig | **proposed**, then corrected. Exactly one of `grid` (the lattice: cell size, px — what `propose` writes: by default one spacing for the figure, round(H / 37) rig px with H the height of every part's box together, a part whose tenth of its short side is already coarser keeping that, and under `propose --grid-rule part` the reference's tenth of the part's short side clamped to 5..36, issue #265), `contour` (the outline mode, authored; the next row and "A contour mesh" below) or `auto` (the automatic mode, authored; "An automatic mesh" below) — two, or none, is `CONFIG_MESH_MODE`. In every mode: `r` (added to every distance before weighting: `w = 1/(d + r)²`), `segments` (a chain name, a bone name with a `tip`, or `[bone, [x0,y0], [x1,y1]]`), and, **authored**, optional, `exponent` (issue #161): a number above 0 that replaces the 2 in that rule, `w = 1/(d + r)^exponent` — a larger one hands each vertex more fully to its nearest bone; absent is 2 and changes no byte, a value that is not a number above 0 is `CONFIG_FIELD_TYPE` at `meshes.<part>.exponent`, and a declared one is echoed as `exponent` in the mesh's `mesh_report.json` row; the exponent is the distance rule's, so declared beside `rule: "heat"` it is refused (`CONFIG_FIELD_TYPE` at `meshes.<part>.exponent`). The segment list is the one authored decision about a layer: which bones may pull it. The slot's bone is the first segment's. Optional `rule` (issue #161): `"distance"` — the rule above, and what an absent `rule` means (every byte is the same) — or `"heat"`, bone heat over the part's own silhouette, in every mode: the lattice's art (alpha above 8, less any island a declared `stray` left out) with holes filled, or for `contour` and `auto` the silhouette their outline is traced from (that mode's art — alpha above 8 for `contour`, alpha 1 and above for `auto` — less any island a declared `stray` left out, holes filled, grown by its `margin`); each bound bone's sources are the silhouette pixels whose centre lies within 0.75 px of its segment (a pixel two bones reach goes to the nearer, a tie to the first listed), held at 1 for that bone and 0 for the others; the field is solved by row-major Gauss–Seidel over-relaxation to a sweep change under 1e-7 within 20000 sweeps; a vertex reads the nearest silhouette pixel and takes the same cap and floor (and `regions`) as the distance rule; `r` is not read. The mesh's `mesh_report.json` row gains `heat` (the constants, each bone's sources and sweeps, the residual). Any other value is `CONFIG_FIELD_TYPE`; a bound bone with no source pixel is `RIG_HEAT_BONE_SOURCE`, an island no bone has a source in `RIG_HEAT_ISLAND_SOURCE`, a solve past its sweep bound `RIG_HEAT_CONVERGED` — none is weighted 0. The rule is chosen per mesh, so `RIG_HEAT_BONE_SOURCE` names three remedies: move the segment onto the art, take the bone out of `segments`, or keep this part on the distance rule — the one to take when the bone anchors the part from outside its art (a torso bone under a neck), since the first moves a bone another part placed and the second drops the anchor (issue #303). On a lattice, `RIG_HEAT_ISLAND_SOURCE` on an island that is dust — at most 4 px and at most 0.1 % of the part's art px, `mesh-draft`'s line — names `meshes.<part>.stray` and the figure that leaves it out, with the value declared; an island above that line keeps the segment remedy, a real piece being a real authoring question. In every mode the mesh's `mesh_report.json` row's `bones` names the bones the emitted model binds for the attachment — the sorted set its weights in the written `rig.json` name, so a `turn` twin (`turn_<part>_<bone>`) or a stopped link's `<link>_d` where those rebind it, never the segment bone it stands for — the same list in every mode, `remesh --delta`'s included (issue #536) |
|
|
126
126
|
| `meshes.<part>.influence` | rig | **authored**, optional (issue #378), a mode beside `grid`, `contour` and `auto`: `{cell, radius, across, max, shape, hold_tip?}`, every field but `hold_tip` required, none defaulted. rig-c's `segments` lattice over the part at `cell` px, each vertex pulled by every link of the mesh's `segments` within `radius` px of it — a pull that falls to exactly 0 at `radius` (`shape` `"linear"` or `"smooth"`), across the `segments` entries or only within the nearest one (`across`), the strongest `max` kept. The lattice and the shares are computed by rig-c's own promised functions (`buildSegmentsLattice`, `segmentDistance`, `influenceShares`), so the rule is rig-c's (its AUTHORING §3.4.7), and the mesh is written with explicit weights like every other mode. `radius` is a length on this part: the rig stage measures the farthest lattice vertex's distance to its nearest link and refuses a radius at or under it (`RIG_INFLUENCE_REACH`), naming the distance. `propose --cloth` drafts it when a recipe declares `influence` and no `radius` (issue #518): the farthest vertex's distance plus 3 of the part's lattice cells, printed on a `LINT` line with both figures. Measured on the cloth fixture and the public `wind` example (#513: 8 covered parts, `render --folds` with the physics on under wind and a hip sway of 8° and 30°): a radius just above the floor folds **more** than the lattice (one skirt went from 0 to 55 folded frames), and a larger one is **not** safer (one fringe folded again at about 3–4× its farthest distance); +2 to +6 cells read 0 on every part, +2 at the edge. That reading counted folds only; read against `check` as well (the rig as built, under the wind schedule +1 → −1 → calm, `build --environment`, the three covered `wind` parts at the same number of cells), the window that holds is **+2 to +3 cells**, and +4 is the ceiling: `wind` `bottomwear`'s `CHECK_TIP_OVER_ROOT` ratio is 1.898 on the lattice, 1.801 at +2 cells, 1.590 at +3 and **1.471 at +4**, under the floor 1.4725, so the build fails there, and 1.351 at +6 (#513, rig-parts 1.52.0, rigc 2.60.0; the lattice, +3 and +4 read again on rig-parts 1.54.0, rigc 2.60.0, the same figures, #599). The drafted +3 sits in that window, one cell under the ceiling (no radius between +3 and +4 was read), and the window is a hypothesis until a third subject — each edge rests on one part — so state `radius` in the recipe to keep your own. `r`, `exponent`, `rule`, `influences`, `stray` and `ribs` belong to the distance rule or another mode and are refused beside it (`CONFIG_INFLUENCE_MODE`). `hold_tip` (issue #615) — `true` only, or absent: the pulled shares are smoothed by the lattice's held-fork passes (the cloth recipe's `split.hold_tip` sentence below: four passes of 1-ring mesh-edge averaging, self weight 0.5, floor 0.005) capped at the declared `max`, so no vertex binds more than `max` bones; absent, the shares are rig-c's as pulled and every byte is the one written before the field existed (`false`, a second spelling of absent, is `CONFIG_FIELD_TYPE`). The mesh's `mesh_report.json` row echoes it in `influence`. `propose --cloth` writes it, with `max` raised to at least 8 (the lattice's smoothing cap), on the parts a recipe with `influence` and `split.hold_tip: true` meshes; the rig stage reads it off the mesh and never the recipe. Measured on `wind` `bottomwear` and the cloth fixture's skirt under a 60° hip sway (#615, `render --folds`, physics on): `wind` `bottomwear` folds 41 frames as drafted before the field (max 6) and **0** with `hold_tip` and max 8, against its lattice's 5; with `hold_tip` at max 6 it reads 23, and at max 8 without `hold_tip` 3; the fixture skirt (recipe given `split.hold_tip`) reads 20 before and 0 with it, against its lattice's 0, and 0 at max 8 without it. So the raised `max` carries most of the gap and the smoothing the rest on `wind` (rig-parts 1.54.0, rigc 2.60.0; a split skirt without `hold_tip` is not smoothed and reads its 44 as before). For cloth and hair that should bend as one surface across its chains |
|
|
@@ -877,6 +877,59 @@ The first character built this way (the exam-01 test rig, issue #349) read, per
|
|
|
877
877
|
missing cap pixels at the elbows and knees and 468 and 562 at the ankles, where the shoe starts
|
|
878
878
|
below the ankle line.
|
|
879
879
|
|
|
880
|
+
### Front slots (issue #664)
|
|
881
|
+
|
|
882
|
+
A gesture set (`assemble.alternates`, issue #476) replaces a limb's attachments
|
|
883
|
+
but cannot change where they are drawn: a set maps slot to attachment and never
|
|
884
|
+
reorders slots. A forearm brought across the chest is drawn where the base arm
|
|
885
|
+
is, behind the topwear and the face. A **front slot** is a second slot for one
|
|
886
|
+
segment, declared on its limb:
|
|
887
|
+
|
|
888
|
+
```json
|
|
889
|
+
"limbs": { "arm_r": { "segments": [ … ], "front": { "parts": ["forearm_r"], "after": "face" } } }
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
and drawn on by a set that names the part in its own `front`:
|
|
893
|
+
|
|
894
|
+
```json
|
|
895
|
+
{ "name": "chest", "parts": ["upperarm_r", "forearm_r"], "drawn": { "sleeve_r1": 0 }, "front": ["forearm_r"] }
|
|
896
|
+
```
|
|
897
|
+
|
|
898
|
+
- `front.parts` is a nonempty list of this limb's own segment parts, each once
|
|
899
|
+
(`CONFIG_FRONT_SCOPE`). `front.after` names one produced part — the same
|
|
900
|
+
notion a layout's `part` target uses, so a consumed source layer is not one —
|
|
901
|
+
and not a segment of this same limb (`CONFIG_FRONT_NAME`).
|
|
902
|
+
- The rig stage adds `<part>_front` on the bone the part's base slot binds, with
|
|
903
|
+
**no setup attachment** (`"attachment": null`), and places it immediately
|
|
904
|
+
after `after`'s whole slot family (its slot and its `<part>_still`) in the
|
|
905
|
+
final setup order; several front slots after one family keep the config's
|
|
906
|
+
order. The slot rides stops and the turn control with the rest, and stays out
|
|
907
|
+
of the limb closure (#646). An empty front slot renders nothing: with no set
|
|
908
|
+
using it, the setup render is pixel-identical, and a config with no `front`
|
|
909
|
+
anywhere writes the same bytes as before.
|
|
910
|
+
- A set's `front` part is drawn from `slots["<part>_front"]` and its base slot
|
|
911
|
+
`<part>` is hidden while the set is active (`sets.json` `hides`, with
|
|
912
|
+
`<part>_still` when there is one); its attachment is filed under the front
|
|
913
|
+
slot's skin key, with the same bones and weights. A part in a set's `front`
|
|
914
|
+
must be covered by that set and declared on its limb (`CONFIG_SET_FRONT`); a
|
|
915
|
+
`parts.json` set record mapping both `<part>` and `<part>_front` is refused
|
|
916
|
+
(`RIG_SET_FRONT_BOTH`).
|
|
917
|
+
- `assemble` places the front part after its target when it clears the
|
|
918
|
+
set's part of what base parts cover (#587) and when it measures the set's
|
|
919
|
+
recomposite; `check --set` stacks the set's flat composite the same way, at
|
|
920
|
+
the front slot's place in the rig's final slot order, so the seam reads the
|
|
921
|
+
forearm against the parts now behind it.
|
|
922
|
+
- Version 1 does not compose with an explicit limb layout (#647): a config that
|
|
923
|
+
declares `front` on one limb and `layout` on any limb is refused
|
|
924
|
+
(`CONFIG_FRONT_LAYOUT`). Keyed draw-order changes are out of scope: a `{"t", "set"}`
|
|
925
|
+
key that switches a set drawing the track's part on its front slot is refused
|
|
926
|
+
(`CONFIG_SET_FRONT_KEYED`) — show such a set with `setSet`.
|
|
927
|
+
- `assemble` reads the front part's place off `parts.json`'s order (after
|
|
928
|
+
`after`), while the rig and `check --set` read it off the final setup slot
|
|
929
|
+
order. The two agree unless the limb closure (#646) moves the target's
|
|
930
|
+
family; then only the set's #587 exclusion and recomposite figures read the
|
|
931
|
+
parts order, and the render and its seam bar follow the rig.
|
|
932
|
+
|
|
880
933
|
### The weight cut (`meshes.<part>.influences`, issue #284)
|
|
881
934
|
|
|
882
935
|
This section and the mesh sections after it are for parts with no joints; a limb is cut at
|
|
@@ -2835,9 +2888,10 @@ valued destination path. Its modes have different ownership:
|
|
|
2835
2888
|
| `propose --head-box` | existing regular config | `seethrough.head_box` |
|
|
2836
2889
|
| `assemble --propose-plan` | existing regular config; must name `--config` itself | `assemble.plan`, `assemble.extend_below_crop` |
|
|
2837
2890
|
| ordinary `propose --parts` without `--cloth` | existing regular config | each present `PROPOSAL_CONFIG_SECTIONS` value: `bones`, `meshes`, `regions`, `limbs`, `motion`, `constraints`, `turn`, `proposed_rig_scale` |
|
|
2891
|
+
| ordinary `propose --parts … --only-missing` (issue #671) | existing regular config | only `meshes.<part>` or `regions.<part>`, as the proposal drafts it, for each proposed part the config attaches by neither, and an `assemble.plan` row for such a part from `full:drape-<s>` / `full:hand-<s>` the plan does not name (the drape just before the full run's `handwear-<s>` row, the hand just after it); added row by row and entry by entry, every existing row and entry and every other byte as read |
|
|
2838
2892
|
| `propose --cloth <input.json>` | new file | the recipe's edits spliced into the cloth config; §3, *The config written*, gives entry ownership, hand-edit conflicts and `--from <previous.json>` |
|
|
2839
2893
|
|
|
2840
|
-
For the first three modes, each selected field replaces its whole value; other
|
|
2894
|
+
For the first three modes (not `--only-missing`), each selected field replaces its whole value; other
|
|
2841
2895
|
fields and optional proposal sections not emitted are retained. Changed whole
|
|
2842
2896
|
values are spliced into the original text through `splicedEdits`, preserving
|
|
2843
2897
|
untouched bytes. `notes` stays in the proposal. The stage's loader validates a same-directory candidate before
|
|
@@ -2850,6 +2904,13 @@ of the proposing command. A refusal leaves the target config unchanged. The
|
|
|
2850
2904
|
writer lists changes on stderr, keeping the existing head-box and plan JSON on
|
|
2851
2905
|
stdout. Without the flag, no config is changed. `--from-config` proposes nothing
|
|
2852
2906
|
and refuses this flag; `--from` belongs to the cloth mode only.
|
|
2907
|
+
`--only-missing` (issue #671) is the upgrade path for a config proposed before a stage
|
|
2908
|
+
made a part it never named — the 1.37.0 arm split's `drape_<s>` and `hand_<s>`
|
|
2909
|
+
([MIGRATION](MIGRATION.md#after-1370-merged-arm-layers-are-split-issue-490)): the same
|
|
2910
|
+
loader validates the candidate, so an added region on a bone the config does not
|
|
2911
|
+
declare is refused naming the part and the bone (`CONFIG_NAME_RESOLVES`); a part of any
|
|
2912
|
+
other origin gets no plan row; nothing missing keeps the bytes and mtime; stderr names each added row and entry. It is a usage error with `--head-box`, `--cloth`
|
|
2913
|
+
or `--from-config`, or without `--parts` or `--write-config`.
|
|
2853
2914
|
All four modes use one file-writing adapter. Fresh cloth output keeps its
|
|
2854
2915
|
already-checked splice text and intentional partial-config contract; the full
|
|
2855
2916
|
loader is not imposed on it. Publication links the complete same-directory
|
|
@@ -3538,7 +3599,7 @@ says why each requirement exists and what breaks without it.
|
|
|
3538
3599
|
|
|
3539
3600
|
| rule | means | change |
|
|
3540
3601
|
| --- | --- | --- |
|
|
3541
|
-
| <a id="RIG_PART_PRESENT"></a><a id="RIG_PART_ATTACHED"></a>`RIG_PART_PRESENT`, `RIG_PART_ATTACHED` | a `meshes`/`regions` key that is not in `parts.json`, a part with neither, or a `painting:` part with a mesh | the config and the plan must name the same parts; a patch is a region |
|
|
3602
|
+
| <a id="RIG_PART_PRESENT"></a><a id="RIG_PART_ATTACHED"></a>`RIG_PART_PRESENT`, `RIG_PART_ATTACHED` | a `meshes`/`regions` key that is not in `parts.json`, a part with neither, or a `painting:` part with a mesh | the config and the plan must name the same parts; a patch is a region. A `drape_<s>` or `hand_<s>` from `full:drape-<s>` / `full:hand-<s>` is the 1.37.0 arm split's (issue #490), new to a config proposed before it: the detail names [MIGRATION](MIGRATION.md#after-1370-merged-arm-layers-are-split-issue-490), whose remedy is `propose … --write-config <config> --only-missing` (the two plan rows and the two entries) |
|
|
3542
3603
|
| <a id="RIG_PNG_PRESENT"></a><a id="RIG_PNG_MATCHES_BOX"></a><a id="RIG_PART_HAS_ART"></a>`RIG_PNG_PRESENT`, `RIG_PNG_MATCHES_BOX`, `RIG_PART_HAS_ART` | a part's PNG is missing, the wrong size, or has no art pixel | re-run assemble |
|
|
3543
3604
|
| <a id="RIG_NAME_RESOLVES"></a><a id="RIG_SEGMENT_DEFINED"></a><a id="RIG_CHAIN_POINTS"></a>`RIG_NAME_RESOLVES`, `RIG_SEGMENT_DEFINED`, `RIG_CHAIN_POINTS` | a segment names an undeclared bone, a bone with no `tip` and no next link, or a chain too short to make a link | that bone's `tip`, or write the segment out as `[bone, [x0,y0], [x1,y1]]` |
|
|
3544
3605
|
| <a id="RIG_INFLUENCES_KEPT"></a>`RIG_INFLUENCES_KEPT` | a mesh's declared `influences` leaves a vertex with no bone: every capped share is under 0.03 (at or under it, for the continuous floor). The largest of k shares is at least 1/k, so this needs 34 or more kept bones; the default cap of 4 never reaches it (issue #284). The detail names the first vertex, how many more, and its largest share | declare `maxInfluences` 33 or less, or name fewer bones in `segments` |
|
|
@@ -3557,6 +3618,12 @@ says why each requirement exists and what breaks without it.
|
|
|
3557
3618
|
| <a id="CONFIG_LAYOUT_TARGET"></a>`CONFIG_LAYOUT_TARGET` | `config.limbs.<name>.layout` declares both or neither `before`/`after`, or a target declares both or neither `limb`/`part` | write one immediate placement side and one typed named target |
|
|
3558
3619
|
| <a id="CONFIG_LAYOUT_NAME"></a>`CONFIG_LAYOUT_NAME` | a layout names no declared target limb or produced part; a consumed source layer is not an emitted part | use the declared limb or produced segment/part names printed in the detail |
|
|
3559
3620
|
| <a id="CONFIG_LAYOUT_SCOPE"></a>`CONFIG_LAYOUT_SCOPE` | layout `parts` is empty, duplicated, nonconsecutive, foreign, or names a rider instead of an own source-bound segment part | select distinct consecutive own segment-part references; inherited riders are proven separately |
|
|
3621
|
+
| <a id="CONFIG_FRONT_SCOPE"></a>`CONFIG_FRONT_SCOPE` | `config.limbs.<name>.front.parts` (issue #664) is empty, repeats a part, or names a part that is not one of this limb's own segment parts | list this limb's own segment parts, each once |
|
|
3622
|
+
| <a id="CONFIG_FRONT_NAME"></a>`CONFIG_FRONT_NAME` | `config.limbs.<name>.front.after` (issue #664) names no produced part (a consumed source layer is not one), or names a segment part of this same limb; or a part `front.parts` names would take the slot name `<part>_front` of a part the config already makes | name a produced part the limb is drawn behind, from the list in the detail; or rename the part holding that name |
|
|
3623
|
+
| <a id="CONFIG_FRONT_LAYOUT"></a>`CONFIG_FRONT_LAYOUT` | a config declares `config.limbs.<name>.front` (issue #664) while some limb declares `layout` (issue #647); version 1 does not compose the two | drop one of them on this rig |
|
|
3624
|
+
| <a id="CONFIG_SET_FRONT"></a>`CONFIG_SET_FRONT` | `assemble.alternates[i].front` (issue #664) is empty, repeats a part, or names a part the set does not cover (in its `parts`, not its `hides`) or that no `config.limbs.<limb>.front.parts` lists; the detail names the part and which held | cover the part in the set's `parts`, and declare its front slot on its limb |
|
|
3625
|
+
| <a id="CONFIG_SET_FRONT_KEYED"></a>`CONFIG_SET_FRONT_KEYED` | `motion.animations_from` (issue #664): a `{"t", "set"}` key on a slot attachment track names a set that draws the track's part on its front slot; that would change the draw order mid-clip, which is out of scope | show the set with `setSet`, or key a part the set draws on its base slot |
|
|
3626
|
+
| <a id="RIG_SET_FRONT_BOTH"></a>`RIG_SET_FRONT_BOTH` | a `parts.json` alternate record (issue #664) maps both a part's slot and its front slot `<part>_front`; the detail names the set and the part | re-run `assemble`, which maps one or the other |
|
|
3560
3627
|
| <a id="RIG_LAYOUT_NONEXCLUSIVE"></a>`RIG_LAYOUT_NONEXCLUSIVE` | a requested segment family/target, or an accepted replay's bindings, span owners or leave the selected segment scope across base/alternate attachments | correct the named bindings or scope; mixed ownership is never forced and no stale proof is emitted |
|
|
3561
3628
|
| <a id="RIG_LAYOUT_UNREPRESENTABLE"></a>`RIG_LAYOUT_UNREPRESENTABLE` | the named slot family is absent, a target is not contiguous, the accepted slot population/adjacency changed, or final rig text is stale | use an emitted contiguous target and the exact final accepted source; unrelated slots are not absorbed |
|
|
3562
3629
|
| <a id="RIG_LAYOUT_CONFLICT"></a>`RIG_LAYOUT_CONFLICT` | layout declarations share a slot, target themselves, or form a reciprocal/chained pair; both field paths are printed | declare one disjoint pair, with each participating slot in only that placement |
|
package/docs/MIGRATION.md
CHANGED
|
@@ -342,6 +342,76 @@ What to do: nothing. A warning names the pair, the animation, the frames and the
|
|
|
342
342
|
an opening that is not intended wants a cap that covers the turn, or a motion that bends
|
|
343
343
|
less.
|
|
344
344
|
|
|
345
|
+
## After 1.37.0: merged arm layers are split (issue #490)
|
|
346
|
+
|
|
347
|
+
Issue #490 splits a full-run `handwear-<s>` layer that See-through merged — the sleeve,
|
|
348
|
+
the bare hand at `<s>_wrist`, and an overgarment drape reaching more than a forearm's
|
|
349
|
+
length below the wrist, the drape's colour at least 80 off the sleeve's — into
|
|
350
|
+
`drape-<s>`, `handwear-<s>` and `hand-<s>`, whenever the config carries
|
|
351
|
+
`generation.control.skeleton` (the wrist and the forearm are read off it). `assemble`
|
|
352
|
+
rewrites a plan's lone `full` `handwear-<s>` row into three: `drape_<s>` behind, the
|
|
353
|
+
row's own part (the sleeve, which keeps `handwear-<s>`), and `hand_<s>` in front.
|
|
354
|
+
|
|
355
|
+
Who is affected: a config proposed before 1.37.0 whose plan takes `handwear-<s>` from
|
|
356
|
+
the full run and that carries `generation.control.skeleton` — and only where that layer
|
|
357
|
+
is a merged arm run; a config whose arm layer holds the sleeve alone builds as before.
|
|
358
|
+
Its `meshes` and `regions` never named the two new parts, so `rig` refuses each by name
|
|
359
|
+
(issue #671):
|
|
360
|
+
|
|
361
|
+
```
|
|
362
|
+
RIG_PART_ATTACHED: part "drape_r" — is in parts.json and has neither a config.meshes nor a config.regions entry; exactly one is required — the full run's merged arm layer was split into this part (issue #490, from 1.37.0), …
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
| change | before | after |
|
|
366
|
+
| --- | --- | --- |
|
|
367
|
+
| `assemble.plan` as `assemble` reads it, a lone `["<name>", "full", "handwear-<s>"]` row over a merged arm run | the row | `["drape_<s>", "full", "drape-<s>"]`, the row, `["hand_<s>", "full", "hand-<s>"]` |
|
|
368
|
+
| `parts.json` | one part holding sleeve, hand and drape | `drape_<s>` (`full:drape-<s>`), the sleeve part (`full:handwear-<s>`), `hand_<s>` (`full:hand-<s>`) |
|
|
369
|
+
| `rig` on a config without entries for them | — | `RIG_PART_ATTACHED` for each, the detail naming this entry and `--only-missing` |
|
|
370
|
+
| `propose … --write-config <config> --only-missing` | — | new (issue #671): adds only the plan rows and entries the config lacks for them |
|
|
371
|
+
|
|
372
|
+
What to do, keeping every entry you tuned — one command, after `assemble` has written
|
|
373
|
+
the split parts:
|
|
374
|
+
|
|
375
|
+
```
|
|
376
|
+
rig-parts propose --parts <work/rig> --source <painting> --out <dir> --write-config config.json --only-missing
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
For each part the config attaches by neither `meshes` nor `regions`, it adds what is
|
|
380
|
+
missing and nothing else (issue #671):
|
|
381
|
+
|
|
382
|
+
- a part from `full:drape-<s>` or `full:hand-<s>` that `assemble.plan` does not name gains
|
|
383
|
+
its plan row where `assemble` rewrites it: `["drape_<s>", "full", "drape-<s>"]` just
|
|
384
|
+
before the row that takes `handwear-<s>` from the full run, `["hand_<s>", "full",
|
|
385
|
+
"hand-<s>"]` just after it. `assemble` then takes the plan as written and makes the
|
|
386
|
+
same `parts.json` byte for byte. The config loader reads `meshes` and `regions` against
|
|
387
|
+
the parts the plan makes, so the entries need the rows;
|
|
388
|
+
- the part gains `meshes.<part>` or `regions.<part>` as the proposal drafts it.
|
|
389
|
+
|
|
390
|
+
Every existing plan row, every existing entry, every other section and every other byte
|
|
391
|
+
stays as read, each addition is spliced in alone, and stderr names each row and entry
|
|
392
|
+
added. The full loader reads the result before it replaces the file: an entry on a bone
|
|
393
|
+
your config does not declare is refused naming the part and the bone, and nothing is
|
|
394
|
+
written. A second run with nothing missing changes no byte.
|
|
395
|
+
|
|
396
|
+
Or by hand, the same four additions: the two plan rows above, and a region for each part.
|
|
397
|
+
`propose` drafts both as regions: `hand_<s>` on the tip link of `sleeve_<s>` where it
|
|
398
|
+
drafts a sleeve chain (a handwear part over 500 px, or the arm drafted from
|
|
399
|
+
`--keypoints`; its note reads `hand_<s> (full:hand-<s>): split hand -> region on
|
|
400
|
+
sleeve_<s>2, the tip link of sleeve_<s>` for a three-link chain); otherwise `hand_<s>`,
|
|
401
|
+
like `drape_<s>` always, rides the trunk bone by its box's centre height — `head` above
|
|
402
|
+
the neck line, `chest` above the hip, else `hip` (its note reads `drape_<s>
|
|
403
|
+
(full:drape-<s>): no rule -> region on hip`). Confirm against the notes `propose` prints
|
|
404
|
+
for your parts; the bone must be one your config declares.
|
|
405
|
+
|
|
406
|
+
**An alternate set made before 1.37.0** that covers the split sleeve (a set over the part
|
|
407
|
+
that takes `handwear-<s>`) still covers only that part. The split made `hand_<s>` and
|
|
408
|
+
`drape_<s>` parts of their own, so while the set is active the base draws them beside the
|
|
409
|
+
set's own sleeve art, which still holds the hand it was painted with. `check --set` then
|
|
410
|
+
fails the set's seam (`CHECK_SEAM_WITHIN_BAR`, issue #671); its detail names the parts and
|
|
411
|
+
this entry. What to do: add them to the set's `hides`, for example `"hides": ["hand_r",
|
|
412
|
+
"drape_r"]`, or only `hand_<s>` if the set's painting still shows the base drape. This is
|
|
413
|
+
a judgement on the set's own art, so `--only-missing` does not write it.
|
|
414
|
+
|
|
345
415
|
## After 1.38.0: cloth that comes to rest on the idle
|
|
346
416
|
|
|
347
417
|
Issue #501 reads every physics chain by its tip on the idle `check` renders (physics on,
|
package/docs/STABILITY.md
CHANGED
|
@@ -56,7 +56,7 @@ defaults are the help's too, and none is guessed from the art.
|
|
|
56
56
|
| `comfy` | `seethrough`: `--image`, `--out`; optional `--resolution`, `--steps`, `--seed`, `--prefix`, `--offload`, `--lama`, `--nf4`, `--host`, `--wait`, `--timeout`, `--poll` |
|
|
57
57
|
| `assemble` | `--propose-plan` with `--source`, `--full`, `--config`, optional `--head`, `--write-config` (must name `--config` itself, issue #356); or `--source`, `--full`, `--config`, `--out`, optional `--head` (without it, one run: issue #359), `--seam` (near-white, silhouette), `--project` (core, visible), `--alt` (repeatable `<name>=<source>:<full>[:<head>]`, issue #454) |
|
|
58
58
|
| `propose` | `--head-box` with `--full`, `--canvas`; optional `--no-back-hair`, `--write-config` (existing config, issue #356) |
|
|
59
|
-
| `propose` | `--parts`, `--source`, `--out`; optional `--compare` or `--from-config` (one of them), `--keypoints`, `--person` and `--wrist-snap` (each with `--keypoints`), `--full`, `--head` (the turn control's depths; not with `--from-config`), `--grid-rule` (`figure` or `part`, the drafted lattice's spacing; not with `--from-config`), `--cloth` (a config whose `cloth` block is the recipe, issue #364; not with `--from-config`), `--write-config` (existing config for an ordinary proposal, issue #356; a new file with `--cloth`, issue #537; not with `--from-config` — additive: without it nothing `propose` writes changes), `--from` (the config the recipe is changed from, only with `--write-config`, issue #571 — additive: without it nothing `--write-config` writes changes) |
|
|
59
|
+
| `propose` | `--parts`, `--source`, `--out`; optional `--compare` or `--from-config` (one of them), `--keypoints`, `--person` and `--wrist-snap` (each with `--keypoints`), `--full`, `--head` (the turn control's depths; not with `--from-config`), `--grid-rule` (`figure` or `part`, the drafted lattice's spacing; not with `--from-config`), `--cloth` (a config whose `cloth` block is the recipe, issue #364; not with `--from-config`), `--write-config` (existing config for an ordinary proposal, issue #356; a new file with `--cloth`, issue #537; not with `--from-config` — additive: without it nothing `propose` writes changes), `--from` (the config the recipe is changed from, only with `--write-config`, issue #571 — additive: without it nothing `--write-config` writes changes), `--only-missing` (only with `--parts` and `--write-config`, not with `--cloth` or `--from-config`, issue #671 — additive: without it nothing `--write-config` writes changes) |
|
|
60
60
|
| `compare` | `--left`, `--right`; optional `--map` |
|
|
61
61
|
| `rig` | `--config`, `--parts`, `--out`; optional `--idle-keys` (ctl, direct), `--page-edges` (pot, free), `--pack-shape` (rect, polygon) |
|
|
62
62
|
| `check` | `--rig`, `--out`; optional `--parts`, `--source`, `--page-edges`, `--pack-shape`, `--requirements`, `--seam-pairs`, `--keep-stills`, `--set` or `--all-sets` (issue #454), `--environment` (issue #538, additive) |
|
|
@@ -127,13 +127,14 @@ part name, `[i]` an entry of a list):
|
|
|
127
127
|
- **seethrough** — required: `resolution`, `steps`, `seed`, `offload`; optional: `head_box`, `arm_split`
|
|
128
128
|
- **seethrough.arm_split** — required: `order`, and one of `x` or `line` (issue #439)
|
|
129
129
|
- **assemble** — required: `rig_scale`, `plan` (from plain `assemble` on); optional: `extend_below_crop`, `patches`, `cuts`, `alternates`, `head_face_underfill`
|
|
130
|
-
- **assemble.alternates[i]** — required: `name`; optional: `source`, `full`, `head`, `parts`, `hides`, `head_box`, `cuts`, `skeleton`, `drawn`, `tips` (issues #454, #465, #652)
|
|
130
|
+
- **assemble.alternates[i]** — required: `name`; optional: `source`, `full`, `head`, `parts`, `hides`, `head_box`, `cuts`, `skeleton`, `drawn`, `tips`, `front` (issues #454, #465, #652, #664)
|
|
131
131
|
- **assemble.extend_below_crop[i]** — required: `part`, `run`, `tag`
|
|
132
132
|
- **assemble.patches[i]** — required: `name`, `box`, `alpha`, `draw`
|
|
133
133
|
- **assemble.patches[i].draw**, when an object — required: `before`
|
|
134
134
|
- **assemble.cuts[i]** — required: `from`, `into`, `polygon`, `draw`, `overlap`; optional: `under`, `under_fill`
|
|
135
135
|
- **assemble.cuts[i].draw**, when an object — required: `before`
|
|
136
|
-
- **limbs.<limb>** — required: `segments`; optional: `split`, `layout` (issues #349, #446, #647)
|
|
136
|
+
- **limbs.<limb>** — required: `segments`; optional: `split`, `layout`, `front` (issues #349, #446, #647, #664)
|
|
137
|
+
- **limbs.<limb>.front** — required: `parts` (own segment parts, issue #664), `after` (a produced part)
|
|
137
138
|
- **limbs.<limb>.layout** — exactly one of `before`, `after`; optional: `parts` (own consecutive segment-part references, issue #647)
|
|
138
139
|
- **limbs.<limb>.layout.before**, **limbs.<limb>.layout.after** — exactly one typed target: `limb` or `part`
|
|
139
140
|
- **limbs.<limb>.segments[i]** — required: `part`, `from`, `bone`; required below a joint (i > 0): `joint`; optional below a joint: `range`, `cap`, `edge`, `cap_shape`, `cut_band`
|
|
@@ -204,7 +205,7 @@ every number) are AUTHORING §3's tables, and the loader refuses any other by na
|
|
|
204
205
|
| the template `.psd` | `layers --template` | one empty layer per name `templateLayerNames` (`src/layers.ts`) holds, bottom first; the same canvas writes the same bytes |
|
|
205
206
|
| `proposal.json`, `render/landmarks*.png` | `propose` | the config's four rig sections, `constraints` with `--cloth` (issue #364: a physics constraint per tree link named `<bone>_physics`, a dangling end's `<bone>_translate`, and a skirt swing's transforms `<swing>_<tree>`), `turn` with `--full`/`--head`, `proposed_rig_scale` (issue #354), and `notes` |
|
|
206
207
|
| `basis.json` | `propose` | spec `spine-parts-basis/1` |
|
|
207
|
-
| an existing config named by `--write-config` | `propose --head-box`, `assemble --propose-plan`, ordinary `propose` | issue #356, additive: `assemble --propose-plan` must update `--config` itself; only the selected proposed fields are replaced by whole-value text splices, preserving untouched bytes; absent optional proposal sections and other fields remain; the stage loader validates before atomic replacement, relative paths keep their base, an unchanged update preserves bytes and mtime, and stderr lists changes; no multi-artifact transaction is promised |
|
|
208
|
+
| an existing config named by `--write-config` | `propose --head-box`, `assemble --propose-plan`, ordinary `propose` | issue #356, additive: `assemble --propose-plan` must update `--config` itself; only the selected proposed fields are replaced by whole-value text splices, preserving untouched bytes; absent optional proposal sections and other fields remain; the stage loader validates before atomic replacement, relative paths keep their base, an unchanged update preserves bytes and mtime, and stderr lists changes; no multi-artifact transaction is promised; with `--only-missing` (issue #671) only a `meshes.<part>` or `regions.<part>` entry for a proposed part the config attaches by neither is added, and an `assemble.plan` row for such a part the 1.37.0 arm split makes that the plan does not name, every existing row and entry and every other byte as read |
|
|
208
209
|
| a new `--write-config` file | `propose --cloth … --write-config` | complete checked splice text published without overwrite; an intervening creator is refused, while cleanup failure after publication may leave the complete new file present; intentional partial configs retain their existing contract; the `--cloth` config read, byte for byte, but for the entries the recipe drafts (issue #537), measured against the same parts drafted without it: `meshes.<part>` and `regions.<part>` for each part the recipe moves, and `bones`, `constraints` and `motion.tracks` entry by entry by name (issue #552) — an entry the recipe drafts replaced or inserted, one it replaces removed, every other entry kept with its bytes and its place, and a hand edit to an entry the recipe owns refused by name (`PROPOSE_WRITE_CONFIG_CONFLICT`) rather than dropped; a section the input lacks is inserted; with `--from <previous config>` (issue #571) an entry equal to the previous recipe's draft is the recipe's as well |
|
|
209
210
|
| `config.json`, `mesh_draft.json` | `mesh-draft` | `config.json` is the config read, byte for byte, but for each drafted part's `meshes` entry; `mesh_draft.json` is spec `rig-parts-mesh-draft/1`: `rules`, `lattice_check`, `draft_check`, `figure_overdraw`, and per lattice part `part`, `mode`, `lattice`, `candidate` (with `bridges` — `units`, `joins` of `span` and `area_px2`, `area_px2`, `overdraw`, and `faint` only when an island was left out as faint — only when the candidate is a bridged one, issue #326), `delta` (under `--more-triangles` only), `readings`, `gate` (each line's `reading`, `pass`, `text`, `margin`), `note`; and `not_compared` (issue #307), only when the config holds an `auto` or `contour` entry: per such entry, in config order, `part`, `mode` and `note` — the part was neither drafted nor compared, and a config of lattices alone writes no such key |
|
|
210
211
|
| `rig.json`, `motion.json`, `mesh_report.json`, `images/`, `remesh.json` | `remesh` | the input revision's files, `rig.json` and `mesh_report.json` with the part's attachment and row replaced (under `--delta` the row is the input's with its counts, `bones` and influences recomputed and `mode` "delta"), every other file byte for byte; `remesh.json` is spec `rig-parts-remesh/1`: `request` (`part`, `mesh`, `mesh_sha256`, `idle_keys`, `page_edges`, `pack_shape`; under `--delta`, issue #526: `part`, `delta` — the mesh edit as read — `delta_sha256`, `ops`, `applied` — `moved`, `added`, `removed`, `constrained` — `idle_keys`, `page_edges`, `pack_shape`), `versions` (`parts`, `rigc`), `input` (`rig` — `path`, `bytes`, `sha256` per file — `config_sha256`, `parts_json_sha256`), `baseline` (`reproduced`, `not_compared`; under `--delta` `reproduced` holds one sentence: no config is built, the input is the baseline), `target` (`before`, `after`: `vertices`, `triangles`, `hull`), `preserved` (`identical`, `spliced`), `revision` (per file as `input.rig`), `check` (`input`, `revision`: `pass`, `measured`, `not_met`, `skipped`, `physics`, then `line` and `status` — issue #541, additive, the spec stays `rig-parts-remesh/1`: `line` is the last line `check` prints on that tree, byte for byte, and `status` every block's status as that tree's `check.json` records it, by name in the file's order — `gate`, `loop` and `seam` read from their figures, every other block its own `status`, a block the file does not write absent; `scope`) |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rig-parts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.60.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
|
"bin": {
|
package/src/build.ts
CHANGED
|
@@ -80,7 +80,7 @@ import { CONTROL_SUFFIX, withAnimations } from './motion.ts';
|
|
|
80
80
|
import type { PaletteError } from './palette.ts';
|
|
81
81
|
import { type LayerSet, readLayers } from './layers.ts';
|
|
82
82
|
import { placeBoneEntriesForSkeleton, poseBoneEntriesForDrawn, REGISTER_OFFSET_BAR, REGISTER_SCALE_BAR, registeredWithinBar, registerSkeleton, SKELETON_LIMB_BONES, skeletonDrawnLength, skeletonLimbJoints } from './limbs.ts';
|
|
83
|
-
import { type AlternatePartsRecord, type PartRecord, readParts, type RecompositeRecord, type SingleRunPad, tagOf, writeParts } from './parts.ts';
|
|
83
|
+
import { type AlternatePartsRecord, FRONT_SUFFIX, type PartRecord, readParts, type RecompositeRecord, type SingleRunPad, tagOf, writeParts } from './parts.ts';
|
|
84
84
|
import { encodePngBytes, readPng, writePng } from './raster/png.ts';
|
|
85
85
|
import type { Raster } from './raster/types.ts';
|
|
86
86
|
import { type Mask, newMask } from './raster/types.ts';
|
|
@@ -287,6 +287,28 @@ export function readCaps(configPath: string, limbs: Readonly<Record<string, Limb
|
|
|
287
287
|
return out;
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
+
/**
|
|
291
|
+
* Issue #664: `items` (in parts.json's order) with each part named in `front`
|
|
292
|
+
* moved to just after the part `after` maps it to — where its front slot draws
|
|
293
|
+
* it. Several front parts after one target keep `items`' order. A part whose
|
|
294
|
+
* target is not among `items` stays where it is. With `front` empty, `items`.
|
|
295
|
+
*/
|
|
296
|
+
export function frontOrdered<T extends { record: { name: string } }>(items: readonly T[], front: ReadonlySet<string>, after: ReadonlyMap<string, string>): T[] {
|
|
297
|
+
if (front.size === 0) return [...items];
|
|
298
|
+
const names = new Set(items.map((x) => x.record.name));
|
|
299
|
+
const moving = items.filter((x) => front.has(x.record.name) && names.has(after.get(x.record.name) ?? '') && after.get(x.record.name) !== x.record.name);
|
|
300
|
+
const out: T[] = [];
|
|
301
|
+
const place = (x: T): void => {
|
|
302
|
+
if (out.includes(x)) return;
|
|
303
|
+
out.push(x);
|
|
304
|
+
for (const m of moving) if (after.get(m.record.name) === x.record.name) place(m);
|
|
305
|
+
};
|
|
306
|
+
for (const x of items) if (!moving.includes(x)) place(x);
|
|
307
|
+
// Front parts whose targets form a cycle have no anchor: they are appended at the end, in items' order.
|
|
308
|
+
for (const x of items) place(x);
|
|
309
|
+
return out;
|
|
310
|
+
}
|
|
311
|
+
|
|
290
312
|
/** Read, assemble, and write only after every refusal has had its chance. Throws a PartsError on a refusal, having written nothing. */
|
|
291
313
|
export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs, log: Log): AssembleResult {
|
|
292
314
|
// The early door: assemble runs before propose has drafted bones, meshes,
|
|
@@ -318,6 +340,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
318
340
|
skeleton?: string;
|
|
319
341
|
drawn?: Record<string, number>;
|
|
320
342
|
tips?: Record<string, [number, number]>;
|
|
343
|
+
front?: string[];
|
|
321
344
|
}> = cfgAlts.map((a, i) => {
|
|
322
345
|
const cli = cliByName.get(a.name);
|
|
323
346
|
if (cli !== undefined) cliByName.delete(a.name);
|
|
@@ -334,6 +357,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
334
357
|
skeleton: a.skeleton === undefined ? undefined : resolve(configDir, a.skeleton),
|
|
335
358
|
drawn: a.drawn,
|
|
336
359
|
tips: a.tips,
|
|
360
|
+
front: a.front,
|
|
337
361
|
};
|
|
338
362
|
});
|
|
339
363
|
for (const cli of cliByName.values()) {
|
|
@@ -349,6 +373,9 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
349
373
|
const altProblems: Problem[] = [];
|
|
350
374
|
const altBuilt: Array<{ record: AlternatePartsRecord; images: Array<{ name: string; image: Raster }>; excluded: ExcludedCount[]; islands: IslandCount[]; splits: SplitCount[]; capSplits: SplitCount[] }> = [];
|
|
351
375
|
const baseSlots = result.parts.parts.map((p) => p.name);
|
|
376
|
+
// Issue #664: each limb segment part with a declared front slot -> the part its front slot follows.
|
|
377
|
+
const frontAfter = new Map<string, string>();
|
|
378
|
+
for (const limb of Object.values(fields.limbs ?? {})) for (const p of limb.front?.parts ?? []) frontAfter.set(p, (limb.front as { after: string }).after);
|
|
352
379
|
for (const alt of mergedAlts) {
|
|
353
380
|
if (alt.source === undefined || alt.full === undefined) {
|
|
354
381
|
altProblems.push({
|
|
@@ -566,10 +593,17 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
566
593
|
if (altOthers !== undefined && input.setSplit === 'whole-limb') altOthers.line = 'whole-limb';
|
|
567
594
|
// Issue #587: a subset set's limb part takes nothing a base part it does not replace covers at setup.
|
|
568
595
|
const [exW, exH] = result.parts.rig_size;
|
|
596
|
+
// Issue #664: a part the set draws on its front slot is drawn after its front slot's target, so only base parts
|
|
597
|
+
// drawn after that target cover it; every other segment part keeps the base order.
|
|
598
|
+
const altFront = new Set(alt.front ?? []);
|
|
599
|
+
const altSegParts = Object.values(altLimbs).flatMap((l) => l.segments.map((sg) => sg.part));
|
|
600
|
+
const replacedSet = new Set([...coveredSet, ...hidesSet]);
|
|
569
601
|
const altExclude =
|
|
570
602
|
alt.parts === undefined || input.setExclusion === 'none'
|
|
571
603
|
? []
|
|
572
|
-
:
|
|
604
|
+
: altFront.size === 0
|
|
605
|
+
? setExclusions(result.images, exW, exH, altSegParts, replacedSet)
|
|
606
|
+
: altSegParts.flatMap((sp) => setExclusions(altFront.has(sp) ? frontOrdered(result.images, new Set([sp]), frontAfter) : result.images, exW, exH, [sp], replacedSet));
|
|
573
607
|
let altRes: ReturnType<typeof assemble>;
|
|
574
608
|
try {
|
|
575
609
|
altRes = assemble({
|
|
@@ -614,12 +648,12 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
614
648
|
.map(({ record, image }) => ({ name: `${alt.name}_${record.name}`, image }));
|
|
615
649
|
const keptRecords = altRes.parts.parts.filter((p) => coveredSet.has(p.name));
|
|
616
650
|
const slots: Record<string, string> = {};
|
|
617
|
-
for (const r of keptRecords) slots[r.name] = `${alt.name}_${r.name}`;
|
|
651
|
+
for (const r of keptRecords) slots[altFront.has(r.name) ? `${r.name}${FRONT_SUFFIX}` : r.name] = `${alt.name}_${r.name}`;
|
|
618
652
|
let altRecomposite = altRes.parts.recomposite as RecompositeRecord;
|
|
619
653
|
if (alt.parts !== undefined) {
|
|
620
654
|
const [rW, rH] = result.parts.rig_size;
|
|
621
655
|
const altByName = new Map(altRes.images.map((x) => [x.record.name, x]));
|
|
622
|
-
const fullSetPlaced = result.images
|
|
656
|
+
const fullSetPlaced = frontOrdered(result.images, altFront, frontAfter)
|
|
623
657
|
.filter(({ record }) => !hidesSet.has(record.name))
|
|
624
658
|
.map((baseItem) => altByName.get(baseItem.record.name) ?? baseItem);
|
|
625
659
|
const altSrcRig = sourceInRig(altSrc, rW, rH);
|
|
@@ -630,7 +664,8 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
630
664
|
record: {
|
|
631
665
|
name: alt.name,
|
|
632
666
|
...(alt.parts === undefined ? {} : { parts: [...alt.parts] }),
|
|
633
|
-
...(alt.hides === undefined || alt.hides.length === 0 ? {} : { hides: [...alt.hides] }),
|
|
667
|
+
...(alt.hides === undefined || alt.hides.length === 0 ? (altFront.size === 0 ? {} : { hides: [...altFront] }) : { hides: [...alt.hides, ...[...altFront].filter((p) => !(alt.hides as string[]).includes(p))] }),
|
|
668
|
+
...(altFront.size === 0 ? {} : { front: [...altFront] }),
|
|
634
669
|
slots,
|
|
635
670
|
records: keptRecords,
|
|
636
671
|
ghost_px: altRes.parts.ghost_px,
|