spine-parts 2.15.0 → 2.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.ts +32 -1
- package/docs/AUTHORING.md +4 -1
- package/docs/STABILITY.md +1 -0
- package/package.json +1 -1
- package/src/headcroppreflight.ts +40 -0
package/cli.ts
CHANGED
|
@@ -29,7 +29,8 @@ import { type CharacterConfig, loadClothConfig, loadConfig, loadEarlyConfig, loa
|
|
|
29
29
|
import { configWriteLines, readConfigWriteTarget, separateConfigWriteTarget, stageConfigWrite, type StagedConfigWrite } from './tools/configwrite.ts';
|
|
30
30
|
import { failLine, guidePointer, PartsError } from './src/errors.ts';
|
|
31
31
|
import { GUIDE_DOC, type GuideAnswer, guideRule, guideSection } from './src/guide.ts';
|
|
32
|
-
import { proposeHeadBox } from './src/headbox.ts';
|
|
32
|
+
import { proposeHeadBox, type Box } from './src/headbox.ts';
|
|
33
|
+
import { headCropPreflight, headCropPreflightLines } from './src/headcroppreflight.ts';
|
|
33
34
|
import { makeInputs } from './src/inputs.ts';
|
|
34
35
|
import { idleKeysOf, isIdleKeys } from './src/rig.ts';
|
|
35
36
|
import { bodyCoreBox, bodyOpaqueBox, CORE_ALPHA, depthSkipLine, exportLayers, figuresPhrase, hiddenLayerLine, implausibleRules, layerCoreBox, layerFigures, layerOpaqueBox, type LayerSet, layerSetDiff, type OpaqueBox, OPAQUE_ALPHA_ABOVE, pct, readLayers, readWrapperLayers, ruleSummary, templateLayerNames, templatePsdBytes, times } from './src/layers.ts';
|
|
@@ -350,6 +351,9 @@ usage:
|
|
|
350
351
|
--no-back-hair leaves "back hair" out of the box. --write-config updates
|
|
351
352
|
only seethrough.head_box in an existing config through the layers loader.
|
|
352
353
|
|
|
354
|
+
rig-parts head-crop-preflight --full <run> --canvas <W>x<H> --head-box '[left,top,right,bottom]'
|
|
355
|
+
Report full-run drawn pixels beyond the crop: JSON stdout, advice stderr; no head run needed.
|
|
356
|
+
|
|
353
357
|
rig-parts compare --left <file> --right <file> [--map <bonemap.json>]
|
|
354
358
|
Compare two skeletons bone by bone. Each file is a config, a proposal.json
|
|
355
359
|
or a rig.json (rigc-rig/1), told apart by what it states: "spec" (read by
|
|
@@ -1142,6 +1146,7 @@ const TAKES = {
|
|
|
1142
1146
|
'mesh-stats': { valued: ['--config', '--parts'], switches: [] },
|
|
1143
1147
|
remesh: { valued: ['--rig', '--config', '--parts', '--part', '--mesh', '--delta', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape', '--input-check'], switches: ['--record-input-check'] },
|
|
1144
1148
|
retune: { valued: ['--rig', '--config', '--parts', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape', '--input-check'], switches: ['--record-input-check'] },
|
|
1149
|
+
'head-crop-preflight': { valued: ['--full', '--canvas', '--head-box'], switches: [] },
|
|
1145
1150
|
painting: { valued: ['--keypoints', '--person', '--form'], switches: [] },
|
|
1146
1151
|
} as const satisfies Record<string, { valued: readonly string[]; switches: readonly string[] }>;
|
|
1147
1152
|
|
|
@@ -1438,6 +1443,31 @@ function printLint(P: PartSet, spec: { bones: CharacterConfig['bones']; meshes:
|
|
|
1438
1443
|
return res.findings.length;
|
|
1439
1444
|
}
|
|
1440
1445
|
|
|
1446
|
+
/** A separate command preserves all existing command parsers and their output bytes. */
|
|
1447
|
+
function cmdHeadCropPreflight(args: string[]): number {
|
|
1448
|
+
const flags = new Map<string, string>();
|
|
1449
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
1450
|
+
const flag = args[i];
|
|
1451
|
+
if (!takesValued('head-crop-preflight', flag)) return usage(notTaken('head-crop-preflight', flag));
|
|
1452
|
+
if (flags.has(flag)) return usage(`${flag} is given twice`);
|
|
1453
|
+
if (args[i + 1] === undefined || args[i + 1].startsWith('--')) return usage(`${flag} needs a value`);
|
|
1454
|
+
flags.set(flag, args[i + 1]);
|
|
1455
|
+
}
|
|
1456
|
+
const full = flags.get('--full'), canvasArg = flags.get('--canvas'), boxArg = flags.get('--head-box');
|
|
1457
|
+
if (full === undefined || canvasArg === undefined || boxArg === undefined) return usage("head-crop-preflight needs --full <run>, --canvas <W>x<H> and --head-box '[left,top,right,bottom]'");
|
|
1458
|
+
const canvas = parseCanvas(canvasArg);
|
|
1459
|
+
if (canvas === null) return usage(`--canvas ${canvasArg} is not <W>x<H> in integer px`);
|
|
1460
|
+
let box: unknown;
|
|
1461
|
+
try { box = JSON.parse(boxArg); } catch { return usage('--head-box needs a JSON array of four finite coordinates'); }
|
|
1462
|
+
if (!Array.isArray(box) || box.length !== 4 || !box.every(n => typeof n === 'number' && Number.isFinite(n))) return usage('--head-box needs a JSON array of four finite coordinates');
|
|
1463
|
+
try {
|
|
1464
|
+
const report = headCropPreflight(readLayers(full), canvas, box as Box);
|
|
1465
|
+
console.log(JSON.stringify(report));
|
|
1466
|
+
for (const line of headCropPreflightLines(report)) console.error(line);
|
|
1467
|
+
return EXIT_OK;
|
|
1468
|
+
} catch (err) { return printRefusal(err); }
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1441
1471
|
function cmdPropose(args: string[]): number {
|
|
1442
1472
|
const flags = new Map<string, string>();
|
|
1443
1473
|
let headBox = false;
|
|
@@ -2300,6 +2330,7 @@ function main(argv: string[]): number | Promise<number> {
|
|
|
2300
2330
|
if (command === 'sheet') return cmdSheet(rest);
|
|
2301
2331
|
if (command === 'rig') return cmdRig(rest);
|
|
2302
2332
|
if (command === 'propose') return cmdPropose(rest);
|
|
2333
|
+
if (command === 'head-crop-preflight') return cmdHeadCropPreflight(rest);
|
|
2303
2334
|
if (command === 'compare') return cmdCompare(rest);
|
|
2304
2335
|
if (command === 'check') return cmdCheck(rest);
|
|
2305
2336
|
if (command === 'loop') return cmdLoop(rest);
|
package/docs/AUTHORING.md
CHANGED
|
@@ -152,7 +152,7 @@ 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. 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. |
|
|
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. Under `visible`, painting-edge reconstruction re-evaluates the part once the crop line is no longer its edge, so pixels inside the crop can change; in the measured cases they were next to the declared edge. 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 |
|
|
@@ -4123,6 +4123,7 @@ existing hardlinks are refused before artifact output; the ordinary mode names
|
|
|
4123
4123
|
| `sheet --source <png> --layers <path>… --out <png>` | a labelled contact sheet of the painting and every layer or part |
|
|
4124
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
|
+
| `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. |
|
|
4126
4127
|
| `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
4128
|
| `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 |
|
|
4128
4129
|
| `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)) |
|
|
@@ -5274,6 +5275,8 @@ those settings. Changing a config seed alone cannot change a no-config run.
|
|
|
5274
5275
|
|
|
5275
5276
|
| rule | means | change |
|
|
5276
5277
|
| --- | --- | --- |
|
|
5278
|
+
| <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]'` |
|
|
5279
|
+
| <a id="HEAD_CROP_PREFLIGHT_BOX"></a>`HEAD_CROP_PREFLIGHT_BOX` | malformed box: four finite coordinates with left < right and top < bottom required | `--head-box` JSON array |
|
|
5277
5280
|
| <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 |
|
|
5278
5281
|
| <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) |
|
|
5279
5282
|
| <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
|
@@ -58,6 +58,7 @@ defaults are the help's too, and none is guessed from the art.
|
|
|
58
58
|
| `comfy` | `paint`: `--config`, `--out`; optional `--seeds`, `--seed0`, `--host`, `--wait`, `--timeout`, `--poll` |
|
|
59
59
|
| `comfy` | `seethrough`: `--image`, `--out`; optional `--resolution`, `--steps`, `--seed`, `--prefix`, `--offload`, `--no-offload`, `--lama`, `--nf4`, `--host`, `--wait`, `--timeout`, `--poll`, `--config` (See-through settings and optional depth block), `--depth-run` (`full` or `head`, required with the block) |
|
|
60
60
|
| `assemble` | `--propose-plan` with `--source`, `--full`, `--config`, optional `--head`, `--write-config` (must name `--config` itself, issue #356); or `--source`, `--full`, `--config`, `--out`, optional `--head` (without it, one run: issue #359), `--seam` (near-white, silhouette), `--project` (core, visible), `--alt` (repeatable `<name>=<source>:<full>[:<head>]`, issue #454), `--requirements` (source-bound cut-material evidence only when the file declares `cut_material`, issue #888) |
|
|
61
|
+
| `head-crop-preflight` | `--full`, `--canvas`, `--head-box` (JSON coordinate array); read-only advice before the head run, original alpha > 8 samples (issue #1082) |
|
|
61
62
|
| `propose` | `--head-box` with `--full`, `--canvas`; optional `--no-back-hair`, `--write-config` (existing config, issue #356) |
|
|
62
63
|
| `propose` | `--parts`, `--source`, `--out`; optional `--compare` or `--from-config` (one of them), `--keypoints`, `--person` and `--wrist-snap` (each with `--keypoints`), `--full`, `--head` (the turn control's depths; not with `--from-config`), `--grid-rule` (`figure` or `part`, the drafted lattice's spacing; not with `--from-config`), `--cloth` (a config whose `cloth` block is the recipe, issue #364; not with `--from-config`), `--write-config` (existing config for an ordinary proposal, issue #356; a new file with `--cloth`, issue #537; not with `--from-config` — additive: without it nothing `propose` writes changes), `--from` (the config the recipe is changed from, only with `--write-config`, issue #571 — additive: without it nothing `--write-config` writes changes), `--only-missing` (only with `--parts` and `--write-config`, not with `--cloth` or `--from-config`, issue #671 — additive: without it nothing `--write-config` writes changes) `--bust-landmarks` (rig-pixel apex_r/apex_l and optional cleavage), or `--no-bust` (non-blank omission reason), one required when drafting a chest-holding torso, both incompatible with `--from-config` |
|
|
63
64
|
| `propose` | `--parts`, `--source`, `--out`, `--full`, `--head`, `--write-config` together: the [neck draft](AUTHORING.md#a-neck-that-moves-on-its-own) for an existing config with `turn.body` and one neck plan row; reassembles under `<out>/rig`, preserves the sampled turn and drafts a rigid neck unit (issue #826) |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spine-parts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.1",
|
|
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": {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Read-only crop advice on the original full-run drawn-pixel grid (issue #1082). */
|
|
2
|
+
import { squarePad } from './inputs.ts';
|
|
3
|
+
import { OPAQUE_ALPHA_ABOVE, type LayerSet } from './layers.ts';
|
|
4
|
+
import type { Box } from './headbox.ts';
|
|
5
|
+
import { refuseIfAny, type Problem } from './errors.ts';
|
|
6
|
+
|
|
7
|
+
export const HEAD_CROP_PREFLIGHT_LINE = 'HEAD_CROP_PREFLIGHT';
|
|
8
|
+
|
|
9
|
+
/** Counts are native full-run samples, never resampled area; corners count on both edges. */
|
|
10
|
+
export function headCropPreflight(full: LayerSet, source: { w: number; h: number }, box: Box) {
|
|
11
|
+
const problems: Problem[] = [];
|
|
12
|
+
if (![source.w, source.h].every(n => Number.isInteger(n) && n > 0)) problems.push({ code: 'HEADBOX_CANVAS_SIZE', object: '--canvas', detail: `painting is ${source.w}x${source.h}; positive integer dimensions required` });
|
|
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
|
+
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
|
+
refuseIfAny(problems);
|
|
16
|
+
const pad = squarePad(source.w, source.h);
|
|
17
|
+
const scale = pad.side / full.canvas.w;
|
|
18
|
+
const layers = full.layers.map(layer => {
|
|
19
|
+
let drawn_px = 0, top_px = 0, left_px = 0, right_px = 0, bottom_px = 0;
|
|
20
|
+
for (let y = 0; y < layer.pixels.height; y++) for (let x = 0; x < layer.pixels.width; x++) {
|
|
21
|
+
if (layer.pixels.data[(y * layer.pixels.width + x) * 4 + 3] <= OPAQUE_ALPHA_ABOVE) continue;
|
|
22
|
+
drawn_px++;
|
|
23
|
+
const cx = (layer.left + x + 0.5) * scale - pad.left;
|
|
24
|
+
const cy = (layer.top + y + 0.5) * scale - pad.top;
|
|
25
|
+
if (cx < box[0]) left_px++;
|
|
26
|
+
if (cx >= box[2]) right_px++;
|
|
27
|
+
if (cy < box[1]) top_px++;
|
|
28
|
+
if (cy >= box[3]) bottom_px++;
|
|
29
|
+
}
|
|
30
|
+
return { tag: layer.name, drawn_px, sides: { top_px, left_px, right_px }, bottom_px };
|
|
31
|
+
});
|
|
32
|
+
return { spec: 'rig-parts/head-crop-preflight/1', head_box: box, source_canvas: source, run_canvas: full.canvas,
|
|
33
|
+
drawn_alpha_above: OPAQUE_ALPHA_ABOVE, pixel_grid: 'full-run', registration: { scale_source_per_run: scale, pad_left: pad.left, pad_top: pad.top }, layers };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** One advice line per hit tag; bottom remains distinct from the three side/top edges. */
|
|
37
|
+
export function headCropPreflightLines(report: ReturnType<typeof headCropPreflight>): string[] {
|
|
38
|
+
return report.layers.filter(r => r.sides.top_px + r.sides.left_px + r.sides.right_px + r.bottom_px > 0).map(r =>
|
|
39
|
+
`${HEAD_CROP_PREFLIGHT_LINE}: tag ${JSON.stringify(r.tag)} — top ${r.sides.top_px}, left ${r.sides.left_px}, right ${r.sides.right_px} drawn px; bottom ${r.bottom_px} drawn px (extend_below_crop); report only`);
|
|
40
|
+
}
|