spine-parts 2.20.0 → 2.20.2
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 +3 -3
- package/docs/STABILITY.md +26 -0
- package/package.json +1 -1
- package/src/assemble.ts +2 -1
- package/src/headbox.ts +7 -0
- package/src/headcroppreflight.ts +3 -1
package/docs/AUTHORING.md
CHANGED
|
@@ -4127,7 +4127,7 @@ existing hardlinks are refused before artifact output; the ordinary mode names
|
|
|
4127
4127
|
| `sheet --source <png> --layers <path>… --out <png>` | a labelled contact sheet of the painting and every layer or part |
|
|
4128
4128
|
| `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. |
|
|
4129
4129
|
| `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 |
|
|
4130
|
-
| `head-crop-preflight --full <run> --canvas WxH --head-box '[left,top,right,bottom]'` | before the head run: JSON on stdout, one advice line per hit tag on stderr, exit 0 even when clipped. Counts original alpha > 8 full-run samples after centre registration through the square pad into painting coordinates: centres below left/top or at/above right/bottom are outside. Fractional boxes are accepted; corner samples count on both edges. No ghost cleanup, resampling, head run or assemble is needed. Bottom is distinct because `extend_below_crop` handles it. Zero-hit tags remain in JSON. Existing pipeline outputs stay unchanged; help adds this command and guide reflects these documentation edits. |
|
|
4130
|
+
| `head-crop-preflight --full <run> --canvas WxH --head-box '[left,top,right,bottom]'` | before the head run: JSON on stdout, one advice line per hit tag on stderr, exit 0 even when clipped. Counts original alpha > 8 full-run samples after centre registration through the square pad into painting coordinates: centres below left/top or at/above right/bottom are outside. Fractional boxes are accepted; corner samples count on both edges. No ghost cleanup, resampling, head run or assemble is needed. These counts cannot be compared with `ASSEMBLE_CROP_CLIPPED`, which counts rig pixels at alpha >= 128 after `cleanGhosts`. Preflight reads original samples before the head run exists, so soft fringes and ghost specks can be hits only here. Bottom is distinct because `extend_below_crop` handles it. Zero-hit tags remain in JSON. Existing pipeline outputs stay unchanged; help adds this command and guide reflects these documentation edits. |
|
|
4131
4131
|
| `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 |
|
|
4132
4132
|
| `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 |
|
|
4133
4133
|
| `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](AUTHORING.md)) |
|
|
@@ -5229,7 +5229,7 @@ those settings. Changing a config seed alone cannot change a no-config run.
|
|
|
5229
5229
|
| <a id="PARTS_TAKEN_LAYERS"></a>`PARTS_TAKEN_LAYERS` | a taken-layer receipt is partial, unknown, duplicated, malformed or claims differing pixels | regenerate parts with assemble; never patch source receipts by hand |
|
|
5230
5230
|
| <a id="ASSEMBLE_FIELD_PRESENT"></a>`ASSEMBLE_FIELD_PRESENT` | `seethrough.head_box` is missing | `propose --head-box` proposes it (§3) |
|
|
5231
5231
|
| <a id="ASSEMBLE_RIG_SIZE"></a>`ASSEMBLE_RIG_SIZE` | `rig_scale` makes an empty rig | `assemble.rig_scale` |
|
|
5232
|
-
| <a id="ASSEMBLE_HEAD_BOX_INSIDE"></a>`ASSEMBLE_HEAD_BOX_INSIDE` | the head box is outside the painting | `head_box` — `propose --head-box` holds it inside |
|
|
5232
|
+
| <a id="ASSEMBLE_HEAD_BOX_INSIDE"></a>`ASSEMBLE_HEAD_BOX_INSIDE` | the head box is outside the painting (also refused by `head-crop-preflight`) | `head_box` — `propose --head-box` holds it inside |
|
|
5233
5233
|
| <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 |
|
|
5234
5234
|
| <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 |
|
|
5235
5235
|
| <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` |
|
|
@@ -5280,7 +5280,7 @@ those settings. Changing a config seed alone cannot change a no-config run.
|
|
|
5280
5280
|
| rule | means | change |
|
|
5281
5281
|
| --- | --- | --- |
|
|
5282
5282
|
| <a id="HEAD_CROP_PREFLIGHT"></a>`HEAD_CROP_PREFLIGHT` | report-only: full-run drawn samples outside the declared crop, per tag and edge; bottom is separate for `extend_below_crop`; clipping never refuses | `head-crop-preflight --full <run> --canvas WxH --head-box '[left,top,right,bottom]'` |
|
|
5283
|
-
| <a id="HEAD_CROP_PREFLIGHT_BOX"></a>`HEAD_CROP_PREFLIGHT_BOX` |
|
|
5283
|
+
| <a id="HEAD_CROP_PREFLIGHT_BOX"></a>`HEAD_CROP_PREFLIGHT_BOX` | inverted or empty box: left < right and top < bottom required; invalid JSON, non-arrays, wrong length and non-number coordinates take the CLI usage route before this check | `--head-box` JSON array |
|
|
5284
5284
|
| <a id="HEADBOX_FACE_PRESENT"></a><a id="HEADBOX_RUN_SQUARE"></a><a id="HEADBOX_CANVAS_SIZE"></a><a id="HEADBOX_FITS_CANVAS"></a>`HEADBOX_FACE_PRESENT`, `HEADBOX_RUN_SQUARE`, `HEADBOX_CANVAS_SIZE`, `HEADBOX_FITS_CANVAS` | the full run has no face or is not square; `--canvas` is not a positive size; or the painting cannot hold the proposed box at its size — its shorter side is the bound (shrinking it would cut the head) | `--full`, `--canvas`, or the painting |
|
|
5285
5285
|
| <a id="PROPOSE_SOURCE_PRESENT"></a><a id="PROPOSE_PNG_PRESENT"></a><a id="PROPOSE_PNG_MATCHES_BOX"></a>`PROPOSE_SOURCE_PRESENT`, `PROPOSE_PNG_PRESENT`, `PROPOSE_PNG_MATCHES_BOX` | the painting or a part PNG is missing, or a PNG is not its box | `--source`, `--parts` (re-run assemble) |
|
|
5286
5286
|
| <a id="PROPOSE_FACE_PRESENT"></a>`PROPOSE_FACE_PRESENT` | no part comes from a `face` layer, and the face-less fallback cannot derive a face box either: it needs the head run's `neck` and at least one head-run `front hair`/`back hair` part whose top is above the neck's, and the message names the half that is missing. With both, `propose` does not refuse — it derives the box and says so in its first note (§5) | `assemble.plan`: take the face, or the head run's hair and neck |
|
package/docs/STABILITY.md
CHANGED
|
@@ -258,6 +258,32 @@ every number) are AUTHORING §3's tables, and the loader refuses any other by na
|
|
|
258
258
|
|
|
259
259
|
## Files this package writes
|
|
260
260
|
|
|
261
|
+
### Head-crop preflight stdout
|
|
262
|
+
|
|
263
|
+
`head-crop-preflight` writes one JSON object followed by a newline on success,
|
|
264
|
+
with `spec: "rig-parts/head-crop-preflight/1"`. Its fields are
|
|
265
|
+
|
|
266
|
+
| field | meaning |
|
|
267
|
+
| --- | --- |
|
|
268
|
+
| `head_box` | supplied `[left, top, right, bottom]` in painting coordinates |
|
|
269
|
+
| `source_canvas` | supplied painting `{ w, h }` |
|
|
270
|
+
| `run_canvas` | full-run `{ w, h }` |
|
|
271
|
+
| `drawn_alpha_above` | exclusive alpha threshold, `8` |
|
|
272
|
+
| `pixel_grid` | `"full-run"`, the native sample grid |
|
|
273
|
+
| `registration` | `{ scale_source_per_run, pad_left, pad_top }`, mapping run sample centres into painting coordinates |
|
|
274
|
+
| `layers` | rows in full-run layer order, including zero-hit tags |
|
|
275
|
+
| `layers[].tag` | full-run layer name |
|
|
276
|
+
| `layers[].drawn_px` | native samples above the alpha threshold |
|
|
277
|
+
| `layers[].sides` | `{ top_px, left_px, right_px }`, samples beyond those crop edges |
|
|
278
|
+
| `layers[].bottom_px` | samples beyond the bottom, separate for `extend_below_crop` |
|
|
279
|
+
|
|
280
|
+
Corner samples count on both edges. Counts remain native samples before ghost
|
|
281
|
+
cleanup. A positive count reports clipping and unknown input is not a negative.
|
|
282
|
+
Each hit tag gets one `HEAD_CROP_PREFLIGHT` advice line on stderr. Valid clipping
|
|
283
|
+
exits zero. Malformed geometry or a box outside the painting is refused before
|
|
284
|
+
JSON is emitted. This command writes no files.
|
|
285
|
+
|
|
286
|
+
|
|
261
287
|
`assemble` and `build` declare `painting_in_rig` in parts.json as
|
|
262
288
|
`{ path: "painting_in_rig.png", sha256, resample: "lanczos3-rgb-opaque" }`.
|
|
263
289
|
The sibling PNG is the exact rig-resolution raster assemble used: source RGB
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spine-parts",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.2",
|
|
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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { headBoxInside } from './headbox.ts';
|
|
1
2
|
import { edgePairResiduals, type EdgeResidualReport } from './edgeresidual.ts';
|
|
2
3
|
import type { SupportDomain } from './coincide.ts';
|
|
3
4
|
import { type SeamRule } from './seamrule.ts';
|
|
@@ -1179,7 +1180,7 @@ export function checkGeometry(g: Geometry, runs?: { full: LayerSet; head: LayerS
|
|
|
1179
1180
|
if (W < 1 || H < 1) fail('ASSEMBLE_RIG_SIZE', 'config.assemble.rig_scale', `${S} makes a ${W}x${H} rig from a ${w}x${h} painting; at least 1x1 is required`);
|
|
1180
1181
|
const [x0, y0, x1, y1] = headBox;
|
|
1181
1182
|
// A single run (issue #359) has no crop: its box is the full run's frame, derived, and may reach past the painting.
|
|
1182
|
-
if (g.single !== true && !(
|
|
1183
|
+
if (g.single !== true && !headBoxInside(headBox, w, h)) {
|
|
1183
1184
|
fail('ASSEMBLE_HEAD_BOX_INSIDE', 'config.seethrough.head_box', `is [${headBox.join(', ')}]; a non-empty box inside the ${w}x${h} painting is required`);
|
|
1184
1185
|
}
|
|
1185
1186
|
const headBottom = Math.trunc(y1 * S) - HEAD_BOTTOM_INSET;
|
package/src/headbox.ts
CHANGED
|
@@ -42,6 +42,13 @@ export const HEAD_LAYER_MIN_PX = 150;
|
|
|
42
42
|
|
|
43
43
|
export type Box = [number, number, number, number];
|
|
44
44
|
|
|
45
|
+
/** Non-empty painting-space crop containment, shared with assemble and preflight. */
|
|
46
|
+
export function headBoxInside(box: Box, w: number, h: number): boolean {
|
|
47
|
+
const [x0, y0, x1, y1] = box;
|
|
48
|
+
return x0 >= 0 && y0 >= 0 && x1 <= w && y1 <= h && x1 > x0 && y1 > y0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
45
52
|
export interface HeadBoxOptions {
|
|
46
53
|
/** Whether `"back hair"` is included in the union (issue #351); default `true`. */
|
|
47
54
|
backHair?: boolean;
|
package/src/headcroppreflight.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Read-only crop advice on the original full-run drawn-pixel grid (issue #1082). */
|
|
2
2
|
import { squarePad } from './inputs.ts';
|
|
3
3
|
import { OPAQUE_ALPHA_ABOVE, type LayerSet } from './layers.ts';
|
|
4
|
-
import type
|
|
4
|
+
import { headBoxInside, type Box } from './headbox.ts';
|
|
5
5
|
import { refuseIfAny, type Problem } from './errors.ts';
|
|
6
6
|
|
|
7
7
|
export const HEAD_CROP_PREFLIGHT_LINE = 'HEAD_CROP_PREFLIGHT';
|
|
@@ -13,6 +13,8 @@ export function headCropPreflight(full: LayerSet, source: { w: number; h: number
|
|
|
13
13
|
if (full.canvas.w !== full.canvas.h || !Number.isInteger(full.canvas.w) || full.canvas.w <= 0) problems.push({ code: 'HEADBOX_RUN_SQUARE', object: full.source, detail: `full run is ${full.canvas.w}x${full.canvas.h}; a positive square canvas is required` });
|
|
14
14
|
if (box.length !== 4 || !box.every(Number.isFinite) || !(box[0] < box[2] && box[1] < box[3])) problems.push({ code: 'HEAD_CROP_PREFLIGHT_BOX', object: '--head-box', detail: `head_box ${JSON.stringify(box)}; four finite coordinates with left < right and top < bottom required` });
|
|
15
15
|
refuseIfAny(problems);
|
|
16
|
+
if (!headBoxInside(box, source.w, source.h)) problems.push({ code: 'ASSEMBLE_HEAD_BOX_INSIDE', object: '--head-box', detail: `is [${box.join(', ')}]; a non-empty box inside the ${source.w}x${source.h} painting is required` });
|
|
17
|
+
refuseIfAny(problems);
|
|
16
18
|
const pad = squarePad(source.w, source.h);
|
|
17
19
|
const scale = pad.side / full.canvas.w;
|
|
18
20
|
const layers = full.layers.map(layer => {
|