spine-parts 2.14.1 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/AUTHORING.md +7 -6
- package/docs/STABILITY.md +1 -1
- package/package.json +1 -1
- package/src/assemble.ts +120 -26
- package/src/build.ts +1 -0
- package/src/config.ts +15 -1
package/docs/AUTHORING.md
CHANGED
|
@@ -152,14 +152,14 @@ read by no CPU stage).
|
|
|
152
152
|
| `assemble.ground` | assemble, build | **authored**, optional `"plain"` or `"busy"` (issue #996): what lies behind the figure in the painting. `plain` (the default) is a ground of one colour; `busy` is an opaque ground of many colours (a wall, a banner). Read by `--project visible` only: a busy, opaque ground needs `assemble.ground: busy`; without it, visible takes backdrop pixels. An invalid value is `CONFIG_FIELD_TYPE` at `config.assemble.ground`. Absent or `plain`, existing build bytes are unchanged. `assemble` warns (`ASSEMBLE_GROUND_PLAIN`, §5), under project: visible, where paintingEdges reads the ground, when a plain ground's border ring is not one colour. |
|
|
153
153
|
| `assemble.rig_scale` | assemble — the rig is `trunc(w × rig_scale)` x `trunc(h × rig_scale)`, and every rig-px value after it (`bones`, `meshes`, `motion`, `patches`, `cuts`) is in that rig's pixels; `check --source` (`CHECK_SOURCE_SIZE`) and `compose` (`SCENE_RIG_SCALE_AGREES`) read it back off `parts.json` | authored; rig pixels per source pixel. 0.5 in both examples (a 1664x2432 painting makes an 832x1216 rig). **Keep the figure about 1,100 to 1,200 rig px tall** — the `H` of `propose`'s `mesh spacing:` note, the height of the parts' boxes together — so for another painting, about 1,150 over the figure's height in painting px: that is the size the proposer's spacing divisor was calibrated at (H 1106–1185, the `mesh spacing` note says so) and the size of the two examples `check`'s bars are derived from, and the proposer and `check` also hold fixed rig-px values that do not scale with it (the fringe's 10 px step, the trunk segments' 18, 20, 30 and 100 px, the 15 px wrist tolerance, the 10-row pendant floor, the seam bar's 50 rig px over 40). What else it trades, measured on `demo` with the README loop from a fresh config at 0.25, 0.5 and 1 (issue #345, rig-c 2.47.1): the same plan and the same ten chains; every bar but the one the uncorrected `demo` always fails (`bottomwear` `TIP_OVER_ROOT`, the README loop's `RL01`) passing at all three; the atlas page 418x606, 832x1205 and 1825x2047; the figure's mesh spacing 16, 32 and 64, so 830, 868 and 932 triangles; the breath 2.5 % of a torso that scales with it; and the proposed bones, scaled to 0.5, off the 0.5 proposal's by up to 38 px at 0.25 and 22.5 px at 1 (the hairpin's origin; the skirt roots 20 and 10.5) — the fixed-px values above. `propose` records it on the proposal as `proposed_rig_scale` (issue #354), and changing `assemble.rig_scale` after the rig sections are written is refused (`CONFIG_PROPOSED_RIG_SCALE`): without that refusal `demo`'s tracked config built at 0.25 gated green and `check` failed only `TIP_OVER_ROOT` on both sleeves (`propose --from-config` named 54 `LINT` lines, links off the art) — re-run `assemble` and `propose` at the new scale. Absent: `CONFIG_FIELD_PRESENT`; 0, negative or not a number: `CONFIG_FIELD_TYPE`; a rig under 1x1: `ASSEMBLE_RIG_SIZE` |
|
|
154
154
|
| `assemble.plan` | assemble; also the list every `meshes`/`regions` key must come from | **proposed** by `assemble --propose-plan`. `[part name, "full" \| "head", See-through tag]`, in draw order back to front. Names are free; roles come from the tag. A layer the author made and added to a run takes `author:<label>` in the tag's place, and has no role (§5, *A layer the author made*). When `generation.control.skeleton` is present and a full-run `handwear-r` or `handwear-l` layer merges sleeve, bare hand and overgarment drape into one layer — a skin-coloured hand cluster (`>= 40` run px, `GHOST_MIN_AREA`, measured `516..4,787` run px across the 9-standee corpus) lies within `0.35` forearm lengths of `<s>_wrist` and non-skin pixels reach more than `1.0x` the forearm length (`<s>_elbow -> <s>_wrist`) below `<s>_wrist` (issue #490; measured `-0.15x..0.45x` on the 6 clean standees vs `1.25x..2.02x` on the 3 merged standees, placing `1.0x` inside the `0.45x..1.25x` gap) — the layer is split into `drape-<s>`, `handwear-<s>` and `hand-<s>` (back to front) when the Euclidean RGB distance between the sleeve median colour above `<s>_wrist` and the drape median colour below `<s>_wrist` is at least `80` (`ARM_DRAPE_COLOR_DISTANCE`, measured `103.6..236.0` on the two distinct-colour merged standees vs `20.8..28.2` on the same-colour merged standee, placing `80` between `28.2` and `103.6`), or refused with `SEETHROUGH_ARM_RUN_MERGED` when the distance is under `80` |
|
|
155
|
-
| `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 |
|
|
155
|
+
| `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. With optional `edges: ["left", "right", "top", "bottom"]`, copies full-run pixels at alpha >= 128 beyond only those actual crop edges; no rim is grown and no pixel whose centre lies inside the half-open crop is written. The entry must name a head-run part and full-run layer of the same tag. Omit `edges` to retain the original inset bottom, component seeding and rim behavior. |
|
|
156
156
|
| `assemble.extend_painting` | assemble, base painting only — assigns unheld opaque painting samples to declared final layer-derived parts | **authored**, optional array of `{part, band: [x0,y0,x1,y1], max_distance, min_held_alpha?, order?}`; part, band and max_distance required, integer rig pixels, half-open band and positive maximum four-neighbour path length. Off when absent or empty. See [Bounded painting extension](#bounded-painting-extension-issue-848) |
|
|
157
157
|
| `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). Use [Source before scissors](#source-before-scissors) before a patch; §5 describes structural placement |
|
|
158
158
|
| `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 structural separation under [Source before scissors](#source-before-scissors), cut from a plan part's layer by the author's polygon: 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 |
|
|
159
159
|
| `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?, anchor?, base_anchor?, 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>]`. Windows absolute drive paths such as `C:\paint\painting.png` are accepted as written; each segment's leading drive colon belongs to that path, while other colons still separate `source`, `full` and `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 `layers` optionally maps covered, nonhidden output part names to layer names in their existing source run (issue #666); for example `"layers": {"upperarm_r": "author:raised", "forearm_r": "author:raised"}`. Limb cuts, caps, islands and base exclusions read the selected layer; the base plan stays unchanged. |
|
|
160
160
|
| `assemble.head_face_underfill` | assemble, `assemble --propose-plan` | **authored**, optional (issue #492): `boolean` (`CONFIG_FIELD_TYPE` on any other). During head-face preparation, when both runs exist and `full:face` has at least `150` 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`). An explicit plan selecting `head:face` is refused when that layer covers 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), with `SEETHROUGH_HEAD_RUN_HOLLOW`, unless `head_face_underfill: true` is declared. When `head_face_underfill: true` is declared and `head:face` exists (`opaqueRunPx >= 150`), `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; follow [Source before scissors](#source-before-scissors) for its source remedy. When `head:face` has fewer than `150` 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. The proposer instead selects `full:face` after this refusal when that full-run candidate passes the pixel floor and plausibility guards (issue #863); if it does not, the refusal remains. An assemble plan selecting `full:face` without `head:face` does not prepare the unused head face |
|
|
161
161
|
| `assemble.yield_refused` | assemble | **authored**, optional boolean, default `false` (issue #819; other types: `CONFIG_FIELD_TYPE`). With `true`, an original front projection-core pixel refused at max-channel drift > `DRIFT_LIMIT` (90) can yield when its original source pixel is still opaque. Non-core rim pixels (0 < alpha < `CORE_ALPHA`, 250) on the same 8-connected part body can then yield too (issue #832). Connectivity reads the part support before clearing: the opaque border outside the eroded projection core connects the body to its rim but is not itself newly cleared. A separate rim island without a yielded core seed is unchanged. At every cleared pixel, the actual top-most opaque holder below it (alpha >= 250), after earlier yields, must have colour within 90 of the painting. A deeper matching part cannot bypass an intervening opaque mismatch. This setting also applies to alternate sets. A yielded pixel's alpha becomes 0 and its RGB is not repainted. Accepted own-core pixels in the same connected support within the original yielded core's Gaussian footprint (radius 4 rig pixels), with a matching opaque behind holder, finish to painting RGB while retaining alpha and ownership (issue #841); original refusals, protected samples and replacements are excluded. Away from that footprint projection is unchanged. Merge/ring replacements, samples explicitly kept by `keep_under_occluders`, and pixels outside a derived piece cannot connect a rim or be newly yielded. Front is relative to the matching part behind, so original refusals in another run are eligible even when a different part is the global top holder. The reading proceeds back to front against the current behind pixels; alpha changes do not repaint or create a new matching colour. `yieldReadings` optionally records `finishedProjection` (accepted samples whose RGB changed), and records `yieldedRim` as the rim subset of total `yielded`, skipped core merge/ring/nonopaque/no-match counts and original/final global holders; a yielded pixel also taken by projection closing is omitted from the written `source_px_taken` count. Existing cuts/patches and thresholds are unchanged. The `drift:` line reports `yielded N px` per affected part, even below the drift-body size bar; with the setting off it names `assemble.yield_refused: true` as the conditional remedy. Rebuild and inspect the newly exposed layer in motion before considering any cut; a mismatching or absent behind holder cannot be repaired by this setting. |
|
|
162
|
-
| `assemble.keep_under_occluders` | assemble | **authored**, optional array of unique source part names from `assemble.plan`, default `[]` (issue #825). For each named part, keep its own See-through RGBA where the front-most covering part in the final draw stack has alpha greater than 0 and below `CORE_ALPHA` (250), including a cover in the other run.
|
|
162
|
+
| `assemble.keep_under_occluders` | assemble | **authored**, optional array of unique source part names from `assemble.plan`, default `[]` (issue #825). For each named part, keep its own See-through RGBA where the front-most covering part in the final draw stack has alpha greater than 0 and below `CORE_ALPHA` (250), including a cover in the other run. Covers at raw alpha <= 8 are ghosts and are not kept under; a ghost-cleaned sample with final alpha 0 is absent cover and does not trigger restoration. Only original opaque own-layer samples are restored after source projection/closing and protected from later seam re-take; merged/rim, cap, under-fill and authored replacement pixels are excluded. This keeps their existing provenance and makes no holes; fully opaque cover and absent cover keep the old path. Cuts and limb pieces inherit the source part's protection. Unknown names: `CONFIG_NAME_RESOLVES`; duplicates: `CONFIG_PART_UNIQUE`; invalid shape: `CONFIG_FIELD_TYPE`. Inspect the part's own amodal layer first: this handle preserves its existing content and cannot complete a missing pixel — in particular, it does not close a motion opening inside the figure (`figure_openings` / [Openings inside the figure on undeclared layer pairs](#openings-inside-the-figure-on-undeclared-layer-pairs-issue-933)) where the lower layer has no opaque core under an opaque upper layer (measured with every `assemble.plan` part named in `keep_under_occluders`: `0` of `1` pair-animation warnings across `demo`'s eight animations closed, with `hair_back\|handwear_r` on `hop` frame `5` staying at `40` cells over `28` allowed in `38x70` world units at `2.517` world units/cell, while `scarf` reads `CLEAR` (`0` warnings) both with and without `keep_under_occluders`; use `assemble.extend_painting` when the lower part lacks opaque source material under an opaque upper cover). Example: `"keep_under_occluders": ["shin_r"]`. |
|
|
163
163
|
| `assemble.editor_receipts` | assemble, build | **authored**, optional (issue #946): `{receipts: [{file, sha256, from_sha256, editor}], required?, trace_parts?}`. Each receipt records an image edited in an image editor; `file` (relative to the config's directory) must exist and hash to `sha256`, verified at assemble; `from_sha256` and `editor` are the author's declaration, held only to form. With `required: true`, every author-made layer, hidden-art layer, cut `under` and limb `cap` the build reads, alternate sets' runs included, needs a receipt whose `sha256` is its file's. With `trace_parts: true` (issue #947), every part's pixels must trace to a layer of the split or to a receipted image: the receipts are demanded as under `required`, and every shape the config draws through a part — a cut's `polygon`, `seethrough.arm_split`, a limb's `split.line`, a patch's `box`, a painting extension's `band` — is refused (`ASSEMBLE_PART_SOURCE`). Absent, no file is read and no byte moves. See [Editor receipts](#editor-receipts-assembleeditor_receipts-issue-946) and [Part sources](#part-sources-assembleeditor_receiptstrace_parts-issue-947). |
|
|
164
164
|
| `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?, hybrid?}, …], 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) |
|
|
165
165
|
| `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 |
|
|
@@ -990,7 +990,7 @@ receipt covers, and nothing else:
|
|
|
990
990
|
What stays: a limb's segments are cut at the joint the bones place, not along a
|
|
991
991
|
drawn line, and a limb `split` with `"edge": "painting"` follows the painting's
|
|
992
992
|
stroke; a `take` entry's layer is another run's, held by its identity receipt;
|
|
993
|
-
`extend_below_crop` continues a part from a full-run layer; projection, the seam
|
|
993
|
+
`extend_below_crop` continues a part from a full-run layer (optional `edges` selects actual crop edges; omitted, the original bottom-only rule); projection, the seam
|
|
994
994
|
override and the fringe push-back write inside a layer's own footprint. The
|
|
995
995
|
remedy for a refused part is an author layer (`author:<label>`) painted in an
|
|
996
996
|
image editor, with its receipt, or the part taken whole from a layer of the
|
|
@@ -4075,7 +4075,7 @@ valued destination path with two destination rules — **in place on an existing
|
|
|
4075
4075
|
| proposal mode | destination | fields written |
|
|
4076
4076
|
| --- | --- | --- |
|
|
4077
4077
|
| `propose --head-box` | existing regular config | `seethrough.head_box` |
|
|
4078
|
-
| `assemble --propose-plan` | existing regular config; must name `--config` itself | `assemble.plan`, `assemble.extend_below_crop` |
|
|
4078
|
+
| `assemble --propose-plan` | existing regular config; must name `--config` itself | `assemble.plan`, `assemble.extend_below_crop`. Front/back hair reaching more than 8 rig pixels beyond a side or top edge receives explicit `edges`; each explicit edge has the same strict reach bar. The legacy bottom entry is retained unchanged; qualifying side/top edges receive a separate entry without bottom. With no qualifying side/top edge, the proposal remains unchanged. |
|
|
4079
4079
|
| ordinary `propose --parts` without `--cloth` | existing regular config | each present `PROPOSAL_CONFIG_SECTIONS` value: `bones`, `meshes`, `regions`, `limbs`, `motion`, `constraints`, `turn`, `motion_seams`, `proposed_rig_scale` |
|
|
4080
4080
|
| ordinary `propose --parts … --only-missing` (issues #671, #679) | existing regular config | only resolvable `meshes.<part>` or `regions.<part>` for an unattached part: attached covers existing `meshes` and `regions`, source parts consumed by the config's own `limbs.<name>.segments[].from`, and `assemble.patches` (always regions), with or without `--keypoints`. Entries are checked against the config's bones and chains, including mesh and `auto` bone/region references; an unresolved entry is never written. Each skipped part gets a note naming its attachment or the unresolved reference and why. An accepted split part from `full:drape-<s>` / `full:hand-<s>` also gains its missing `assemble.plan` row (drape before the full run's `handwear-<s>` row, hand after it); added row by row and entry by entry, every existing byte as read |
|
|
4081
4081
|
| `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>` |
|
|
@@ -4121,7 +4121,7 @@ existing hardlinks are refused before artifact output; the ordinary mode names
|
|
|
4121
4121
|
| `comfy seethrough --image --out [--host]` | optional: run the ComfyUI See-through wrapper on one image and write the form `layers` reads |
|
|
4122
4122
|
| `layers <dir \| layers.json \| file.psd>` | keep the existing columns (`opaque_px` still means alpha >8) and append source-alpha boxes `drawn(a>8)` / `opaque(a>=250)` with exclusive right/bottom; name absent boxes, report the existing body-group union height at **CORE_ALPHA (>=250)** in **input-canvas px**, and show its >8 union separately; no anatomical height, ownership/erosion or painting registration is inferred ([units and rig-scale guidance](AUTHORING.md#4-the-command-order)) |
|
|
4123
4123
|
| `sheet --source <png> --layers <path>… --out <png>` | a labelled contact sheet of the painting and every layer or part |
|
|
4124
|
-
| `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) |
|
|
4124
|
+
| `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). Front/back hair reaching more than 8 rig pixels beyond a side or top edge receives explicit `edges`; each explicit edge has the same strict reach bar. The legacy bottom entry is retained unchanged; qualifying side/top edges receive a separate entry without bottom. With no qualifying side/top edge, the proposal remains unchanged. |
|
|
4125
4125
|
| `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 |
|
|
4126
4126
|
| `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 |
|
|
4127
4127
|
| `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 |
|
|
@@ -5228,6 +5228,7 @@ those settings. Changing a config seed alone cannot change a no-config run.
|
|
|
5228
5228
|
| <a id="ASSEMBLE_RUN_CANVAS"></a>`ASSEMBLE_RUN_CANVAS` | a run's canvas is not `resolution` square; with one run (issue #366), a side of the file is above `resolution` — a smaller one is padded, a larger one would have to be shrunk | `seethrough.resolution`, or the run |
|
|
5229
5229
|
| <a id="ASSEMBLE_SINGLE_RUN_SOURCE"></a>`ASSEMBLE_SINGLE_RUN_SOURCE` | with no `--head` (issue #366), the painting `--source` names is not the one run's file's size: the painting is the file flattened, and every part's box maps back to the file through it | the painting — the file flattened, at the file's size |
|
|
5230
5230
|
| <a id="ASSEMBLE_SINGLE_RUN_FACE"></a>`ASSEMBLE_SINGLE_RUN_FACE` | with no `--head` (issue #359), the one run holds no painted layer for one of `face`, `eyewhite-r`, `eyewhite-l` — the parts the head run exists to separate (one problem per tag) | paint the layer, or give the head run with `--head` |
|
|
5231
|
+
| <a id="ASSEMBLE_CROP_CLIPPED"></a>`ASSEMBLE_CROP_CLIPPED` | informational: a head-run part has full-run pixels at alpha >= 128 outside its crop that the plan does not cover; gives a union count, per-edge counts (corners count on both edges), and the subset the legacy bottom rule could select | declare `assemble.extend_below_crop` with explicit `edges` for side/top continuation; inside-crop label disagreements are not measured by this line |
|
|
5231
5232
|
| <a id="ASSEMBLE_SINGLE_RUN_PLAN"></a>`ASSEMBLE_SINGLE_RUN_PLAN` | with no `--head`, a plan row takes `"head"`, or an `extend_below_crop` entry continues a part below a crop there is not | `"full"` in the row; remove the entry |
|
|
5232
5233
|
| <a id="ASSEMBLE_SINGLE_RUN_HEAD_BOX"></a>`ASSEMBLE_SINGLE_RUN_HEAD_BOX` | with no `--head`, the config sets `seethrough.head_box`, which places a head run there is not | remove `head_box`, or give the head run with `--head` |
|
|
5233
5234
|
| <a id="ASSEMBLE_ARM_SPLIT_CUTS_ARM"></a>`ASSEMBLE_ARM_SPLIT_CUTS_ARM` | `seethrough.arm_split` cuts a horizontal opaque run of the arm layer into more than two segments (issue #439; the detail gives the row, the run and the split x) | `seethrough.arm_split`: move `x` or `line` so each horizontal opaque run of the arm layer is split at most once |
|
|
@@ -5741,7 +5742,7 @@ The body-root bar counts stock partitions `gapOpen` plus `ghostA` or `ghostB` ow
|
|
|
5741
5742
|
|
|
5742
5743
|
**Why `fillHoles(a ∪ b)` and why warning (`WARN`), not a bar:** counting only cells inside the holes of the pair's own posed union (`fillHoles(a ∪ b)`) rather than of the whole figure (`fillHoles(frameUnion)`) eliminates all `36` third-part pocket warnings on `demo` (where a cheek-to-ponytail or arm-to-waist pocket is closed only by a third part such as the collar, shoulder or torso), so all five public examples read `CLEAR` (`0` warnings) on `idle`, and `reference-demo`, `reference-sample`, `scarf` and `wind` read `CLEAR` (`0` warnings) across every animation. The single remaining warning across all five public examples (`demo` `hair_back|handwear_r` on `hop` frames `[5-6]`, worst frame `5` at `t = 0.417s`: `found 40 cell(s), <= 28 cell(s) allowed in 38x70 world units at 2.517 world units/cell`) was visually inspected and is a false positive from a silhouette loop between `hair_back` and `handwear_r` themselves: on `demo`, `hair_back`'s right twin-tail curls inward behind the right arm and touches `handwear_r` both above (at the puff sleeve) and below (at the curled hair tip near the wrist), so `hair_back ∪ handwear_r` alone encloses a small background window between the forearm and the curling hair lock; when the character jumps in `hop`, that window shifts into the world cells that `hair_back` and `handwear_r` covered at `t = 0`. Because two layers with curved silhouettes can enclose a deliberate background loop between themselves during a jump, `figure_openings` is a **warning (`WARN`, never a bar)**.
|
|
5743
5744
|
|
|
5744
|
-
**How `assemble.keep_under_occluders` relates:** `assemble.keep_under_occluders` only preserves a named lower part's original See-through RGB where the lower layer **already has** `alpha >= 250` (`CORE_ALPHA`) beneath a translucent front cover (`0 < alpha < 250
|
|
5745
|
+
**How `assemble.keep_under_occluders` relates:** `assemble.keep_under_occluders` only preserves a named lower part's original See-through RGB where the lower layer **already has** `alpha >= 250` (`CORE_ALPHA`) beneath a translucent front cover (`0 < alpha < 250` in the final stack). Where an upper layer was opaque at setup (`alpha >= 250`) or the lower layer had no opaque core under the upper layer (or where a silhouette loop shifts in world space), `keep_under_occluders` changes nothing: measured with every `assemble.plan` part named in `keep_under_occluders`, **0 of 1** pair-animation warnings on `demo` closed (`hair_back|handwear_r` on `hop` frame `5` stayed at `40` cells over `28` allowed in `38x70` world units at `2.517` world units/cell), and `scarf` read `CLEAR` (`0` warnings) both with and without `keep_under_occluders`. To close a genuine tear where the lower layer lacks opaque art under an opaque upper layer, use `assemble.extend_painting` (or adjust mesh weights / motion keys so the upper part does not slide off the lower part's boundary). **Diagnostic preview background:** `rigc render` composites diagnostic frame PNGs over `BACKGROUND = [232, 232, 232, 255]` (`#e8e8e8` light grey), which visually masks an `alpha == 0` sliver next to light cloth, pale hair or skin; reading `alpha == 0` on the posed skeleton's transparent composite catches the opening regardless of preview background colour.
|
|
5745
5746
|
|
|
5746
5747
|
### compose
|
|
5747
5748
|
|
package/docs/STABILITY.md
CHANGED
|
@@ -154,7 +154,7 @@ part name, `[i]` an entry of a list):
|
|
|
154
154
|
- **seethrough.arm_split** — required: `order`, and one of `x` or `line` (issue #439)
|
|
155
155
|
- **assemble** — required: `rig_scale`, `plan` (from plain `assemble` on); optional: `seam`, `project`, `ground`, `extend_below_crop`, `patches`, `cuts`, `alternates`, `head_face_underfill`, `yield_refused`, `keep_under_occluders`, `extend_painting`, `take`, `editor_receipts`
|
|
156
156
|
- **assemble.alternates[i]** — required: `name`; optional: `source`, `full`, `head`, `parts`, `hides`, `head_box`, `cuts`, `skeleton`, `anchor`, `base_anchor`, `drawn`, `tips`, `front`, `layers`, `focus` (issues #454, #465, #543, #652, #664, #666, #719, #780). `focus` is an authored finite `[x, y]` in painting pixels, within its canvas (edges included), refused as CONFIG_SET_FOCUS before assemble output when invalid; only when present, `parts.json` records it with focus_source_size and `sets.json` emits it in setup-world coordinates through the actual rig resize and `src/coords.ts`. Absent focus emits no field or inferred value; changing/removing it requires reassembly
|
|
157
|
-
- **assemble.extend_below_crop[i]** — required: `part`, `run`, `tag`
|
|
157
|
+
- **assemble.extend_below_crop[i]** — required: `part`, `run`, `tag`; optional: `edges` (left, right, top, bottom; explicit edges require a head-run part and the full-run layer of the same tag)
|
|
158
158
|
- **assemble.extend_painting[i]** — required: `part`, `band`, `max_distance`; optional: `min_held_alpha`, `order` (issues #848, #854, #855; explicit final layer-derived part, half-open rig band and positive four-neighbour path bound; base painting only). The optional integer floor 1–255 admits exact original alpha-over coverage strictly below it; absent or 1 blocks every nonzero holder. Only selected target samples below the floor may take painting RGBA; target samples at/above the floor and every non-target holder remain exact. By default overlapping reachable claims refuse. With `order` on every entry (unique nonnegative safe integers), lower values claim first and their gains block later candidates and paths; array order never breaks ties or supplies missing precedence
|
|
159
159
|
- **assemble.take[i]** — required: `run`, `run_dir`, `st_input`; optional: `tags`, `part`, `seed`, `reference`, `crop` (issues #866, #973, #1000, #1031). Whole-layer entries require `tags`; region entries require `part` and `seed`. An absent `reference` preserves the shipped `source: true` predicate and emits one named implicit-reference warning; only an explicitly declared painting reference makes the mask invariant to changes in `--source`
|
|
160
160
|
- **assemble.take[i].crop** — required when present: `box`, `resample` (issue #973, additive, whole-layer entries only). `box` is an inside nonempty integer source-painting `[left, top, right, bottom]` with exclusive right/bottom. `resample: "bilinear"` is required explicitly. Donor input must match the square-padded crop under taken support plus its margin. Unit scale and integer translation copy RGBA exactly; other maps use the declared premultiplied float32 affine filter. Absent, the shipped geometry predicate and refusal message remain unchanged. Region entries reject this field
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spine-parts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.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/assemble.ts
CHANGED
|
@@ -112,7 +112,7 @@ import { bindDepthRun, copyDepthMaterial, registerDepthRun, transportPartDepth,
|
|
|
112
112
|
* Pure: no clock, no randomness, no file access. The CLI reads and writes.
|
|
113
113
|
*/
|
|
114
114
|
import { sourceLimbTarget, nearestTargetPart } from './limbownership.ts';
|
|
115
|
-
import { type ArmSplit, type BoneEntry, type CharacterConfig, type ConfigConstraint, type ControlSkeleton, controlSkeletonOf, type Cut, type EarlyConfig, type Extend, type Limb, type MeshSpec, type Patch, type PlanEntry, type RegionSpec, type Run, type SeeThrough, turnMovingPartPair, type TurnSpec } from './config.ts';
|
|
115
|
+
import { type ArmSplit, type BoneEntry, type CharacterConfig, type ConfigConstraint, type ControlSkeleton, controlSkeletonOf, type CropEdge, type Cut, type EarlyConfig, type Extend, type Limb, type MeshSpec, type Patch, type PlanEntry, type RegionSpec, type Run, type SeeThrough, turnMovingPartPair, type TurnSpec } from './config.ts';
|
|
116
116
|
import { PartsError, type Problem, refuseIfAny } from './errors.ts';
|
|
117
117
|
import { CORE_ALPHA, figuresPhrase, implausibleRules, type Layer, type LayerFigures, layerFigures, type LayerSet, NEAR_WHITE_MIN, OPAQUE_ALPHA_ABOVE, ruleSummary } from './layers.ts';
|
|
118
118
|
import { padToSquare, squarePad } from './inputs.ts';
|
|
@@ -2415,6 +2415,86 @@ export function belowCrop(part: Raster, extra: Raster, headBottom: number): Mask
|
|
|
2415
2415
|
return sel;
|
|
2416
2416
|
}
|
|
2417
2417
|
|
|
2418
|
+
/** The declared crop rectangle, in rig pixels; the legacy inset bottom is separate. */
|
|
2419
|
+
export function cropBounds(frame: Pick<Frame, 'headBox' | 'S'>): [number, number, number, number] {
|
|
2420
|
+
return frame.headBox.map(v => v * frame.S) as [number, number, number, number];
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
/** Copy full-run alpha >= 128 only where pixel centres lie outside the half-open crop. */
|
|
2424
|
+
export function beyondCrop(extra: Raster, box: readonly number[], edges: readonly CropEdge[]): Mask {
|
|
2425
|
+
const sel = newMask(extra.width, extra.height);
|
|
2426
|
+
const [left, top, right, bottom] = box;
|
|
2427
|
+
for (let y = 0; y < extra.height; y++) for (let x = 0; x < extra.width; x++) {
|
|
2428
|
+
const p = y * extra.width + x;
|
|
2429
|
+
if (extra.data[p * 4 + 3] < 128) continue;
|
|
2430
|
+
const cx = x + 0.5, cy = y + 0.5;
|
|
2431
|
+
if (edges.some(edge => edge === 'left' ? cx < left : edge === 'right' ? cx >= right : edge === 'top' ? cy < top : cy >= bottom)) sel.data[p] = 1;
|
|
2432
|
+
}
|
|
2433
|
+
return sel;
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
/** Keep the original merge byte-for-byte when no explicit edge is declared. */
|
|
2437
|
+
function mergeCropEntries(part: Raster, extras: Raster[], front: Mask, srcr: Raster, frame: Frame, entries: Extend[], trace: MergeTrace, changed: (rigPixel: number, stage: 'extend' | 'growRim') => void): number {
|
|
2438
|
+
if (entries.every(e => e.edges === undefined)) return mergeBelowCrop(part, extras, front, srcr, frame.headBottom, trace, changed);
|
|
2439
|
+
let merged = 0;
|
|
2440
|
+
entries.forEach((entry, e) => {
|
|
2441
|
+
if (entry.edges === undefined) {
|
|
2442
|
+
const local: MergeTrace = { from: new Int32Array(part.width * part.height).fill(-1), ring: newMask(part.width, part.height) };
|
|
2443
|
+
merged = mergeBelowCrop(part, [extras[e]], front, srcr, frame.headBottom, local, changed);
|
|
2444
|
+
for (let p = 0; p < local.from.length; p++) if (local.from[p] >= 0) { trace.from[p] = e; trace.ring.data[p] = local.ring.data[p]; }
|
|
2445
|
+
trace.lastSel = local.lastSel;
|
|
2446
|
+
trace.lastRing = local.lastRing;
|
|
2447
|
+
return;
|
|
2448
|
+
}
|
|
2449
|
+
const sel = beyondCrop(extras[e], cropBounds(frame), entry.edges);
|
|
2450
|
+
merged = 0;
|
|
2451
|
+
for (let p = 0; p < sel.data.length; p++) {
|
|
2452
|
+
if (sel.data[p] === 0) continue;
|
|
2453
|
+
if (!rgbaEqual(part.data, p * 4, extras[e].data, p * 4)) changed(p, 'extend');
|
|
2454
|
+
part.data.set(extras[e].data.subarray(p * 4, p * 4 + 4), p * 4);
|
|
2455
|
+
trace.from[p] = e;
|
|
2456
|
+
trace.ring.data[p] = 0;
|
|
2457
|
+
merged++;
|
|
2458
|
+
}
|
|
2459
|
+
trace.lastSel = sel;
|
|
2460
|
+
trace.lastRing = newMask(part.width, part.height);
|
|
2461
|
+
});
|
|
2462
|
+
return merged;
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
/** Informational line registered by the authoring rule ledger. */
|
|
2466
|
+
export const CROP_CLIPPED_LINE = 'ASSEMBLE_CROP_CLIPPED';
|
|
2467
|
+
|
|
2468
|
+
/** Name uncovered full-run support outside each head part's crop; no raster writes. */
|
|
2469
|
+
export function cropClippedLines(plan: readonly PlanEntry[], extend: readonly Extend[], rigOf: (run: Run, tag: string) => Raster | null, frame: Frame): string[] {
|
|
2470
|
+
const lines: string[] = [];
|
|
2471
|
+
const box = cropBounds(frame);
|
|
2472
|
+
const covered = planCoverage(plan, extend, (run, tag) => rigOf(run, tag)!, frame.headBottom, box);
|
|
2473
|
+
for (const [name, run, tag] of plan) {
|
|
2474
|
+
if (run !== 'head') continue;
|
|
2475
|
+
const extra = rigOf('full', tag), part = rigOf('head', tag);
|
|
2476
|
+
if (extra === null || part === null) continue;
|
|
2477
|
+
const legacy = belowCrop(part, extra, frame.headBottom);
|
|
2478
|
+
const counts: Record<CropEdge, number> = { left: 0, right: 0, top: 0, bottom: 0 };
|
|
2479
|
+
let total = 0, legacyPx = 0;
|
|
2480
|
+
for (let y = 0; y < extra.height; y++) for (let x = 0; x < extra.width; x++) {
|
|
2481
|
+
const p = y * extra.width + x;
|
|
2482
|
+
if (extra.data[p * 4 + 3] < 128 || covered[p] === 1) continue;
|
|
2483
|
+
const edges: CropEdge[] = [];
|
|
2484
|
+
if (x + 0.5 < box[0]) edges.push('left');
|
|
2485
|
+
if (x + 0.5 >= box[2]) edges.push('right');
|
|
2486
|
+
if (y + 0.5 < box[1]) edges.push('top');
|
|
2487
|
+
if (y + 0.5 >= box[3]) edges.push('bottom');
|
|
2488
|
+
if (edges.length === 0) continue;
|
|
2489
|
+
total++;
|
|
2490
|
+
for (const edge of edges) counts[edge]++;
|
|
2491
|
+
if (legacy.data[p] === 1) legacyPx++;
|
|
2492
|
+
}
|
|
2493
|
+
if (total > 0) lines.push(` ${CROP_CLIPPED_LINE}: part "${name}" (full:${tag}) has ${total} uncovered px at alpha >= 128 outside the head crop; edges ${Object.entries(counts).filter(([, n]) => n > 0).map(([e, n]) => `${e} ${n}`).join(', ')}; legacy extend_below_crop selects ${legacyPx}/${total} (bottom seeded components only; side/top require explicit edges)`);
|
|
2494
|
+
}
|
|
2495
|
+
return lines;
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2418
2498
|
/**
|
|
2419
2499
|
* Close the half-pixel seam round a merged-in piece: the full run's silhouette
|
|
2420
2500
|
* is a few pixels narrower than the painting, and a renderer's sub-pixel
|
|
@@ -4628,6 +4708,8 @@ export interface AssembleResult {
|
|
|
4628
4708
|
edgeResiduals?: EdgeResidualReport;
|
|
4629
4709
|
/** Report-only source re-take under actual soft front support (#825). */
|
|
4630
4710
|
softOcclusion?: SoftOcclusionReading[];
|
|
4711
|
+
/** Informational only; never serialized into parts.json. */
|
|
4712
|
+
cropClipped?: string[];
|
|
4631
4713
|
parts: PartsFile;
|
|
4632
4714
|
/** In plan order, each cropped to its record's box. */
|
|
4633
4715
|
images: PlacedPart[];
|
|
@@ -4966,7 +5048,6 @@ function assembleParts(input: AssembleInput, targets?: ReadonlySet<string>, befo
|
|
|
4966
5048
|
const patchIds = patches.map((_, i) => editId(`patches[${i}]`));
|
|
4967
5049
|
const layerWriters = new Map<string, Int32Array>();
|
|
4968
5050
|
const valueBaselines = new Map<string, ValueBaseline | null>();
|
|
4969
|
-
const cleanedSoftCover = new Map<string, Mask>();
|
|
4970
5051
|
// Extend-only rasters are still projected/merged, but are never emitted as own sources.
|
|
4971
5052
|
const readKeys = new Set(sourcePlan.map(([, run, tag]) => `${run}:${tag}`));
|
|
4972
5053
|
const rig = new Map<string, Raster>();
|
|
@@ -5040,17 +5121,6 @@ function assembleParts(input: AssembleInput, targets?: ReadonlySet<string>, befo
|
|
|
5040
5121
|
}
|
|
5041
5122
|
// Keep only samples that could equal a final opaque pixel; full raw and
|
|
5042
5123
|
// prepared normalization temporaries end with this layer's callback.
|
|
5043
|
-
// A low-alpha source fringe removed by cleanGhosts still contributed to
|
|
5044
|
-
// the painting. Retain its source footprint only for explicit opt-in;
|
|
5045
|
-
// final piece regions below still decide which side of a cut owns it.
|
|
5046
|
-
if ((input.keepUnderOccluders?.length ?? 0) > 0 && raw !== null && preparedWriter === 0) {
|
|
5047
|
-
let footprint: Mask | null = null;
|
|
5048
|
-
for (let p = 0; p < W * H; p++) if (raw.data[p * 4 + 3] > 0 && raw.data[p * 4 + 3] <= OPAQUE_ALPHA_ABOVE && rigLayers[i].data[p * 4 + 3] === 0) {
|
|
5049
|
-
footprint ??= newMask(W, H);
|
|
5050
|
-
footprint.data[p] = 1;
|
|
5051
|
-
}
|
|
5052
|
-
if (footprint !== null) cleanedSoftCover.set(key, footprint);
|
|
5053
|
-
}
|
|
5054
5124
|
valueBaselines.set(key, raw === null ? null : compactValueBaseline(raw));
|
|
5055
5125
|
return ids;
|
|
5056
5126
|
});
|
|
@@ -5197,7 +5267,7 @@ function assembleParts(input: AssembleInput, targets?: ReadonlySet<string>, befo
|
|
|
5197
5267
|
const f = rig.get(`${run2}:${tag2}`) as Raster;
|
|
5198
5268
|
for (let p = 0; p < W * H; p++) if (f.data[p * 4 + 3] >= FRONT_ALPHA) front.data[p] = 1;
|
|
5199
5269
|
}
|
|
5200
|
-
merged =
|
|
5270
|
+
merged = mergeCropEntries(r, extras, front, srcr, frame, extend.filter(e => e.part === name), trace, (p, stage) => { writers[p] = AW[stage]; });
|
|
5201
5271
|
}
|
|
5202
5272
|
const { x1, opaque } = measureBox(r);
|
|
5203
5273
|
if (opaque === 0 && !emptyTargets?.has(name)) {
|
|
@@ -5529,12 +5599,7 @@ function assembleParts(input: AssembleInput, targets?: ReadonlySet<string>, befo
|
|
|
5529
5599
|
if (!enabled && (writer !== AW.sourceProjection || rgbaEqual(b.r.data, p * 4, raw, q))) continue;
|
|
5530
5600
|
if (writer !== AW.sourceProjection && !rgbaEqual(b.r.data, p * 4, raw, q)) continue;
|
|
5531
5601
|
for (let j = stack.length - 1; j > i; j--) {
|
|
5532
|
-
|
|
5533
|
-
const frontSlot = order[j];
|
|
5534
|
-
if (alpha === 0 && enabled && !('patch' in frontSlot)) {
|
|
5535
|
-
const cover = pieceAt(frontSlot).b;
|
|
5536
|
-
if ((cover.region === null || cover.region.data[p] === 1) && cover.trace.from[p] < 0 && cover.trace.ring.data[p] === 0 && cleanedSoftCover.get(cover.key)?.data[p] === 1) alpha = OPAQUE_ALPHA_ABOVE;
|
|
5537
|
-
}
|
|
5602
|
+
const alpha = stack[j].image.data[p * 4 + 3];
|
|
5538
5603
|
if (alpha === 0) continue;
|
|
5539
5604
|
if (alpha < CORE_ALPHA) {
|
|
5540
5605
|
const different = !rgbaEqual(b.r.data, p * 4, raw, q);
|
|
@@ -5941,6 +6006,7 @@ function assembleParts(input: AssembleInput, targets?: ReadonlySet<string>, befo
|
|
|
5941
6006
|
if (supportFigure !== undefined && supportSilhouette !== null) for (let p = 0; p < supportPainted.length; p++) supportFigure.data[p] = supportSilhouette.data[p] & supportPainted[p];
|
|
5942
6007
|
return {
|
|
5943
6008
|
...(softOcclusion.length === 0 ? {} : { softOcclusion }),
|
|
6009
|
+
...(!single ? { cropClipped: cropClippedLines(plan, extend, (run, tag) => rig.get(`${run}:${tag}`) ?? null, frame) } : {}),
|
|
5944
6010
|
parts: {
|
|
5945
6011
|
rig_size: [W, H],
|
|
5946
6012
|
scale_rig_per_source: frame.S,
|
|
@@ -6180,13 +6246,14 @@ export function bodyBox(b: UncoveredBody): string {
|
|
|
6180
6246
|
* plan takes `tag` from the head run; `why` is the proposer's reason for not
|
|
6181
6247
|
* proposing an extend entry, when the caller is the proposer.
|
|
6182
6248
|
*
|
|
6183
|
-
* ⚖️ Invariant:
|
|
6184
|
-
* takes no part from `tag`; it takes one from the head run and no
|
|
6249
|
+
* ⚖️ Invariant: the legacy path has four cases, decided in this order — the
|
|
6250
|
+
* plan takes no part from `tag`; it takes one from the head run and no
|
|
6185
6251
|
* `extend_below_crop` entry continues that part from the full run's `tag`;
|
|
6186
6252
|
* an entry does, and the head-run part has no pixel of alpha above
|
|
6187
6253
|
* `CROP_PROBE_ALPHA` on the probe row (`headBottom - CROP_PROBE_ROWS`), so
|
|
6188
6254
|
* `belowCrop` seeds nothing; or it reaches the line and the body is not one
|
|
6189
|
-
* of the components `belowCrop` seeds.
|
|
6255
|
+
* of the components `belowCrop` seeds. Explicit-edge entries instead name
|
|
6256
|
+
* their declared edges and alpha threshold; they do not use bottom seeding.
|
|
6190
6257
|
*/
|
|
6191
6258
|
export function skippedBy(tag: string, plan: readonly PlanEntry[], extend: readonly Extend[], headPart: Raster | null, headBottom: number, why: string | null): string {
|
|
6192
6259
|
const entry = plan.find((e) => e[2] === tag);
|
|
@@ -6196,6 +6263,11 @@ export function skippedBy(tag: string, plan: readonly PlanEntry[], extend: reado
|
|
|
6196
6263
|
if (!extend.some((e) => e.part === part && e.run === 'full' && e.tag === tag)) {
|
|
6197
6264
|
return `${taken}, and no extend_below_crop entry continues it from the full run${why === null ? '' : ` (${why})`}`;
|
|
6198
6265
|
}
|
|
6266
|
+
const explicit = extend.filter(e => e.part === part && e.run === 'full' && e.tag === tag && e.edges !== undefined);
|
|
6267
|
+
if (explicit.length > 0) {
|
|
6268
|
+
const edges = [...new Set(explicit.flatMap(e => e.edges ?? []))];
|
|
6269
|
+
return `${taken}; extend_below_crop edges [${edges.join(', ')}] copy full-run pixels at alpha >= 128 beyond the declared crop edges only; this body remains outside their coverage`;
|
|
6270
|
+
}
|
|
6199
6271
|
const probe = headBottom - CROP_PROBE_ROWS;
|
|
6200
6272
|
let reaches = false;
|
|
6201
6273
|
if (headPart !== null && probe >= 0 && probe < headPart.height) {
|
|
@@ -6260,7 +6332,7 @@ export function uncoveredLayers(
|
|
|
6260
6332
|
* push-back and the seam override add or clear along an outline — a pixel
|
|
6261
6333
|
* wide, below any body (`BODY_KERNEL`).
|
|
6262
6334
|
*/
|
|
6263
|
-
export function planCoverage(plan: readonly PlanEntry[], extend: readonly Extend[], rigOf: (run: Run, tag: string) => Raster, headBottom: number): Uint8Array {
|
|
6335
|
+
export function planCoverage(plan: readonly PlanEntry[], extend: readonly Extend[], rigOf: (run: Run, tag: string) => Raster, headBottom: number, box?: readonly number[]): Uint8Array {
|
|
6264
6336
|
let covered: Uint8Array | null = null;
|
|
6265
6337
|
const mark = (r: Raster, sel: Mask | null): void => {
|
|
6266
6338
|
if (covered === null) covered = new Uint8Array(r.width * r.height);
|
|
@@ -6272,7 +6344,7 @@ export function planCoverage(plan: readonly PlanEntry[], extend: readonly Extend
|
|
|
6272
6344
|
for (const e of extend) {
|
|
6273
6345
|
if (e.part !== name) continue;
|
|
6274
6346
|
const extra = rigOf(e.run, e.tag);
|
|
6275
|
-
mark(extra, belowCrop(part, extra, headBottom));
|
|
6347
|
+
mark(extra, e.edges === undefined ? belowCrop(part, extra, headBottom) : beyondCrop(extra, box!, e.edges));
|
|
6276
6348
|
}
|
|
6277
6349
|
}
|
|
6278
6350
|
return covered ?? new Uint8Array(0);
|
|
@@ -6686,9 +6758,31 @@ export function proposePlan(full0: LayerSet, head0: LayerSet, g: Geometry, minPx
|
|
|
6686
6758
|
}
|
|
6687
6759
|
return r;
|
|
6688
6760
|
};
|
|
6689
|
-
|
|
6761
|
+
// Explicit edges use the actual crop rectangle, never the legacy inset line.
|
|
6762
|
+
const box = cropBounds(frame);
|
|
6763
|
+
const edgeReaches = new Map<string, Record<CropEdge, number>>();
|
|
6764
|
+
for (const [name, run, tag] of plan) {
|
|
6765
|
+
if (run !== 'head' || !['front hair', 'back hair'].includes(tag) || find('full', tag) === undefined || noted.has(`full:${tag}`)) continue;
|
|
6766
|
+
const extra = rigOf('full', tag);
|
|
6767
|
+
const reach: Record<CropEdge, number> = { left: 0, right: 0, top: 0, bottom: 0 };
|
|
6768
|
+
for (let y = 0; y < extra.height; y++) for (let x = 0; x < extra.width; x++) {
|
|
6769
|
+
if (extra.data[(y * extra.width + x) * 4 + 3] < 128) continue;
|
|
6770
|
+
reach.left = Math.max(reach.left, box[0] - (x + 0.5));
|
|
6771
|
+
reach.right = Math.max(reach.right, x + 0.5 - box[2]);
|
|
6772
|
+
reach.top = Math.max(reach.top, box[1] - (y + 0.5));
|
|
6773
|
+
reach.bottom = Math.max(reach.bottom, y + 0.5 - box[3]);
|
|
6774
|
+
}
|
|
6775
|
+
edgeReaches.set(tag, reach);
|
|
6776
|
+
const edges = (['left', 'right', 'top'] as const).filter(edge => reach[edge] > 8);
|
|
6777
|
+
// Legacy bottom entries retain their inset line, seeding, rim and order.
|
|
6778
|
+
// Side/top continuation is additive; it never replaces that entry.
|
|
6779
|
+
if (edges.length > 0) extend.push({ part: name, run: 'full', tag, edges });
|
|
6780
|
+
}
|
|
6781
|
+
const covered = planCoverage(plan, extend, rigOf, frame.headBottom, box);
|
|
6690
6782
|
const minBody = bodyMinPx(frame, minPx);
|
|
6691
6783
|
const why = (tag: string): string => {
|
|
6784
|
+
const edge = edgeReaches.get(tag);
|
|
6785
|
+
if (edge !== undefined && (edge.left > 8 || edge.right > 8 || edge.top > 8)) return `the proposer continues ${tag} beyond each crop edge only when its full-run alpha >= 128 reaches more than 8 rig px beyond it; reaches ${Object.entries(edge).map(([name, px]) => `${name} ${px} rig px`).join(', ')}`;
|
|
6692
6786
|
if (!reaches.has(tag)) return 'the proposer continues only front hair and back hair below the head crop';
|
|
6693
6787
|
const r = reaches.get(tag);
|
|
6694
6788
|
return `the proposer continues ${tag} only when its full-run layer reaches more than 8 rig px below the crop line, rig row ${frame.headBottom}; it reaches ${r === null || r === undefined ? 'no row' : `rig row ${fmt0(r)}`}`;
|
package/src/build.ts
CHANGED
|
@@ -895,6 +895,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
895
895
|
log(pinholesLine(pinholes, altBuilt.map((b) => b.record.name)));
|
|
896
896
|
for (const d of result.drift) log(driftLine(d));
|
|
897
897
|
for (const d of result.softOcclusion ?? []) log(softOcclusionLine(d));
|
|
898
|
+
for (const line of result.cropClipped ?? []) log(line);
|
|
898
899
|
// Issue #588: per subset set, one line per limb part cut from a layer of more than one island, then (issue #587) one
|
|
899
900
|
// per limb part and base part over it that took a pixel. None otherwise.
|
|
900
901
|
// Issue #609: then one per limb part cut from a layer of one island that also holds a limb the set does not carry.
|
package/src/config.ts
CHANGED
|
@@ -198,10 +198,15 @@ export type Run = 'full' | 'head';
|
|
|
198
198
|
/** One part: its name, which run it comes from, and the See-through tag it is. Order = draw order, back to front. */
|
|
199
199
|
export type PlanEntry = [string, Run, string];
|
|
200
200
|
|
|
201
|
+
export const CROP_EDGES = ['left', 'right', 'top', 'bottom'] as const;
|
|
202
|
+
export type CropEdge = typeof CROP_EDGES[number];
|
|
203
|
+
|
|
201
204
|
export interface Extend {
|
|
202
205
|
part: string;
|
|
203
206
|
run: Run;
|
|
204
207
|
tag: string;
|
|
208
|
+
/** Explicit crop edges; absent, retain the original below-crop component and rim rule. */
|
|
209
|
+
edges?: CropEdge[];
|
|
205
210
|
}
|
|
206
211
|
|
|
207
212
|
/** Which pixels of a patch's box it takes: the painting's figure silhouette inside the box, or the whole box. */
|
|
@@ -2645,9 +2650,18 @@ function checkAssemble(c: Check, v: Json, door: 'assemble' | 'full'): { parts: s
|
|
|
2645
2650
|
if ('extend_below_crop' in a && c.array(`${p}.extend_below_crop`, a.extend_below_crop, false)) {
|
|
2646
2651
|
(a.extend_below_crop as Json[]).forEach((entry, i) => {
|
|
2647
2652
|
const at = `${p}.extend_below_crop[${i}]`;
|
|
2648
|
-
const e = c.object(at, entry, ['part', 'run', 'tag'], []);
|
|
2653
|
+
const e = c.object(at, entry, ['part', 'run', 'tag'], ['edges']);
|
|
2649
2654
|
if (e === null) return;
|
|
2650
2655
|
checkRunTag(c, at, e.run, e.tag);
|
|
2656
|
+
if ('edges' in e && c.array(`${at}.edges`, e.edges, true)) {
|
|
2657
|
+
const edges = e.edges as Json[];
|
|
2658
|
+
edges.forEach((edge, j) => {
|
|
2659
|
+
if (typeof edge !== 'string' || !CROP_EDGES.includes(edge as CropEdge)) c.fail('CONFIG_FIELD_TYPE', `${at}.edges[${j}]`, `is ${show(edge)}; left, right, top or bottom is required`);
|
|
2660
|
+
else if (edges.indexOf(edge) !== j) c.fail('CONFIG_FIELD_TYPE', `${at}.edges[${j}]`, `repeats ${show(edge)}; each crop edge is declared once`);
|
|
2661
|
+
});
|
|
2662
|
+
const row = Array.isArray(a.plan) ? a.plan.find(row => Array.isArray(row) && row[0] === e.part) as Json[] | undefined : undefined;
|
|
2663
|
+
if (e.run !== 'full' || row?.[1] !== 'head' || row?.[2] !== e.tag) c.fail('CONFIG_NAME_RESOLVES', at, 'explicit crop edges require a head-run plan part and the full-run layer of the same tag');
|
|
2664
|
+
}
|
|
2651
2665
|
if (typeof e.part !== 'string' || !parts.includes(e.part)) {
|
|
2652
2666
|
c.fail('CONFIG_NAME_RESOLVES', `${at}.part`, `is ${show(e.part)}; a part named in assemble.plan is required`);
|
|
2653
2667
|
}
|