spine-parts 2.19.4 → 2.20.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/docs/AUTHORING.md +60 -23
- package/docs/STABILITY.md +26 -0
- package/package.json +2 -2
- package/src/assemble.ts +2 -1
- package/src/check.ts +164 -11
- package/src/checkrow.ts +3 -0
- 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 |
|
|
@@ -7120,6 +7120,40 @@ and `failed`; the bar counts once among the bars measured. Without the block,
|
|
|
7120
7120
|
or with `required: false`, nothing here is read and no exit code, line or byte
|
|
7121
7121
|
moves; the warnings and the body-root bar above are unchanged either way.
|
|
7122
7122
|
|
|
7123
|
+
**Open-cell evidence.** A failing pair gains `open_frames`, one row per animation
|
|
7124
|
+
and failing frame, with `animation`, `index`, `time`, `px`, `cell`, `box`,
|
|
7125
|
+
`classes` and `cells_index`. `classes` holds `figure`, `background` and `other`
|
|
7126
|
+
counts whose sum equals that frame's `gapOpen` px. A cell is `figure` when its
|
|
7127
|
+
`setupTop` slot resolves to a manifest part through its default-skin image,
|
|
7128
|
+
`background` when both setup names are null, and `other` when a nonnull top
|
|
7129
|
+
slot has no witnessed manifest mapping. The bar still holds every class to zero.
|
|
7130
|
+
|
|
7131
|
+
The `required.cells` reference supplies the relative `path` (`seam-cells.json`)
|
|
7132
|
+
and `sha256` of a sidecar beside `check.json`. Its `spec` is
|
|
7133
|
+
`rig-parts-seam-cells/1`; `frames` contains each failing pair-frame exactly once,
|
|
7134
|
+
in pair/animation/frame order. An inline `cells_index` selects its matching
|
|
7135
|
+
sidecar frame. Each sidecar frame retains `pair`, `animation`, `index`, `time`,
|
|
7136
|
+
`px`, `cell`, `box` and `cells`. Cells retain core's world-centre `x`, `y` (y up),
|
|
7137
|
+
`setupTop`, `setupUnder` and the derived `class`. The names describe setup art
|
|
7138
|
+
at that same world cell. Every frame and cell is a registered evidence row with
|
|
7139
|
+
`row_scope`, `row_kind`, `row_subjects`. Frames name the pair; cells name the
|
|
7140
|
+
resolved top part or carry rig scope with empty subjects.
|
|
7141
|
+
|
|
7142
|
+
Only the active render under the required declaration requests `--seam-cells`.
|
|
7143
|
+
Every nonempty `gapOpen` and `gapCovered` hit, including `worst`, must supply
|
|
7144
|
+
`cells.length === px`, finite centres and distinct setup names or null. Covered
|
|
7145
|
+
cells remain in core's raw sidecar. When open cells exist, publication writes
|
|
7146
|
+
the deterministic cell sidecar and its reference together; failure restores
|
|
7147
|
+
both previous files. Clean pairs keep their previous report shape, and a rerun
|
|
7148
|
+
without cell evidence removes a stale sidecar. Counts, tolerances and verdicts
|
|
7149
|
+
are unchanged.
|
|
7150
|
+
|
|
7151
|
+
`readMotionSeamCellSidecar` reads the digest-bound evidence and validates each
|
|
7152
|
+
inline partition and pair-frame reference. A missing file, SHA-256 mismatch,
|
|
7153
|
+
partition mismatch or malformed cell list is `FRAMES_SIDECAR`. The original
|
|
7154
|
+
counted arrays stay in the sidecar so the inline report size grows with failing
|
|
7155
|
+
frames rather than their cell populations.
|
|
7156
|
+
|
|
7123
7157
|
**What it does not read.** Frames are the 12 fps grid: an opening that lives
|
|
7124
7158
|
between two ticks is not seen, and neither is a pair nobody declared — those
|
|
7125
7159
|
are [`figure_openings`](#figure_openings)'s, which still warns. A frame on which
|
|
@@ -8054,7 +8088,7 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
|
|
|
8054
8088
|
| `ART_JOINT_DISTANCE.joints` | `ART_JOINT_DISTANCE.joints` | 'rig' | finding when status === 'FAIL'; otherwise evidence | [] | [artjoints.ts:86](../src/artjoints.ts#L86) |
|
|
8055
8089
|
| `BOUNDARY_COLOUR_STEP.over` | `BOUNDARY_COLOUR_STEP.over` | 'pair' | finding | r.parts | [boundarycolour.ts:221](../src/boundarycolour.ts#L221) |
|
|
8056
8090
|
| `BOUNDARY_COLOUR_STEP.unmeasured` | `BOUNDARY_COLOUR_STEP.unmeasured` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for r.slot; otherwise [] | [boundarycolour.ts:222](../src/boundarycolour.ts#L222) |
|
|
8057
|
-
| `CLOTH_SETTLES.rows` | `CLOTH_SETTLES.rows` | 'rig' | finding when speeds.length > 0 && s < speeds.length; otherwise evidence | [] | [check.ts:
|
|
8091
|
+
| `CLOTH_SETTLES.rows` | `CLOTH_SETTLES.rows` | 'rig' | finding when speeds.length > 0 && s < speeds.length; otherwise evidence | [] | [check.ts:5960](../src/check.ts#L5960) |
|
|
8058
8092
|
| `CUT_JOINT_MATERIAL.rows` | `CUT_JOINT_MATERIAL.rows` | 'part' | finding when r.status === 'FAIL'; otherwise evidence | [r.part] | [cutmaterial.ts:280](../src/cutmaterial.ts#L280) |
|
|
8059
8093
|
| `FEET_STAY_LEVEL.feet` | `FEET_STAY_LEVEL.feet` | 'part' | finding when row.status === 'FAIL'; otherwise evidence | [row.part] | [check.ts:3719](../src/check.ts#L3719) |
|
|
8060
8094
|
| `FEET_STAY_LEVEL.feet[].worst.through` | `FEET_STAY_LEVEL.feet[].worst.through` | 'rig' | evidence | [] | [check.ts:3694](../src/check.ts#L3694) |
|
|
@@ -8062,37 +8096,40 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
|
|
|
8062
8096
|
| `PART_SUPPORT_REPORT.pairs` | `PART_SUPPORT_REPORT.pairs` | 'pair' | evidence; finding when length > 0; otherwise evidence | [F.name, B.name] | [coincide.ts:114](../src/coincide.ts#L114), [coincide.ts:130](../src/coincide.ts#L130) |
|
|
8063
8097
|
| `PART_SUPPORT_REPORT.raw_pairs` | `PART_SUPPORT_REPORT.raw_pairs` | 'pair' | evidence | [F.name, B.name] | [coincide.ts:110](../src/coincide.ts#L110) |
|
|
8064
8098
|
| `PART_SUPPORT_REPORT.unowned.regions` | `PART_SUPPORT_REPORT.unowned.regions` | 'rig' | finding | [] | [coincide.ts:145](../src/coincide.ts#L145) |
|
|
8065
|
-
| `SEAM_OVER_MOTION.pairs` | `SEAM_OVER_MOTION.pairs` | 'pair' | evidence | [p.a, p.b] | [check.ts:
|
|
8066
|
-
| `SEAM_OVER_MOTION.required.pairs` | `SEAM_OVER_MOTION.required.pairs` | 'pair' | finding when open > 0; otherwise evidence | [p.a, p.b] | [check.ts:
|
|
8067
|
-
| `SEAM_OVER_MOTION.
|
|
8068
|
-
| `SEAM_OVER_MOTION.
|
|
8069
|
-
| `SEAM_OVER_MOTION.rows
|
|
8070
|
-
| `SEAM_OVER_MOTION.rows[].
|
|
8099
|
+
| `SEAM_OVER_MOTION.pairs` | `SEAM_OVER_MOTION.pairs` | 'pair' | evidence | [p.a, p.b] | [check.ts:5357](../src/check.ts#L5357) |
|
|
8100
|
+
| `SEAM_OVER_MOTION.required.pairs` | `SEAM_OVER_MOTION.required.pairs` | 'pair' | finding when open > 0; otherwise evidence | [p.a, p.b] | [check.ts:4681](../src/check.ts#L4681) |
|
|
8101
|
+
| `SEAM_OVER_MOTION.required.pairs[].open_frames` | `SEAM_OVER_MOTION.required.pairs[].open_frames` | 'pair' | evidence | [p.a, p.b] | [check.ts:4673](../src/check.ts#L4673) |
|
|
8102
|
+
| `SEAM_OVER_MOTION.roots.unmeasured` | `SEAM_OVER_MOTION.roots.unmeasured` | 'part' | evidence | [root.part] | [check.ts:5334](../src/check.ts#L5334) |
|
|
8103
|
+
| `SEAM_OVER_MOTION.rows` | `SEAM_OVER_MOTION.rows` | 'pair'; unique ? 'pair' : 'rig' | finding when motionSeamFinding(want.root !== undefined, p.status, p.banded, opens.length); otherwise evidence; finding when motionSeamFinding(rootNames.has(r.pair), r.status, r.banded, r.opens.length); otherwise evidence | [want.a, want.b]; unique ? [pair.a, pair.b] : [] | [check.ts:5291](../src/check.ts#L5291), [check.ts:5363](../src/check.ts#L5363) |
|
|
8104
|
+
| `SEAM_OVER_MOTION.rows[].cells` | `SEAM_OVER_MOTION.rows[].cells` | 'pair' | evidence | [want.a, want.b] | [check.ts:5304](../src/check.ts#L5304) |
|
|
8105
|
+
| `SEAM_OVER_MOTION.rows[].joint_contact.reasons` | `SEAM_OVER_MOTION.rows[].joint_contact.reasons` | 'pair' | evidence | [want.a, want.b] | [check.ts:5294](../src/check.ts#L5294) |
|
|
8071
8106
|
| `SEAM_OVER_MOTION.rows[].pose_at_worst.joints` | `SEAM_OVER_MOTION.rows[].pose_at_worst.joints` | 'rig' | evidence | [] | [motionseampose.ts:53](../src/motionseampose.ts#L53) |
|
|
8072
|
-
| `SEAM_OVER_MOTION.worlds.*.rows` | `SEAM_OVER_MOTION.worlds.*.rows` | 'pair' | evidence | [want.a, want.b] | [check.ts:
|
|
8107
|
+
| `SEAM_OVER_MOTION.worlds.*.rows` | `SEAM_OVER_MOTION.worlds.*.rows` | 'pair' | evidence | [want.a, want.b] | [check.ts:5288](../src/check.ts#L5288) |
|
|
8073
8108
|
| `SEAM_OVER_RANGE.joints` | `SEAM_OVER_RANGE.joints` | 'part' | evidence; finding when poses.some(p => p.status === 'FAIL'); otherwise evidence | [j.part] | [check.ts:4335](../src/check.ts#L4335), [check.ts:4381](../src/check.ts#L4381) |
|
|
8074
8109
|
| `SEAM_OVER_RANGE.joints[].poses` | `SEAM_OVER_RANGE.joints[].poses` | 'part' | finding when fail; otherwise evidence | [j.part] | [check.ts:4379](../src/check.ts#L4379) |
|
|
8075
8110
|
| `SETUP_MATCHES_PAINTING.regions` | `SETUP_MATCHES_PAINTING.regions` | 'rig' | finding when status === 'FAIL'; otherwise evidence | [] | [setuppainting.ts:174](../src/setuppainting.ts#L174) |
|
|
8076
8111
|
| `SETUP_MATCHES_PAINTING.regions[].slots` | `SETUP_MATCHES_PAINTING.regions[].slots` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for slot; otherwise [] | [setuppainting.ts:175](../src/setuppainting.ts#L175) |
|
|
8077
|
-
| `STILL_REGIONS_DARK.*.crossing` | `STILL_REGIONS_DARK.*.crossing` | part when the supplied mapping resolves a piece; otherwise rig | finding | resolved piece for sl.name; otherwise [] | [check.ts:
|
|
8078
|
-
| `STILL_REGIONS_DARK.*.still_slots` | `STILL_REGIONS_DARK.*.still_slots` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when r.max > tolerance; otherwise evidence | resolved piece for slot; otherwise [] | [check.ts:
|
|
8112
|
+
| `STILL_REGIONS_DARK.*.crossing` | `STILL_REGIONS_DARK.*.crossing` | part when the supplied mapping resolves a piece; otherwise rig | finding | resolved piece for sl.name; otherwise [] | [check.ts:8910](../src/check.ts#L8910) |
|
|
8113
|
+
| `STILL_REGIONS_DARK.*.still_slots` | `STILL_REGIONS_DARK.*.still_slots` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when r.max > tolerance; otherwise evidence | resolved piece for slot; otherwise [] | [check.ts:8896](../src/check.ts#L8896), [check.ts:8901](../src/check.ts#L8901) |
|
|
8079
8114
|
| `STRESS_OFF_CHAIN.not_read` | `STRESS_OFF_CHAIN.not_read` | 'part' | evidence | [r.part] | [check.ts:3939](../src/check.ts#L3939) |
|
|
8080
8115
|
| `STRESS_OFF_CHAIN.per_part` | `STRESS_OFF_CHAIN.per_part` | 'part' | finding when poses.some(p => typeof p.reading === 'number' && p.reading > STRESS_RIGID); otherwise evidence | [r.part] | [check.ts:3927](../src/check.ts#L3927) |
|
|
8081
8116
|
| `STRESS_OFF_CHAIN.per_part[].off_chain` | `STRESS_OFF_CHAIN.per_part[].off_chain` | 'part' | evidence | [r.part] | [check.ts:3927](../src/check.ts#L3927) |
|
|
8082
8117
|
| `STRESS_OFF_CHAIN.per_part[].poses` | `STRESS_OFF_CHAIN.per_part[].poses` | 'part' | evidence; finding when shown > STRESS_RIGID; otherwise evidence | [r.part] | [check.ts:3895](../src/check.ts#L3895), [check.ts:3913](../src/check.ts#L3913) |
|
|
8083
|
-
| `TEXTURE_STRETCH.per_mesh` | `TEXTURE_STRETCH.per_mesh` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when severity > TEXTURE_STRETCH_CEILING; otherwise evidence | resolved piece for m.slot; otherwise [] | [check.ts:
|
|
8084
|
-
| `TIP_OVER_ROOT.parts` | `TIP_OVER_ROOT.parts` | 'part' | evidence; finding when !ok && !(!rigid && hanging.onLink && Math.max(c.root, c.tip) < TIP_TRAVEL_FLOOR); otherwise evidence | [p.name] | [check.ts:
|
|
8085
|
-
| `WIND_BAND.pairs` | `WIND_BAND.pairs` | 'pair' | finding when !holdsAll; otherwise evidence | [p.a, p.b] | [check.ts:
|
|
8086
|
-
| `WIND_BAND.pairs[].steps` | `WIND_BAND.pairs[].steps` | 'pair' | finding when !s.holds; otherwise evidence | [p.a, p.b] | [check.ts:
|
|
8087
|
-
| `figure_openings.openings` | `figure_openings.openings` | 'pair' | finding | [ps.under, ps.above] | [check.ts:
|
|
8088
|
-
| `loop_physics` | `loop_physics` | 'rig' | evidence | [] | [check.ts:
|
|
8089
|
-
| `requirements.lines.* (bone)` | `requirements.lines.*` | 'rig' | finding when line.status === 'FAIL'; otherwise evidence | [] | [check.ts:
|
|
8090
|
-
| `requirements.lines.* (seam)` | `requirements.lines.*` | 'pair' | finding when line.status === 'FAIL'; otherwise evidence | [r.part, r.neighbour] | [check.ts:
|
|
8091
|
-
| `requirements.lines.* (stretch)` | `requirements.lines.*` | part when the supplied mapping resolves a piece; otherwise rig | finding when line.status === 'FAIL'; otherwise evidence | resolved piece for r.slot; otherwise [] | [check.ts:
|
|
8118
|
+
| `TEXTURE_STRETCH.per_mesh` | `TEXTURE_STRETCH.per_mesh` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when severity > TEXTURE_STRETCH_CEILING; otherwise evidence | resolved piece for m.slot; otherwise [] | [check.ts:9544](../src/check.ts#L9544), [check.ts:9554](../src/check.ts#L9554) |
|
|
8119
|
+
| `TIP_OVER_ROOT.parts` | `TIP_OVER_ROOT.parts` | 'part' | evidence; finding when !ok && !(!rigid && hanging.onLink && Math.max(c.root, c.tip) < TIP_TRAVEL_FLOOR); otherwise evidence | [p.name] | [check.ts:8325](../src/check.ts#L8325), [check.ts:8330](../src/check.ts#L8330), [check.ts:8351](../src/check.ts#L8351), [check.ts:8362](../src/check.ts#L8362) |
|
|
8120
|
+
| `WIND_BAND.pairs` | `WIND_BAND.pairs` | 'pair' | finding when !holdsAll; otherwise evidence | [p.a, p.b] | [check.ts:6464](../src/check.ts#L6464) |
|
|
8121
|
+
| `WIND_BAND.pairs[].steps` | `WIND_BAND.pairs[].steps` | 'pair' | finding when !s.holds; otherwise evidence | [p.a, p.b] | [check.ts:6475](../src/check.ts#L6475) |
|
|
8122
|
+
| `figure_openings.openings` | `figure_openings.openings` | 'pair' | finding | [ps.under, ps.above] | [check.ts:5781](../src/check.ts#L5781) |
|
|
8123
|
+
| `loop_physics` | `loop_physics` | 'rig' | evidence | [] | [check.ts:7445](../src/check.ts#L7445) |
|
|
8124
|
+
| `requirements.lines.* (bone)` | `requirements.lines.*` | 'rig' | finding when line.status === 'FAIL'; otherwise evidence | [] | [check.ts:7744](../src/check.ts#L7744) |
|
|
8125
|
+
| `requirements.lines.* (seam)` | `requirements.lines.*` | 'pair' | finding when line.status === 'FAIL'; otherwise evidence | [r.part, r.neighbour] | [check.ts:7744](../src/check.ts#L7744) |
|
|
8126
|
+
| `requirements.lines.* (stretch)` | `requirements.lines.*` | part when the supplied mapping resolves a piece; otherwise rig | finding when line.status === 'FAIL'; otherwise evidence | resolved piece for r.slot; otherwise [] | [check.ts:7744](../src/check.ts#L7744) |
|
|
8127
|
+
| `seam_cells.frames` | `frames` | 'pair' | evidence | [p.a, p.b] | [check.ts:4670](../src/check.ts#L4670) |
|
|
8128
|
+
| `seam_cells.frames[].cells` | `frames[].cells` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for cell.setupTop ?? ''; otherwise [] | [check.ts:4630](../src/check.ts#L4630) |
|
|
8092
8129
|
| `seam_pairs` | `seam_pairs`; `seam_scope.whole_pairs`; `sets.*.seam_pairs`; `sets.*.seam_scope.whole_pairs` | subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair' | evidence | subjects | [check.ts:2480](../src/check.ts#L2480) |
|
|
8093
8130
|
| `seam_scope.changes` | `seam_scope.changes`; `sets.*.seam_scope.changes` | 'rig' | evidence | [] | [check.ts:1958](../src/check.ts#L1958) |
|
|
8094
8131
|
| `seam_scope.domain.states` | `seam_scope.domain.states`; `sets.*.seam_scope.domain.states` | 'rig' | evidence | [] | [check.ts:2043](../src/check.ts#L2043) |
|
|
8095
|
-
| `seam_scope.pairs` | `seam_scope.pairs`; `sets.*.seam_scope.pairs` | subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair' | evidence | subjects | [check.ts:
|
|
8132
|
+
| `seam_scope.pairs` | `seam_scope.pairs`; `sets.*.seam_scope.pairs` | subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair' | evidence | subjects | [check.ts:7355](../src/check.ts#L7355) |
|
|
8096
8133
|
| `seam_scope.population.pairs` | `seam_scope.population.pairs`; `sets.*.seam_scope.population.pairs` | 'pair' | evidence | row.parts | [check.ts:2414](../src/check.ts#L2414) |
|
|
8097
8134
|
| `seam_scope.population.single_art` | `seam_scope.population.single_art`; `sets.*.seam_scope.population.single_art` | 'part' | evidence | [row.part] | [check.ts:2415](../src/check.ts#L2415) |
|
|
8098
8135
|
|
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.
|
|
3
|
+
"version": "2.20.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": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"ag-psd": "^31.0.2",
|
|
71
|
-
"@rig-c/core": "3.
|
|
71
|
+
"@rig-c/core": "3.4.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@esotericsoftware/spine-core": "4.3.13",
|
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/check.ts
CHANGED
|
@@ -4507,7 +4507,36 @@ export interface MotionBackgroundRow {
|
|
|
4507
4507
|
drawn: number;
|
|
4508
4508
|
banded: number;
|
|
4509
4509
|
/** rigc's `gapOpen` hits with a cell: background inside the carried setup-overlap band, alpha 0 in the whole skeleton composite. */
|
|
4510
|
-
hits: Array<MotionSeamHit & { time: number }>;
|
|
4510
|
+
hits: Array<MotionSeamHit & { time: number; cells?: MotionOpenCell[] }>;
|
|
4511
|
+
}
|
|
4512
|
+
|
|
4513
|
+
/** Setup slot names are retained verbatim; classification uses the manifest's witnessed slot mapping. */
|
|
4514
|
+
export interface MotionOpenCell {
|
|
4515
|
+
x: number;
|
|
4516
|
+
y: number;
|
|
4517
|
+
setupTop: string | null;
|
|
4518
|
+
setupUnder: string | null;
|
|
4519
|
+
class: 'figure' | 'background' | 'other';
|
|
4520
|
+
}
|
|
4521
|
+
|
|
4522
|
+
export interface MotionOpenFrame extends MotionSeamHit {
|
|
4523
|
+
animation: string;
|
|
4524
|
+
time: number;
|
|
4525
|
+
classes: { figure: number; background: number; other: number };
|
|
4526
|
+
cells_index: number;
|
|
4527
|
+
}
|
|
4528
|
+
|
|
4529
|
+
export interface MotionCellFrame extends MotionSeamHit {
|
|
4530
|
+
pair: string;
|
|
4531
|
+
animation: string;
|
|
4532
|
+
time: number;
|
|
4533
|
+
cells: MotionOpenCell[];
|
|
4534
|
+
}
|
|
4535
|
+
|
|
4536
|
+
export const MOTION_CELLS_FILE = 'seam-cells.json';
|
|
4537
|
+
export interface MotionCellSidecar {
|
|
4538
|
+
spec: 'rig-parts-seam-cells/1';
|
|
4539
|
+
frames: MotionCellFrame[];
|
|
4511
4540
|
}
|
|
4512
4541
|
|
|
4513
4542
|
/** Issue #941: `SEAM_OVER_MOTION`'s `required` block. The bar is 0 background cells on every frame read; it never SKIPs. */
|
|
@@ -4516,9 +4545,10 @@ export interface MotionSeamRequired {
|
|
|
4516
4545
|
mode: 'gap-open';
|
|
4517
4546
|
bar_px: 0;
|
|
4518
4547
|
/** Every declared pair, its class, and the frames read over every animation. */
|
|
4519
|
-
pairs: Array<{ pair: string; class: MotionSeamClass; frames: number; background_frames: number; max_px: number }>;
|
|
4548
|
+
pairs: Array<{ pair: string; class: MotionSeamClass; frames: number; background_frames: number; max_px: number; open_frames?: MotionOpenFrame[] }>;
|
|
4520
4549
|
/** How many refusals the bar added. */
|
|
4521
4550
|
failed: number;
|
|
4551
|
+
cells?: { path: string; sha256: string };
|
|
4522
4552
|
}
|
|
4523
4553
|
|
|
4524
4554
|
/** A declared pair's class: a proven root first, then a limb joint, otherwise its explicit declaration. */
|
|
@@ -4533,7 +4563,7 @@ export function motionSeamClass(p: MotionSeamPair): MotionSeamClass {
|
|
|
4533
4563
|
* the rate asked (stride 1, written = sampled), a file that is not the animation's or the rate's, a pair out of the
|
|
4534
4564
|
* flag's order, and a `gapOpen` of the wrong shape — unavailable is never a measured zero.
|
|
4535
4565
|
*/
|
|
4536
|
-
export function readMotionSeamBackground(dir: string, animations: readonly string[], fps: number, pairs: readonly MotionSeamPair[]): MotionBackgroundRow[] {
|
|
4566
|
+
export function readMotionSeamBackground(dir: string, animations: readonly string[], fps: number, pairs: readonly MotionSeamPair[], cellSlots?: ReadonlyMap<string, string>): MotionBackgroundRow[] {
|
|
4537
4567
|
const problems: Problem[] = [];
|
|
4538
4568
|
const bad = (object: string, detail: string): void => { problems.push({ code: 'FRAMES_SIDECAR', object, detail }); };
|
|
4539
4569
|
const sidecar = readJson(join(dir, 'frames.json'), problems);
|
|
@@ -4558,10 +4588,19 @@ export function readMotionSeamBackground(dir: string, animations: readonly strin
|
|
|
4558
4588
|
if (!isRecord(p) || p.a !== want.a || p.b !== want.b) { bad(at, `is ${JSON.stringify(isRecord(p) ? `${String(p.a)}|${String(p.b)}` : p)}; "${want.pair}", the flag's entry ${i}, is required`); return; }
|
|
4559
4589
|
const open = p.gapOpen;
|
|
4560
4590
|
const frames = isRecord(open) && Array.isArray(open.frames) ? open.frames : null;
|
|
4591
|
+
if (cellSlots !== undefined) {
|
|
4592
|
+
for (const kind of ['gapOpen', 'gapCovered'] as const) {
|
|
4593
|
+
const reading = p[kind];
|
|
4594
|
+
if (!isRecord(reading) || !Array.isArray(reading.frames)) { bad(`${at} ${kind}`, 'requires frames when --seam-cells was requested'); continue; }
|
|
4595
|
+
if (kind === 'gapCovered') for (const [index, hit] of reading.frames.entries()) readMotionOpenCells(hit, `${at} ${kind}.frames[${index}]`, cellSlots, bad);
|
|
4596
|
+
if (reading.worst !== null) readMotionOpenCells(reading.worst, `${at} ${kind}.worst`, cellSlots, bad);
|
|
4597
|
+
}
|
|
4598
|
+
}
|
|
4561
4599
|
const hits = frames === null ? [] : frames.flatMap((h) => isRecord(h) && Number.isSafeInteger(h.index) && typeof h.index === 'number' && h.index >= 0 && h.index < (set.sampled as number) &&
|
|
4562
4600
|
Number.isSafeInteger(h.px) && typeof h.px === 'number' && h.px > 0 && typeof h.cell === 'number' && h.cell > 0 && typeof h.time === 'number' && Number.isFinite(h.time) &&
|
|
4563
4601
|
Array.isArray(h.box) && h.box.length === 4 && h.box.every((v) => typeof v === 'number' && Number.isFinite(v))
|
|
4564
|
-
? [{ index: h.index, px: h.px, cell: h.cell, time: h.time, box: [h.box[0], h.box[1], h.box[2], h.box[3]] as [number, number, number, number]
|
|
4602
|
+
? [{ index: h.index, px: h.px, cell: h.cell, time: h.time, box: [h.box[0], h.box[1], h.box[2], h.box[3]] as [number, number, number, number],
|
|
4603
|
+
...(cellSlots === undefined ? {} : { cells: readMotionOpenCells(h, `${at} gapOpen frame ${h.index}`, cellSlots, bad) }) }] : []);
|
|
4565
4604
|
if ((p.status !== 'read' && p.status !== 'skip') || typeof p.drawn !== 'number' || typeof p.banded !== 'number' || frames === null || hits.length !== frames.length || new Set(hits.map((h) => h.index)).size !== hits.length) {
|
|
4566
4605
|
bad(`${at} gapOpen`, 'requires { frames: [{ index, time, px > 0, cell, box }…] } on every pair, one hit per frame, as rigc-seam/1 writes it from rig-c 2.69.0 — unavailable is not zero background');
|
|
4567
4606
|
return;
|
|
@@ -4573,6 +4612,27 @@ export function readMotionSeamBackground(dir: string, animations: readonly strin
|
|
|
4573
4612
|
return rows;
|
|
4574
4613
|
}
|
|
4575
4614
|
|
|
4615
|
+
/** Unavailable cell evidence is refused before any report is emitted. */
|
|
4616
|
+
function readMotionOpenCells(hit: unknown, at: string, slots: ReadonlyMap<string, string>, bad: (object: string, detail: string) => void): MotionOpenCell[] {
|
|
4617
|
+
if (!isRecord(hit) || !Number.isSafeInteger(hit.px) || typeof hit.px !== 'number' || hit.px <= 0 || !Array.isArray(hit.cells) || hit.cells.length !== hit.px) {
|
|
4618
|
+
bad(at, 'requires cells.length === px > 0 when --seam-cells was requested; unavailable is not zero');
|
|
4619
|
+
return [];
|
|
4620
|
+
}
|
|
4621
|
+
const cells: MotionOpenCell[] = [];
|
|
4622
|
+
for (const [index, cell] of hit.cells.entries()) {
|
|
4623
|
+
if (!isRecord(cell) || typeof cell.x !== 'number' || !Number.isFinite(cell.x) || typeof cell.y !== 'number' || !Number.isFinite(cell.y) ||
|
|
4624
|
+
!(cell.setupTop === null || typeof cell.setupTop === 'string' && cell.setupTop.length > 0) ||
|
|
4625
|
+
!(cell.setupUnder === null || typeof cell.setupUnder === 'string' && cell.setupUnder.length > 0) ||
|
|
4626
|
+
cell.setupTop === null && cell.setupUnder !== null || cell.setupTop !== null && cell.setupTop === cell.setupUnder) {
|
|
4627
|
+
bad(`${at}.cells[${index}]`, `requires finite world-centre x/y and distinct setup slot names or null (a null top requires null under); found ${JSON.stringify(cell)}`);
|
|
4628
|
+
continue;
|
|
4629
|
+
}
|
|
4630
|
+
cells.push({ ...checkSlotRow('seam_cells.frames[].cells', false, cell.setupTop ?? '', slots),
|
|
4631
|
+
x: cell.x, y: cell.y, setupTop: cell.setupTop, setupUnder: cell.setupUnder, class: cell.setupTop === null ? 'background' : slots.has(cell.setupTop) ? 'figure' : 'other' });
|
|
4632
|
+
}
|
|
4633
|
+
return cells;
|
|
4634
|
+
}
|
|
4635
|
+
|
|
4576
4636
|
/**
|
|
4577
4637
|
* Issue #941: the bar `seam_over_motion.required: true` declares — 0 background cells (rigc's `gapOpen`: gap cells
|
|
4578
4638
|
* inside the carried setup-overlap band where the whole skeleton composite has alpha 0) on every frame of every
|
|
@@ -4580,7 +4640,7 @@ export function readMotionSeamBackground(dir: string, animations: readonly strin
|
|
|
4580
4640
|
* that measured nothing is refused too, since a SKIP is never a pass. Problems are pushed, one per pair and
|
|
4581
4641
|
* animation (with its worst frame) and one per pair or line not measured; the block is returned.
|
|
4582
4642
|
*/
|
|
4583
|
-
export function motionSeamRequired(line: MotionSeamLine, rows: readonly MotionBackgroundRow[], requirements: string, problems: Problem[]): MotionSeamRequired {
|
|
4643
|
+
export function motionSeamRequired(line: MotionSeamLine, rows: readonly MotionBackgroundRow[], requirements: string, problems: Problem[], cellEvidence: MotionCellSidecar = { spec: 'rig-parts-seam-cells/1', frames: [] }): MotionSeamRequired {
|
|
4584
4644
|
const before = problems.length;
|
|
4585
4645
|
const why = `${requirements} declares seam_over_motion.required: true, so 0 background px is required on every frame of every declared seam pair`;
|
|
4586
4646
|
const refuse = (object: string, detail: string): void => { problems.push({ code: MOTION_SEAM_REQUIRED_CODE, object, detail }); };
|
|
@@ -4594,6 +4654,7 @@ export function motionSeamRequired(line: MotionSeamLine, rows: readonly MotionBa
|
|
|
4594
4654
|
let frames = 0;
|
|
4595
4655
|
let open = 0;
|
|
4596
4656
|
let max = 0;
|
|
4657
|
+
const openFrames: MotionOpenFrame[] = [];
|
|
4597
4658
|
if (p.unread !== undefined) refuse(label, `is not read — ${p.unread}; ${why}`);
|
|
4598
4659
|
else for (const animation of line.animations) {
|
|
4599
4660
|
const r = rows.find((x) => x.pair === p.pair && x.animation === animation);
|
|
@@ -4604,15 +4665,102 @@ export function motionSeamRequired(line: MotionSeamLine, rows: readonly MotionBa
|
|
|
4604
4665
|
frames += r.frames;
|
|
4605
4666
|
open += r.hits.length;
|
|
4606
4667
|
if (r.hits.length === 0) continue;
|
|
4668
|
+
for (const hit of r.hits) if (hit.cells !== undefined) {
|
|
4669
|
+
const cellsIndex = cellEvidence.frames.length;
|
|
4670
|
+
cellEvidence.frames.push({ ...checkRow('seam_cells.frames', 'pair', false, [p.a, p.b]), pair: p.pair,
|
|
4671
|
+
animation, index: hit.index, time: hit.time, px: hit.px, cell: hit.cell, box: hit.box, cells: hit.cells });
|
|
4672
|
+
const classes = motionCellClasses(hit.cells);
|
|
4673
|
+
openFrames.push({ ...checkRow('SEAM_OVER_MOTION.required.pairs[].open_frames', 'pair', false, [p.a, p.b]),
|
|
4674
|
+
animation, index: hit.index, time: hit.time, px: hit.px, cell: hit.cell, box: hit.box, classes, cells_index: cellsIndex });
|
|
4675
|
+
}
|
|
4607
4676
|
const worst = r.hits.reduce((b, h) => (h.px > b.px || (h.px === b.px && h.index < b.index) ? h : b));
|
|
4608
4677
|
max = Math.max(max, worst.px);
|
|
4609
4678
|
refuse(`${label} in "${animation}" at frame ${worst.index} (t = ${worst.time}s)`,
|
|
4610
4679
|
`background on ${r.hits.length} of ${r.frames} frame(s) read ${frameRuns(r.hits.map((h) => h.index))}: found ${worst.px} px (rigc gapOpen cells of ${worst.cell} world units, world box [${worst.box.join(', ')}]) on the worst frame, 0 required; ${why}`);
|
|
4611
4680
|
}
|
|
4612
|
-
out.push({ ...checkRow('SEAM_OVER_MOTION.required.pairs', 'pair', open > 0, [p.a, p.b]), pair: p.pair, class: cls, frames, background_frames: open, max_px: max
|
|
4681
|
+
out.push({ ...checkRow('SEAM_OVER_MOTION.required.pairs', 'pair', open > 0, [p.a, p.b]), pair: p.pair, class: cls, frames, background_frames: open, max_px: max,
|
|
4682
|
+
...(openFrames.length === 0 ? {} : { open_frames: openFrames }) });
|
|
4613
4683
|
}
|
|
4614
4684
|
const failed = problems.length - before;
|
|
4615
|
-
return { status: failed === 0 ? 'PASS' : 'FAIL', mode: 'gap-open', bar_px: 0, pairs: out, failed
|
|
4685
|
+
return { status: failed === 0 ? 'PASS' : 'FAIL', mode: 'gap-open', bar_px: 0, pairs: out, failed,
|
|
4686
|
+
...(cellEvidence.frames.length === 0 ? {} : { cells: { path: MOTION_CELLS_FILE, sha256: createHash('sha256').update(serializeCheckRows(cellEvidence)).digest('hex') } }) };
|
|
4687
|
+
}
|
|
4688
|
+
|
|
4689
|
+
/** The inline partition counts the same cells as the sidecar, including unresolved setup slots. */
|
|
4690
|
+
function motionCellClasses(cells: readonly MotionOpenCell[]): MotionOpenFrame['classes'] {
|
|
4691
|
+
const counts = { figure: 0, background: 0, other: 0 };
|
|
4692
|
+
for (const cell of cells) counts[cell.class]++;
|
|
4693
|
+
return counts;
|
|
4694
|
+
}
|
|
4695
|
+
|
|
4696
|
+
/** Refuse broken evidence links and partitions rather than silently consuming partial evidence. */
|
|
4697
|
+
export function readMotionSeamCellSidecar(dir: string, required: MotionSeamRequired): MotionCellSidecar | null {
|
|
4698
|
+
if (required.cells === undefined) return null;
|
|
4699
|
+
const bad = (object: string, detail: string): never => {
|
|
4700
|
+
refuseIfAny([{ code: 'FRAMES_SIDECAR', object, detail }]);
|
|
4701
|
+
throw new Error('unreachable');
|
|
4702
|
+
};
|
|
4703
|
+
const reference = required.cells;
|
|
4704
|
+
if (reference.path !== MOTION_CELLS_FILE || !/^[a-f0-9]{64}$/.test(reference.sha256)) bad('SEAM_OVER_MOTION.required.cells', 'requires relative seam-cells.json path and a SHA-256 digest');
|
|
4705
|
+
const path = join(dir, reference.path);
|
|
4706
|
+
let bytes: Buffer;
|
|
4707
|
+
try { bytes = readFileSync(path); }
|
|
4708
|
+
catch { return bad(path, 'referenced cell sidecar is missing or unreadable; unavailable is not zero'); }
|
|
4709
|
+
const digest = createHash('sha256').update(bytes).digest('hex');
|
|
4710
|
+
if (digest !== reference.sha256) bad(path, `SHA-256 is ${digest}; required ${reference.sha256}`);
|
|
4711
|
+
let value: unknown;
|
|
4712
|
+
try { value = JSON.parse(bytes.toString('utf8')) as unknown; }
|
|
4713
|
+
catch { return bad(path, 'requires a JSON rig-parts-seam-cells/1 document'); }
|
|
4714
|
+
if (!isRecord(value) || value.spec !== 'rig-parts-seam-cells/1' || !Array.isArray(value.frames)) return bad(path, 'requires rig-parts-seam-cells/1 frames');
|
|
4715
|
+
const seen = new Set<number>();
|
|
4716
|
+
for (const pair of required.pairs) for (const frame of pair.open_frames ?? []) {
|
|
4717
|
+
const at = `${path} frames[${frame.cells_index}]`;
|
|
4718
|
+
const read: unknown = value.frames[frame.cells_index];
|
|
4719
|
+
if (!Number.isSafeInteger(frame.cells_index) || frame.cells_index < 0 || seen.has(frame.cells_index) || !isRecord(read) ||
|
|
4720
|
+
read.pair !== pair.pair || read.animation !== frame.animation || read.index !== frame.index || read.time !== frame.time || read.px !== frame.px || read.cell !== frame.cell ||
|
|
4721
|
+
JSON.stringify(read.box) !== JSON.stringify(frame.box) || !Array.isArray(read.cells) || read.cells.length !== frame.px) {
|
|
4722
|
+
bad(at, 'requires one matching pair-frame with cells.length === gapOpen px; unavailable is not zero');
|
|
4723
|
+
continue;
|
|
4724
|
+
}
|
|
4725
|
+
seen.add(frame.cells_index);
|
|
4726
|
+
const classes = { figure: 0, background: 0, other: 0 };
|
|
4727
|
+
for (const cell of read.cells) {
|
|
4728
|
+
if (!isRecord(cell) || typeof cell.x !== 'number' || !Number.isFinite(cell.x) || typeof cell.y !== 'number' || !Number.isFinite(cell.y) ||
|
|
4729
|
+
!(cell.setupTop === null || typeof cell.setupTop === 'string' && cell.setupTop.length > 0) ||
|
|
4730
|
+
!(cell.setupUnder === null || typeof cell.setupUnder === 'string' && cell.setupUnder.length > 0) ||
|
|
4731
|
+
!['figure', 'background', 'other'].includes(String(cell.class))) bad(at, 'requires finite world centres, setup names and figure/background/other classes');
|
|
4732
|
+
else classes[cell.class as MotionOpenCell['class']]++;
|
|
4733
|
+
}
|
|
4734
|
+
if (!frame.classes || !Object.values(frame.classes).every(n => Number.isSafeInteger(n) && n >= 0) ||
|
|
4735
|
+
frame.classes.figure + frame.classes.background + frame.classes.other !== frame.px ||
|
|
4736
|
+
frame.classes.figure !== classes.figure || frame.classes.background !== classes.background || frame.classes.other !== classes.other) {
|
|
4737
|
+
bad(at, `inline figure/background/other counts ${JSON.stringify(frame.classes)} must sum to gapOpen px ${frame.px} and match sidecar ${JSON.stringify(classes)}`);
|
|
4738
|
+
}
|
|
4739
|
+
}
|
|
4740
|
+
if (seen.size !== value.frames.length) bad(path, `has ${value.frames.length} frame(s); inline rows reference ${seen.size} distinct frame(s)`);
|
|
4741
|
+
// Every cell and its pair/frame identity was checked above after the digest matched.
|
|
4742
|
+
return value as unknown as MotionCellSidecar;
|
|
4743
|
+
}
|
|
4744
|
+
|
|
4745
|
+
/** Publish check.json and its cell evidence together, restoring previous bytes on refusal. */
|
|
4746
|
+
export function publishMotionSeamCells(dir: string, required: MotionSeamRequired | undefined, evidence: MotionCellSidecar, publish: () => void): void {
|
|
4747
|
+
const path = join(dir, MOTION_CELLS_FILE), check = join(dir, 'check.json');
|
|
4748
|
+
const previous = existsSync(path) ? readFileSync(path) : null;
|
|
4749
|
+
const previousCheck = existsSync(check) ? readFileSync(check) : null;
|
|
4750
|
+
try {
|
|
4751
|
+
if (required?.cells !== undefined) {
|
|
4752
|
+
writeFileSync(path, serializeCheckRows(evidence));
|
|
4753
|
+
readMotionSeamCellSidecar(dir, required);
|
|
4754
|
+
}
|
|
4755
|
+
publish();
|
|
4756
|
+
if (required?.cells === undefined) rmSync(path, { force: true });
|
|
4757
|
+
} catch (error) {
|
|
4758
|
+
if (previous === null) rmSync(path, { force: true });
|
|
4759
|
+
else writeFileSync(path, previous);
|
|
4760
|
+
if (previousCheck === null) rmSync(check, { force: true });
|
|
4761
|
+
else writeFileSync(check, previousCheck);
|
|
4762
|
+
throw error;
|
|
4763
|
+
}
|
|
4616
4764
|
}
|
|
4617
4765
|
|
|
4618
4766
|
/** Issue #941: the console line for the required block. */
|
|
@@ -6948,6 +7096,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6948
7096
|
// Issue #941: under seam_over_motion.required, the same render's gapOpen on every frame of every declared pair.
|
|
6949
7097
|
const seamRequired = seamOverMotionRequired(reqFile);
|
|
6950
7098
|
let backgroundRows: MotionBackgroundRow[] = [];
|
|
7099
|
+
const motionCellEvidence: MotionCellSidecar = { spec: 'rig-parts-seam-cells/1', frames: [] };
|
|
6951
7100
|
{
|
|
6952
7101
|
const fps = IDLE_FPS;
|
|
6953
7102
|
const seamReqs = reqFile === null || seams === null ? [] : reqFile.requirements.flatMap((r) => (r.kind === 'seam' && seams?.has(r.name) === true ? [{ name: r.name, part: r.part, neighbour: r.neighbour }] : []));
|
|
@@ -7007,11 +7156,12 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7007
7156
|
const activeDest = stripped === null ? seamMotionDir : join(seamMotionDir, env === null ? 'default' : 'active');
|
|
7008
7157
|
const renderedWorlds = new Set<'default' | 'still'>();
|
|
7009
7158
|
const hasRoots = read.some(p => p.root !== undefined);
|
|
7010
|
-
const r = measured(['render', '--candidate', buildDir, '--seam', list, '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--geometry', '--out', activeDest]);
|
|
7159
|
+
const r = measured(['render', '--candidate', buildDir, '--seam', list, ...(seamRequired ? ['--seam-cells'] : []), '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--geometry', '--out', activeDest]);
|
|
7011
7160
|
if (r.status !== 0) refuseIfAny(rigcFailed(`render --seam ${list} --fps ${fps}`, r, r.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
|
|
7012
7161
|
const activeWorldRows: MotionSeamWorldRow[] = [];
|
|
7013
7162
|
motionSeam = motionSeamLine(pairs, animationNames, fps, readMotionSeams(activeDest, animationNames, fps, read, {}, stripped !== null && env === null ? activeWorldRows : undefined, hasRoots ? motionRootDrawOrderReader(activeDest) : undefined), undefined, motionRootProblems, unmeasuredRoots);
|
|
7014
|
-
if (seamRequired) backgroundRows = readMotionSeamBackground(activeDest, animationNames, fps, read
|
|
7163
|
+
if (seamRequired) backgroundRows = readMotionSeamBackground(activeDest, animationNames, fps, read,
|
|
7164
|
+
checkSlotParts(inp.rig, inp.parts?.parts.map(p => p.name) ?? [], inp.parts?.alternates?.map(set => set.name) ?? []));
|
|
7015
7165
|
enrichMotionSeamPoses(activeDest, inp.rig, inp.parts, pairs, motionSeam.rows);
|
|
7016
7166
|
if (stripped !== null) {
|
|
7017
7167
|
const response = environmentResponse(readFileSync(join(buildDir, 'skeleton.json'), 'utf8'));
|
|
@@ -7039,7 +7189,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7039
7189
|
}
|
|
7040
7190
|
}
|
|
7041
7191
|
}
|
|
7042
|
-
if (seamRequired && reqFile !== null) motionSeam.required = motionSeamRequired(motionSeam, backgroundRows, reqFile.path, motionRootProblems);
|
|
7192
|
+
if (seamRequired && reqFile !== null) motionSeam.required = motionSeamRequired(motionSeam, backgroundRows, reqFile.path, motionRootProblems, motionCellEvidence);
|
|
7043
7193
|
const declaredPairKeys = new Set(motionSeam.pairs.map((p) => [p.a, p.b].sort().join('|')));
|
|
7044
7194
|
const figureOpenings: FigureOpeningReading =
|
|
7045
7195
|
inp.parts === null
|
|
@@ -7370,7 +7520,10 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7370
7520
|
problems.unshift(...barProblems);
|
|
7371
7521
|
problems.push(...cutMaterialProblems, ...foldProblems, ...levelProblems, ...stressProblems, ...limbProblems, ...sweepProblems, ...motionRootProblems, ...reqProblems);
|
|
7372
7522
|
figures.PASS = problems.length === 0;
|
|
7373
|
-
const publishCheck = (): void =>
|
|
7523
|
+
const publishCheck = (): void => {
|
|
7524
|
+
publishMotionSeamCells(out, motionSeam.required, motionCellEvidence, () => write('check.json', serializeCheckRows(figures)));
|
|
7525
|
+
if (motionSeam.required?.cells !== undefined) written.push(MOTION_CELLS_FILE);
|
|
7526
|
+
};
|
|
7374
7527
|
if (motionSeam.worlds === undefined) publishCheck();
|
|
7375
7528
|
else publishMotionSeamWorlds(out, seamMotionDir, motionSeam.worlds, publishCheck);
|
|
7376
7529
|
const extremes = noExtremes ? [] : renderExtremes(buildDir, out, animationNames, idle === null ? extremesFrames : readJson(join(idleDir, 'frames.json'), []), extremesFrames, measured);
|
package/src/checkrow.ts
CHANGED
|
@@ -19,6 +19,9 @@ export const CHECK_ROW_PATHS = {
|
|
|
19
19
|
'PART_SUPPORT_REPORT.unowned.regions': ['PART_SUPPORT_REPORT.unowned.regions'],
|
|
20
20
|
'SEAM_OVER_MOTION.pairs': ['SEAM_OVER_MOTION.pairs'],
|
|
21
21
|
'SEAM_OVER_MOTION.required.pairs': ['SEAM_OVER_MOTION.required.pairs'],
|
|
22
|
+
'SEAM_OVER_MOTION.required.pairs[].open_frames': ['SEAM_OVER_MOTION.required.pairs[].open_frames'],
|
|
23
|
+
'seam_cells.frames': ['frames'],
|
|
24
|
+
'seam_cells.frames[].cells': ['frames[].cells'],
|
|
22
25
|
'SEAM_OVER_MOTION.roots.unmeasured': ['SEAM_OVER_MOTION.roots.unmeasured'],
|
|
23
26
|
'SEAM_OVER_MOTION.rows': ['SEAM_OVER_MOTION.rows'],
|
|
24
27
|
'SEAM_OVER_MOTION.rows[].cells': ['SEAM_OVER_MOTION.rows[].cells'],
|
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 => {
|