rig-parts 2.53.0 → 2.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/AUTHORING.md CHANGED
@@ -7001,7 +7001,7 @@ and stay absent).
7001
7001
 
7002
7002
  | rule | means | change |
7003
7003
  | --- | --- | --- |
7004
- | <a id="SCENE_FILE"></a><a id="SCENE_SPEC"></a><a id="SCENE_FIELD_PRESENT"></a><a id="SCENE_FIELD_TYPE"></a><a id="SCENE_KEY_KNOWN"></a>`SCENE_FILE`, `SCENE_SPEC`, `SCENE_FIELD_PRESENT`, `SCENE_FIELD_TYPE`, `SCENE_KEY_KNOWN` | the scene file is missing, not a JSON object, not `spine-parts-scene/1`, or a field is missing, of the wrong type or not one the format reads (`canvas` two positive integers; `characters` at least one, each `id`, `build`, `offset` — an offset is never assumed (0, 0) — and an optional `scale`, a positive finite number: 0, a negative number or a non-number is refused at `characters[i].scale`; `order` a list of strings). `note`, `*_note` (strings) and `x-…` (any value) are read by nothing | the field |
7004
+ | <a id="SCENE_FILE"></a><a id="SCENE_SPEC"></a><a id="SCENE_FIELD_PRESENT"></a><a id="SCENE_FIELD_TYPE"></a><a id="SCENE_KEY_KNOWN"></a>`SCENE_FILE`, `SCENE_SPEC`, `SCENE_FIELD_PRESENT`, `SCENE_FIELD_TYPE`, `SCENE_KEY_KNOWN` | the scene file is missing, not a JSON object, not `spine-parts-scene/1`, or a field is missing, of the wrong type or not one the format reads (`canvas` two positive integers; `characters` at least one, each `id`, `build`, `offset` — an offset is never assumed (0, 0) — optional `scale` as a positive finite number, and optional `canvas_clip` as literal `true`; `order` a list of strings). `note`, `*_note` (strings) and `x-…` (any value) are read by nothing | the field |
7005
7005
  | <a id="SCENE_ID_UNIQUE"></a><a id="SCENE_ID_FORM"></a>`SCENE_ID_UNIQUE`, `SCENE_ID_FORM` | an `id` repeated, empty, or holding `:` — the separator of a prefixed name — or `/`, `\` or a leading `.`, because an id begins every image file of its character | another id |
7006
7006
  | <a id="SCENE_EDITOR_RECEIPT"></a>`SCENE_EDITOR_RECEIPT` | `scene.plate.editor_receipts` has a malformed ledger or receipt (issue #966) | use `{receipts: [{file, sha256, from_sha256, editor}], required?}` with the same shape rules as assemble editor receipts |
7007
7007
  | <a id="SCENE_EDITOR_RECEIPT_FILE"></a>`SCENE_EDITOR_RECEIPT_FILE` | a plate receipt names a missing file | supply the edited image relative to the scene file |
@@ -7026,7 +7026,10 @@ and stay absent).
7026
7026
  | <a id="SCENE_DIAL_KEY_DECLARED"></a>`SCENE_DIAL_KEY_DECLARED` | a scene key uses `derive` on a slider's input property, including one that also carries a raw `v`; derived slider inputs are not a supported scene dial dialect | declare an explicit numeric `v` for the named dial, within the named slider's own range; group member values are checked separately |
7027
7027
  | <a id="SCENE_ANIMATION_LOOP_CLOSES"></a>`SCENE_ANIMATION_LOOP_CLOSES` | the gated posed samples at 0 and the scene clip's declared duration differ, for a new clip or an idle extension | close the posed bone, slot, geometry, alpha, clip and draw-order state; comparison omits physics simulation only and never wraps the endpoint to zero |
7028
7028
  | <a id="SCENE_ANIMATION_POSE_READABLE"></a>`SCENE_ANIMATION_POSE_READABLE` | Core cannot read or pose the compiled scene clip for its endpoint comparison | correct the construct named by Core; unreadable poses never count as closed and no scene is emitted |
7029
- | <a id="SCENE_CHARACTER_INSIDE_CANVAS"></a>`SCENE_CHARACTER_INSIDE_CANVAS` | a character's part boxes, placed at its offset, leave the canvas (the boxes and the canvas px quoted) | the offset, or the canvas |
7029
+ | <a id="SCENE_CHARACTER_INSIDE_CANVAS"></a>`SCENE_CHARACTER_INSIDE_CANVAS` | a character without `canvas_clip` has placed part bounds that leave the canvas | adjust its scale, offset or canvas, or declare `canvas_clip: true` for intentional overflow |
7030
+ | <a id="SCENE_CHARACTER_CLIP_BOUNDS"></a>`SCENE_CHARACTER_CLIP_BOUNDS` | a character with `canvas_clip: true` has nonfinite placed part bounds | check the build's part bounds and the scene's scale and offset |
7031
+ | <a id="SCENE_CHARACTER_CLIP_UNUSED"></a>`SCENE_CHARACTER_CLIP_UNUSED` | a character with `canvas_clip: true` has placed part bounds wholly inside or flush with the canvas | omit `canvas_clip` or place the character so its bounds cross a canvas edge |
7032
+ | <a id="SCENE_CHARACTER_CLIP_EMPTY"></a>`SCENE_CHARACTER_CLIP_EMPTY` | a character with `canvas_clip: true` has placed part bounds whose canvas intersection has zero width or height, or lies entirely outside | place the character so its bounds overlap the canvas with positive width and height |
7030
7033
  | <a id="SCENE_ORDER_RESOLVES"></a>`SCENE_ORDER_RESOLVES` | an order entry names no character, or `<id>:<slot>` names a slot that character does not have (its slots listed) | the entry |
7031
7034
  | <a id="SCENE_ORDER_ONCE"></a><a id="SCENE_ORDER_COMPLETE"></a>`SCENE_ORDER_ONCE`, `SCENE_ORDER_COMPLETE` | a slot is drawn twice (a slot entry repeated, or an id listed twice), or never (the character's id is absent and some of its slots are named nowhere — they are listed) | name each slot once, or the id for the slots not named elsewhere |
7032
7035
  | <a id="SCENE_NAME_PREFIXED"></a><a id="SCENE_NAME_RESOLVES"></a>`SCENE_NAME_PREFIXED`, `SCENE_NAME_RESOLVES` | a build's constraint, `stops` entry, `invariants.detached` or physics track names a bone or physics constraint its own character does not declare — one another character does (`…_PREFIXED`, naming the prefixed names it could have meant) or none does (`…_RESOLVES`); or a `--requirements` name (bone, target bone, constraint, slot, attachment, seam part) is a bare name some character holds, which the composed rig holds only prefixed | a bone or physics constraint of the same character; in a requirements file, `<id>:<name>` |
@@ -7808,6 +7811,7 @@ single-character path (§4, steps 0–9) on its own, already isolated input to a
7808
7811
  | `plates` | optional list of named layers (issue #1345); may coexist with legacy `plate`. Every layer requires `name`, `image`, `provenance` and `at: [x, y]`. `image` resolves against the scene file and keeps its native dimensions and PNG bytes, with no scale or canvas containment requirement. `at` is two finite integers locating the image **top-left in canvas pixels, y down, origin top-left**; negative/outside positions are allowed. Missing, fractional and nonfinite placement is `SCENE_PLATE_AT`. Optional `note` and `editor_receipts` have the legacy plate meanings; every ledger is verified independently. `opaque_backdrop: true` exempts only that declared layer from compose's alpha requirement; otherwise at least one decoded texel must have alpha below 255 (`SCENE_PLATE_ALPHA`), even for an oversized image. An opaque declared backdrop must also have width at least `canvas.width` **and** height at least `canvas.height`, the composed rig's stage dimensions, matching core 3.8.0 A19's rig-spec size inference. A smaller opaque backdrop is refused before output by `SCENE_PLATE_BACKDROP_SIZE`; a transparent layer has no size floor. **Size is the only check on `opaque_backdrop`:** whether `at: [x, y]` positions the backdrop to cover the stage is the scene author's job (a canvas-sized backdrop at `[400, 0]` passes size while leaving part of the stage uncovered). rigc's A19 remains enabled |
7809
7812
  | `plates[].name` | the layer's bone, slot and attachment name and exact `order` token. Names must be unique, nonempty and distinct from `root`, legacy `plate`, shared `idle`, every character id and every prefixed character bone/slot/animation (`SCENE_PLATE_NAME_UNIQUE`, `SCENE_PLATE_NAME_FREE`; a name refused by either does not also draw a cascaded `SCENE_ORDER_COMPLETE`). Emitted image files and packed atlas regions are named by 0-based declaration index (`scene-plate.<index>.png`, atlas region `scene-plate.<index>`, Spine attachment `path: "scene-plate.<index>"`), separately from character images (`SCENE_IMAGE_NAME_FREE` on any collision) — so **reordering `plates[]` renames the `scene-plate.<index>` atlas regions** even when `plates[].name` and `order` are unchanged |
7810
7813
  | `characters[].scale` | optional, a positive number; absent is 1, and 1 composes to the bytes a scene without the key writes. The character's size on the canvas, about its stage's top-left corner: a rig px `p` lands at canvas px `scale * p + offset` (issue #197). A character scaled up past its art is drawn soft — the art is not resampled; rebuild it at a higher `assemble.rig_scale` if that matters |
7814
+ | `characters[].canvas_clip` | optional literal `true` for intentional overflow (issue #1491). The placed part bounds must be finite, extend past at least one canvas edge and overlap the canvas with positive width and height. Omitting the key requires containment, with flush edges allowed. Every explicit value other than `true` is `SCENE_FIELD_TYPE` |
7811
7815
  | `characters[].accept` | optional, a list of bar names: the bars this character's own check may have failed and still be composed (issue #203). `compose --accept <bar>[,<bar>…]` is the same list for every character; the two are joined, so the command line applies to every character and a character's list adds to it. Each name is one of the bars `check`'s summary names, less the gate — `loop`, `seam`, `BREATH_VISIBLE`, `BLINK_NO_HOLE`, `CHAIN_LAG`, `TIP_OVER_ROOT`, `STILL_REGIONS_DARK`, `TEXTURE_STRETCH`, `ANIMATIONS_DO_NOT_FOLD` (issue #320), `STRESS_OFF_CHAIN` (issue #347), `SEAM_OVER_MOTION` (the body-root bar, issue #686); anything else is `SCENE_ACCEPT_KNOWN`. When `check/check.json` declares `spec: "rig-parts-check/1"`, `compose` reads its `bar_outcomes` for the bars whose outcome status is `FAIL` in the report's order (issue #1373); without that spec it keeps the legacy `barsNotMet` reading. A build is taken when every bar its `check.json` failed is named; its gate red, a declared requirement not PASS, or a bar not named is `SCENE_BUILD_GREEN` as before. **It is for looking, not for shipping:** the `[compose]` line says which failing bars were accepted, `scene.json` records them as the character's `accepted`, the composed rig's own check measures them again and reports them as it finds them, and the run exits 1 even when that check is PASS (a composed rig has no `parts.json`, so the seam and four judgement lines say SKIP there). A list that accepts nothing — every build green — composes to the bytes a scene without one writes |
7812
7816
  | `animations` | optional map by scene clip name, each value a rigc `MotionAnimation` (`duration`, `tracks`, optional `loop`, `note`, and core timeline collections). Names resolve against the final scene without another prefix or unit conversion: `plate`, declared named plate bones and `<id>:<bone>`, including generated dials. A new name adds; `idle` appends tracks/timelines to the composed idle, preserving its metadata and every existing character track, deform and physics constraint. Its duration must exactly equal the composed idle (`SCENE_DURATION_AGREES`); no retiming. An imported animation name cannot be replaced (`SCENE_ANIMATION_NAME_FREE`). Absent declaration preserves legacy bytes and output paths (issue #1346) |
7813
7817
  | `order` | the draw order, back to front: a character id (its slots not named elsewhere, in its own order) or one `<id>:<slot>`. Every slot of every character is drawn exactly once. Interleaving is written by naming slots: `["a", "b:arm_l", "b"]` draws `b`'s left arm between `a` and the rest of `b` |
@@ -8056,7 +8060,8 @@ What is composed:
8056
8060
  image, provenance, note, bone, slot, size, `sha256` of the PNG's bytes as compose read them — issue #1183, additive —
8057
8061
  and `judged_by: "nothing"`), `plates` when `scene.plates` is declared (each named plate's declaration, bone, slot, size, `sha256` and `judged_by: "nothing"`; the `[compose]` header line also names them in declaration order as `<N> named plate(s): <name>, ...`, and prints `no plate` only when neither `plate` nor `plates[]` is present), per character
8058
8062
  its build, offset, `scale` (only when it is not 1), `rig_size`, `rig_scale`, placed bounds (the union of its part
8059
- boxes, canvas px), shift and what it moved (`shifted`: the first-level bones, the
8063
+ boxes, canvas px), `canvas_clip: true` and `clipped_bounds` for opted-in characters,
8064
+ shift and what it moved (`shifted`: the first-level bones, the
8060
8065
  regions on `root`, the count of weights bound to `root`), its counts and `accepted`
8061
8066
  (the failing bars of its own check that an accept list took, only when there are any), and the
8062
8067
  order —
@@ -8079,22 +8084,50 @@ character's input arrives isolated); a composed `parts.json`, so the bars that
8079
8084
  read See-through tags are measured per character by its own `build`, not over the
8080
8085
  scene; a rig `build` did not write.
8081
8086
 
8087
+ #### Canvas framing for intentional overflow (issue #1491)
8088
+
8089
+ `bounds` is the full placed part-box union. `clipped_bounds` is its intersection
8090
+ with the canvas. Both are `[x0, y0, x1, y1]` in canvas pixels, y down, with
8091
+ exclusive right and bottom edges. The `[compose]` character line appends the
8092
+ clipped box for each opted-in character. These boxes record static placement.
8093
+ The rig-c gate, composed rig and packed atlas retain the full art, geometry and
8094
+ motion so offstage parts can enter the canvas during playback.
8095
+
8096
+ When any character opts in, compose gives check renders the authored stage as
8097
+ their viewport. Explicit diagnostic viewports take precedence. The retained
8098
+ `check/idle_frames/` and `check/contact.png` use check's existing preview size
8099
+ cap and sampling rate. `check/idle_frames/frames.json` records the stage in
8100
+ `viewport` and identifies the pin in `pinned.by` as `--viewport`. Extremes use
8101
+ their existing explicit diagnostic grid over the same stage box.
8102
+ The stage rectangle is `[-width/2, 0, width, height]` in rig-c world coordinates,
8103
+ y up. To verify native canvas pixels, render the packed build with the stage
8104
+ rectangle as `--viewport` and the larger canvas dimension as `--max`.
8105
+
8106
+ ```sh
8107
+ rigc render --candidate <compose-out>/check/build --animation idle \
8108
+ --viewport <stage-x>,0,<canvas-width>,<canvas-height> \
8109
+ --max <larger-canvas-dimension> --out <render-out>
8110
+ ```
8111
+
8112
+ The consumer's player must pin its viewport to the authored stage and clip the
8113
+ whole scene to that rectangle throughout playback. This includes the plates and
8114
+ every character in the declared draw order.
8082
8115
 
8083
8116
  #### Compose input record (issue #1348)
8084
8117
 
8085
8118
  A fully green compose writes `compose-run.json` at the `--out` root, beside
8086
8119
  `scene.json`, with spec `rig-compose-run/1`. It removes a previous record before
8087
8120
  the stage begins, including before stage option validation; a refused input,
8088
- rig-c gate, check or accepted failing character leaves no record. The existing
8089
- rig, scene report and check keep their bytes and paths. Core's nested
8090
- `check/build/run.json` retains its own clocks; it is a different record.
8121
+ rig-c gate, check or accepted failing character leaves no record. Scenes without
8122
+ canvas clipping retain the existing rig, scene report and check bytes and paths.
8123
+ Core's separate `check/build/run.json` retains its own clocks.
8091
8124
 
8092
8125
  The fixed top-level key order is `spec`, `scene`, `characters`, `plate`, `plates`:
8093
8126
 
8094
8127
  | entry | exact binding |
8095
8128
  | --- | --- |
8096
8129
  | `scene` | `{path, sha256}`: `path` as supplied to compose and SHA-256 of the raw scene JSON bytes parsed, including whitespace |
8097
- | `characters` | sorted by `id` in code-unit order; each `{id, build, files}`, with `build` as declared in the scene, and `files` sorted by build-relative `path`; each file is `{path, sha256}` |
8130
+ | `characters` | sorted by `id` in code-unit order. Each row has `id`, `build`, `files`, then `placement` only for `canvas_clip: true`. `build` is as declared and `files` contains `{path, sha256}` entries sorted by build-relative `path`. `placement` holds `{canvas_clip: true, bounds, clipped_bounds}` from the scene report |
8098
8131
  | `plate` | legacy plate `{path, sha256}`, with its image path as declared relative to the scene file, or `null` when absent |
8099
8132
  | `plates` | every named plate `{name, path, sha256}`, sorted by `name` in code-unit order; image paths as declared relative to the scene file; `[]` when absent |
8100
8133
 
package/docs/STABILITY.md CHANGED
@@ -1187,7 +1187,8 @@ execution in historical evidence is inferred from a current export.
1187
1187
  | named scene plates | `compose` | issue #1345 adds optional `plates[]`: required `name`, `image`, `provenance`, `at: [x, y]`; optional `note`, `editor_receipts`, `opaque_backdrop`. `at` is two finite integers for the image top-left in canvas pixels, y down from the top-left origin; negatives/outside allowed, no scale, native image size including oversize. Each bone/slot/attachment uses its declared name, bone under root at `(0,0)`; attachment centre is `stage.x + at[0] + width/2`, `cropToSpineY(at[1] + height/2, canvas.height)`. Each layer's token is required exactly once in draw order, with duplicate/missing/unknown/collision refusals. Names cannot collide with root, legacy plate, shared idle, character ids or prefixed bones/slots/animations; a plate name already refused by `SCENE_PLATE_NAME_FREE` or `SCENE_PLATE_NAME_UNIQUE` does not also draw a cascaded `SCENE_ORDER_COMPLETE` (issue #1350). Only that layer's explicit `opaque_backdrop: true` exempts it from compose alpha checks; an opaque declared backdrop must additionally meet width >= canvas.width AND height >= canvas.height (the rig stage), matching core 3.8.0 A19 size inference; otherwise SCENE_PLATE_BACKDROP_SIZE refuses before emission (placement coverage of the stage is the scene author's, not checked by the tool). Transparent layers have no size floor. rigc A19 remains enabled. Named images use `scene-plate.<index>.png` (atlas region `scene-plate.<index>`, by declaration index) with collision checks. The `[compose]` header line names composed `plates[]` in declaration order (`<N> named plate(s): <name>, ...`) when `plates[]` is non-empty and prints `no plate` only when neither `plate` nor `plates[]` is present (issue #1350). The additive report `plates` array records declaration, native size and PNG hash; absent declaration retains legacy output bytes and fixed first-plate behavior. |
1188
1188
  | scene named animations | `compose` | issue #1346 adds optional `scene.animations`, a name-to-rigc-MotionAnimation map resolved against final scene bones/groups/easings. New names add clips at their own declared durations; `idle` appends timelines while retaining existing character tracks, deforms, metadata and physics. Idle duration mismatch is `SCENE_DURATION_AGREES`, without retiming; imported non-idle names cannot be replaced. Core owns missing fields, unknown bones/references, duplicate property tracks and bad times. Unknown prefixed bones also name the character ID. Generated names `<id>:yaw_dial`, `<id>:pitch_dial`, and `<id>:<turn.body.slider>` (default `<id>:body_yaw_dial`) are stable; renaming them requires a major version. A dial exists only when generated by its character. Rotation keys use that slider's declared `[from, max]` bounds; out-of-range values are `SCENE_DIAL_KEY_RANGE`, unreadable bounds `SCENE_DIAL_RANGE_DECLARED`, never guessed. Slider-input keys require explicit numeric values; derive inputs are refused as `SCENE_DIAL_KEY_DECLARED`, including derive alongside a raw value. Bounds apply to the matching scalar or paired translate/scale/shear input channel; inherited group names are refused with `CE_COMPILE_ANIMATION_GROUP_UNKNOWN`. Each declared clip's gated posed endpoints at 0 and duration must agree before emission (`SCENE_ANIMATION_LOOP_CLOSES`), with physics simulation left out only for observation. Absent declaration retains stable output bytes at the same paths. Core `check/build/run.json` records fresh `started_at` and `finished_at` clocks; comparisons report these raw differences separately and require all other receipt fields and output bytes to match. |
1189
1189
  | scene loop refusal detail | `compose` | Issue #1358 enriches `SCENE_ANIMATION_LOOP_CLOSES` with the first differing bone or slot, channel, start/end values and numeric tolerance 0 (exact equality). The existing exact JSON endpoint comparison is unchanged: bones, slots, draw order, drawn geometry, clipping polygons and clipped geometry remain covered. Selection follows that family order, then producer row and field order; geometry-only differences name the slot and geometry channel. Physics is still excluded only from observation. The refusal code, acceptance, emitted rig/motion and built scene bytes are unchanged. |
1190
- | `compose-run.json` | `compose` | spec `rig-compose-run/1` (issue #1348), separate from `rig-run/1`; a stable contract as of 2.44.0. Written at the `--out` root only after the gate and check are green and no accepted failing character remains, so an `--accept` preview writes none. Fixed keys in order: `spec`, `scene` (`path`, `sha256`), `characters` (each `id`, `build`, `files`, each file `path`, `sha256`), `plate` (`path`, `sha256`, or null), `plates` (each `name`, `path`, `sha256`). Scene and plate paths are the supplied and declared paths; character file paths are build-relative. Characters sort by `id`, files by `path`, named plates by `name`, in code-unit order. Each character's files are exactly `check/check.json`, `parts.json`, `rig/rig.json`, `rig/motion.json` and each distinct image the default skin names under `rig/images/`, including a generator's depth image. Every `sha256` is of the raw file bytes compose consumed before the gate. There are no clocks, directory extras, requirements or CLI-option inventory, so identical inputs at identical supplied paths give identical record bytes. Compose owns the name: a file of that name at the `--out` root is deleted at the start of every compose, before stage validation, so a refused rerun leaves none. Only this file is added; legacy outputs retain stable bytes, with the existing nested Core receipt clock comparison described above. |
1190
+ | scene canvas framing | `compose` | Issue #1491 adds optional `characters[].canvas_clip` to `spine-parts-scene/1`. Literal `true` requires finite placed bounds, overflow past a canvas edge and an intersection with positive width and height. The respective refusals are `SCENE_CHARACTER_CLIP_BOUNDS`, `SCENE_CHARACTER_CLIP_UNUSED` and `SCENE_CHARACTER_CLIP_EMPTY`. Other explicit values are `SCENE_FIELD_TYPE`. Omitting the key retains the exact containment rule, output bytes and console text. The opted-in character row in `scene.json` adds `canvas_clip: true` and `clipped_bounds` after the original `bounds`. Both boxes are canvas pixels, y down, with exclusive right and bottom edges. The console appends the clipped box only for those rows. The rig-c gate and packed build retain the full art and geometry. For a scene with any opt-in, compose check renders use the stage viewport unless the render specifies its own. Preview size caps and sampling stay in effect. Native-size renders and consumer playback use the authored stage rectangle as described in [Canvas framing for intentional overflow](AUTHORING.md#canvas-framing-for-intentional-overflow-issue-1491). |
1191
+ | `compose-run.json` | `compose` | spec `rig-compose-run/1` (issue #1348), separate from `rig-run/1`; a stable contract as of 2.44.0. Written at the `--out` root only after the gate and check are green and no accepted failing character remains, so an `--accept` preview writes none. Fixed keys in order: `spec`, `scene` (`path`, `sha256`), `characters` (each `id`, `build`, `files`, each file `path`, `sha256`, then optional `placement`), `plate` (`path`, `sha256`, or null), `plates` (each `name`, `path`, `sha256`). Scene and plate paths are the supplied and declared paths; character file paths are build-relative. Characters sort by `id`, files by `path`, named plates by `name`, in code-unit order. Each character's files are exactly `check/check.json`, `parts.json`, `rig/rig.json`, `rig/motion.json` and each distinct image the default skin names under `rig/images/`, including a generator's depth image. Every `sha256` is of the raw file bytes compose consumed before the gate. Only a character with `canvas_clip: true` has `placement`, with `canvas_clip: true`, `bounds` and `clipped_bounds` in that order from the scene report. There are no clocks, directory extras, requirements or CLI-option inventory, so identical inputs at identical supplied paths give identical record bytes. Compose owns the name: a file of that name at the `--out` root is deleted at the start of every compose, before stage validation, so a refused rerun leaves none. For scenes without opt-in, legacy outputs retain stable bytes, with the existing nested Core receipt clock comparison described above. |
1191
1192
  | the scene report | `compose` | spec `spine-parts-scene-report/1`; the plate block carries `sha256` of the plate PNG's bytes after `size` (issue #1183, additive under *What "stable" means here*: a new report key in a minor version, so the spec stays `/1`); `pack_mode` records `page_size` only when `--page-size <px>` is given (issue #1352, additive; without `--page-size`, rigc's default 2048 px page and padding 2 on each side bound any plate or region side to at most 2044 px before `CE_ATLAS_REGION_EXCEEDS_PAGE`) |
1192
1193
  | `idle.png`, `idle-indexed.png`, `idle.gif` | `loop`, `build --loop` | APNG and GIF encodings of the rendered idle |
1193
1194
  | `run.json` | `rig`, `assemble` | spec `rig-run/1` (issue #1165, additive): `spec`, `package` (`name`, `version`), `command` (`"rig"` or `"assemble"`), `started_at` and `finished_at` (UTC ISO-8601 millisecond timestamps ending in `Z`, read in the CLI layer), `config` (`path` relative to `--out`, `sha256` of the config file on disk), `inputs` on `assemble` (issue #1316, additive: one `{role, path, sha256}` entry for each of `--source`, `--full` and `--head` that was given, in that order, with `path` relative to the run's cwd and `sha256` of the file or of the directory's `layers.json`), and `outputs` (`path` relative to `--out`, `sha256` of each written output file on disk, sorted by `path` in code-unit order and excluding `run.json` itself); written only after the command's gate is green |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rig-parts",
3
- "version": "2.53.0",
3
+ "version": "2.54.0",
4
4
  "description": "AI-authored 2D character parts from one anime painting and its See-through layer decomposition: measured parts, weighted-mesh rig specs, verified through rig-c before anything is written. A CLI for agents that cannot see the image.",
5
5
  "type": "module",
6
6
  "exports": {
package/src/check.ts CHANGED
@@ -726,7 +726,7 @@ export function readCheckInputs(rigDir: string, partsHome?: string, sourcePath?:
726
726
  object: partsPath,
727
727
  detail: `no such file; ${PARTS_HOME_SENTENCE} (the seam check composites the parts parts.json lists)${hint}`,
728
728
  });
729
- } else noParts = `no parts.json: ${partsPath} does not exist and no --parts was named, so there are no parts to composite and no See-through tags to choose regions by`;
729
+ } else noParts = 'no parts.json: parts.json does not exist and no --parts was named, so there are no parts to composite and no See-through tags to choose regions by';
730
730
  }
731
731
  else {
732
732
  try {
@@ -826,7 +826,7 @@ export function readCheckInputs(rigDir: string, partsHome?: string, sourcePath?:
826
826
  const anims = motion.animations;
827
827
  const idle = isRecord(anims) ? anims.idle : undefined;
828
828
  if (idle === undefined) {
829
- noIdle = `no idle: ${motionPath} field "animations" holds ${isRecord(anims) ? `[${Object.keys(anims).join(', ')}]` : JSON.stringify(anims) ?? 'nothing'} and no "idle", so there is no loop to close and no idle frame to read`;
829
+ noIdle = `no idle: motion.json field "animations" holds ${isRecord(anims) ? `[${Object.keys(anims).join(', ')}]` : JSON.stringify(anims) ?? 'nothing'} and no "idle", so there is no loop to close and no idle frame to read`;
830
830
  } else if (!isRecord(idle)) {
831
831
  problems.push({ code: 'CHECK_IDLE_PRESENT', object: `${motionPath} animation "idle"`, detail: `is ${JSON.stringify(idle)}; an animation object is required — the loop is measured on it` });
832
832
  } else if (!(typeof idle.duration === 'number' && idle.duration > 0)) {
@@ -7228,7 +7228,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
7228
7228
  const geometry = readGeometry(geometryPath, idle.written);
7229
7229
  idleGeometry = geometry;
7230
7230
  const beforeStretch = problems.length;
7231
- stretch = stretchLine(geometry, geometryPath, problems, { ...inp, config }, checkSlotParts(inp.rig, inp.parts?.parts.map(p => p.name) ?? [], inp.parts?.alternates?.map(set => set.name) ?? []), readingSkip('TEXTURE_STRETCH'));
7231
+ stretch = stretchLine(geometry, GEOMETRY_FILE, problems, { ...inp, config }, checkSlotParts(inp.rig, inp.parts?.parts.map(p => p.name) ?? [], inp.parts?.alternates?.map(set => set.name) ?? []), readingSkip('TEXTURE_STRETCH'));
7232
7232
  stretchFailedWithoutReading = stretch.status === 'SKIP' && problems.length > beforeStretch;
7233
7233
  if (full !== null) still = stillLine(full, idle, geometry, geometryPath, problems, notPlanted, readingSkip('STILL_REGIONS_DARK'));
7234
7234
  }
@@ -7458,7 +7458,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
7458
7458
  const rows: ClothRow[] = [];
7459
7459
  let unread: string | undefined;
7460
7460
  for (const c of clothChains(inp.rig, stripped.physics)) {
7461
- const track = boneTrackOf(idleGeometry, geometryPath, idle, c.tip);
7461
+ const track = boneTrackOf(idleGeometry, idleGeometry === null ? GEOMETRY_FILE : geometryPath, idle, c.tip);
7462
7462
  if (typeof track === 'string') {
7463
7463
  unread = track;
7464
7464
  break;
@@ -9300,7 +9300,7 @@ export function stillLine(inp: FullInputs, idle: FrameSet, geo: IdleGeometry | n
9300
9300
  const { all: allFeet, held: feet, declared } = plantedFeet(inp.parts, notPlanted);
9301
9301
  const eligible = face.length > 0 || feet.length > 0;
9302
9302
  if (face.length === 0 && allFeet.length === 0) return skipped(`no part comes from a See-through ${tagWords([...FACE_TAGS, ...FEET_TAGS])} layer, so there is no still region to read`, 'no-eligible-region');
9303
- if (geo === null) return skipped(`${geometryPath} does not exist; \`rigc render --geometry\` (rig-c ${RIGC_GEOMETRY_VERSION} or later) writes it, and the still regions are read off it`, eligible ? 'no-reading' : 'no-eligible-region');
9303
+ if (geo === null) return skipped(`${GEOMETRY_FILE} does not exist; \`rigc render --geometry\` (rig-c ${RIGC_GEOMETRY_VERSION} or later) writes it, and the still regions are read off it`, eligible ? 'no-reading' : 'no-eligible-region');
9304
9304
  const H = inp.parts.rig_size[1];
9305
9305
  const W = inp.parts.rig_size[0];
9306
9306
  const poses = attachmentPoses(geometryPath, idle.written);
package/src/runstamp.ts CHANGED
@@ -33,11 +33,20 @@ export interface RunStampFileEntry {
33
33
  sha256: string;
34
34
  }
35
35
 
36
- /** Compose's consumed inputs, captured before its gate; no clock or output inventory. */
36
+ /** Compose's consumed inputs and opted-in placement, captured before its gate. */
37
37
  export interface ComposeRun {
38
38
  spec: typeof COMPOSE_RUN_SPEC;
39
39
  scene: RunStampFileEntry;
40
- characters: Array<{ id: string; build: string; files: RunStampFileEntry[] }>;
40
+ characters: Array<{
41
+ id: string;
42
+ build: string;
43
+ files: RunStampFileEntry[];
44
+ placement?: {
45
+ canvas_clip: true;
46
+ bounds: [number, number, number, number];
47
+ clipped_bounds: [number, number, number, number];
48
+ };
49
+ }>;
41
50
  plate: RunStampFileEntry | null;
42
51
  plates: Array<{ name: string; path: string; sha256: string }>;
43
52
  }
package/src/scene.ts CHANGED
@@ -164,6 +164,8 @@ export interface SceneCharacter {
164
164
  offset: [number, number];
165
165
  /** {@link SceneCharacter.scale}: the character's size on the canvas, 1 (as built) when the file leaves it out (issue #197). */
166
166
  scale: number;
167
+ /** Allow placed part bounds to cross the canvas edge (issue #1491). */
168
+ canvas_clip?: true;
167
169
  /** The bars this character's own check may have failed and still be taken (issue #203), as the file lists them; empty when it lists none. */
168
170
  accept: string[];
169
171
  }
@@ -364,7 +366,7 @@ export function loadScene(path: string): SceneFile {
364
366
  fail('SCENE_FIELD_TYPE', where, `is ${show(c)}; {"id", "build", "offset"} is required`);
365
367
  return;
366
368
  }
367
- known(c, where, ['id', 'build', 'offset', 'scale', 'accept']);
369
+ known(c, where, ['id', 'build', 'offset', 'scale', 'accept', 'canvas_clip']);
368
370
  let ok = true;
369
371
  for (const k of ['id', 'build', 'offset']) {
370
372
  if (!(k in c)) {
@@ -402,6 +404,10 @@ export function loadScene(path: string): SceneFile {
402
404
  fail('SCENE_FIELD_TYPE', `${where}.scale`, `is ${show(sc)}; a positive finite number is required — the character's size on the canvas about its stage's top-left corner, 1 drawing it as built (the default when the key is absent)`);
403
405
  ok = false;
404
406
  }
407
+ if ('canvas_clip' in c && c.canvas_clip !== true) {
408
+ fail('SCENE_FIELD_TYPE', `${where}.canvas_clip`, `is ${show(c.canvas_clip)}; literal true is required when the key is present — omit it to require containment on the canvas`);
409
+ ok = false;
410
+ }
405
411
  const acc = c.accept;
406
412
  if ('accept' in c) {
407
413
  if (!(Array.isArray(acc) && acc.every((v) => typeof v === 'string'))) {
@@ -413,7 +419,15 @@ export function loadScene(path: string): SceneFile {
413
419
  if (named.length > 0) ok = false;
414
420
  }
415
421
  }
416
- if (ok) characters.push({ id: id as string, build: c.build as string, buildDir: resolve(base, c.build as string), offset: [(off as number[])[0], (off as number[])[1]], scale: 'scale' in c ? (sc as number) : 1, accept: 'accept' in c ? [...(acc as string[])] : [] });
422
+ if (ok) characters.push({
423
+ id: id as string,
424
+ build: c.build as string,
425
+ buildDir: resolve(base, c.build as string),
426
+ offset: [(off as number[])[0], (off as number[])[1]],
427
+ scale: 'scale' in c ? (sc as number) : 1,
428
+ accept: 'accept' in c ? [...(acc as string[])] : [],
429
+ ...(c.canvas_clip === true ? { canvas_clip: true } : {}),
430
+ });
417
431
  });
418
432
  }
419
433
 
@@ -1063,6 +1077,9 @@ export interface SceneCharacterReport {
1063
1077
  rig_scale: number;
1064
1078
  /** The union of the character's part boxes, placed: canvas px, [x0, y0, x1, y1], x1 and y1 exclusive. */
1065
1079
  bounds: [number, number, number, number];
1080
+ canvas_clip?: true;
1081
+ /** Intersection of the placed bounds and the canvas, in the same coordinates as bounds. */
1082
+ clipped_bounds?: [number, number, number, number];
1066
1083
  /** {@link rootShift}: what was added to the x and y of everything the character places in root's frame (after its scale), in Spine units (canvas px, y up). */
1067
1084
  shift: [number, number];
1068
1085
  /** What the shift was added to: the first-level bones, the slots on `root` whose regions moved, and the count of mesh weights bound to `root`. */
@@ -1194,11 +1211,31 @@ export function composeScene(
1194
1211
  const [x0, y0, x1, y1] = b.artBox;
1195
1212
  const s = c.scale;
1196
1213
  const bounds: [number, number, number, number] = [scaledBy(x0, s) + c.offset[0], scaledBy(y0, s) + c.offset[1], scaledBy(x1, s) + c.offset[0], scaledBy(y1, s) + c.offset[1]];
1197
- if (bounds[0] < 0 || bounds[1] < 0 || bounds[2] > canvas.width || bounds[3] > canvas.height) {
1214
+ const overflow = bounds[0] < 0 || bounds[1] < 0 || bounds[2] > canvas.width || bounds[3] > canvas.height;
1215
+ const where = `scene.characters[${i}] "${c.id}"`;
1216
+ const placement = `its parts' boxes (rig px [${x0}, ${y0}, ${x1}, ${y1}]) at offset [${c.offset.join(', ')}]${s === 1 ? '' : ` and scale ${s}`} cover canvas px [${bounds.join(', ')}]`;
1217
+ let clippedBounds: SceneCharacterReport['clipped_bounds'];
1218
+ if (c.canvas_clip === true) {
1219
+ if (!bounds.every(Number.isFinite)) {
1220
+ fail('SCENE_CHARACTER_CLIP_BOUNDS', where, `${placement}; canvas_clip requires four finite bounds`);
1221
+ } else if (!overflow) {
1222
+ fail('SCENE_CHARACTER_CLIP_UNUSED', where, `${placement}, entirely within the ${canvas.width}x${canvas.height} canvas; canvas_clip requires overflow past at least one edge`);
1223
+ } else {
1224
+ const left = Math.max(0, bounds[0]);
1225
+ const top = Math.max(0, bounds[1]);
1226
+ const right = Math.min(canvas.width, bounds[2]);
1227
+ const bottom = Math.min(canvas.height, bounds[3]);
1228
+ if (left >= right || top >= bottom) {
1229
+ fail('SCENE_CHARACTER_CLIP_EMPTY', where, `${placement}; canvas_clip requires positive intersection width and height on the ${canvas.width}x${canvas.height} canvas`);
1230
+ } else {
1231
+ clippedBounds = [left, top, right, bottom];
1232
+ }
1233
+ }
1234
+ } else if (overflow) {
1198
1235
  fail(
1199
1236
  'SCENE_CHARACTER_INSIDE_CANVAS',
1200
- `scene.characters[${i}] "${c.id}"`,
1201
- `its parts' boxes (rig px [${x0}, ${y0}, ${x1}, ${y1}]) at offset [${c.offset.join(', ')}]${s === 1 ? '' : ` and scale ${s}`} cover canvas px [${bounds.join(', ')}], which leaves the ${canvas.width}x${canvas.height} canvas; 0 <= x0, 0 <= y0, x1 <= ${canvas.width} and y1 <= ${canvas.height} are required`,
1237
+ where,
1238
+ `${placement}, which leaves the ${canvas.width}x${canvas.height} canvas; 0 <= x0, 0 <= y0, x1 <= ${canvas.width} and y1 <= ${canvas.height} are required`,
1202
1239
  );
1203
1240
  }
1204
1241
  problems.push(...scaleProblems(c, b));
@@ -1211,6 +1248,7 @@ export function composeScene(
1211
1248
  rig_size: [...b.rigSize],
1212
1249
  rig_scale: b.rigScale,
1213
1250
  bounds,
1251
+ ...(clippedBounds === undefined ? {} : { canvas_clip: true, clipped_bounds: clippedBounds }),
1214
1252
  shift,
1215
1253
  shifted: {
1216
1254
  bones: b.rig.bones.filter((x) => x.parent === ROOT_BONE).map((x) => prefixed(c.id, x.name)),
@@ -1838,7 +1876,12 @@ export function composeFromFiles(scenePath: string, requirementsPath?: string, m
1838
1876
  const runRecord: ComposeRun = {
1839
1877
  spec: COMPOSE_RUN_SPEC,
1840
1878
  scene: { path: scenePath, sha256: scene.sha256 },
1841
- characters: scene.characters.map(c => ({ id: c.id, build: c.build, files: builds.find(b => b?.id === c.id)!.files }))
1879
+ characters: composed.report.characters.map(c => ({
1880
+ id: c.id,
1881
+ build: c.build,
1882
+ files: builds.find(b => b?.id === c.id)!.files,
1883
+ ...(c.clipped_bounds === undefined ? {} : { placement: { canvas_clip: true as const, bounds: c.bounds, clipped_bounds: c.clipped_bounds } }),
1884
+ }))
1842
1885
  .sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0),
1843
1886
  plate: scene.plate === null || plate === null ? null : { path: scene.plate.image, sha256: createHash('sha256').update(plate.bytes).digest('hex') },
1844
1887
  plates: (scene.plates ?? []).map((p, i) => ({ name: p.name, path: p.image, sha256: createHash('sha256').update(plateLayers[i]!.bytes).digest('hex') }))
@@ -1920,7 +1963,8 @@ export function composeStage(input: ComposeInput, run: ComposeRunners, log: Log)
1920
1963
  : ', no plate';
1921
1964
  say(`${r.characters.length} character(s) on a ${r.canvas.width}x${r.canvas.height} canvas, rig "${r.rig_name}"${plateClause}`);
1922
1965
  for (const c of r.characters) {
1923
- say(` ${c.id}: ${c.build} at offset [${c.offset.join(', ')}], scale ${c.scale ?? 1}, bounds [${c.bounds.join(', ')}], shift [${c.shift.join(', ')}] on ${c.shifted.bones.length} first-level bone(s), ${c.shifted.root_regions.length} region(s) on root and ${c.shifted.root_weights} weight(s) bound to root; ${c.bones} bone(s), ${c.slots} slot(s), ${c.tracks} track(s), ${c.constraints} constraint(s), rig_scale ${c.rig_scale}, idle ${c.idle_duration} s${c.accepted === undefined ? '' : `; its own check FAILED ${c.accepted.join(', ')}, accepted — the scene is for looking, not shipping`}`);
1966
+ const clipped = c.clipped_bounds === undefined ? '' : `; clipped bounds [${c.clipped_bounds.join(', ')}]`;
1967
+ say(` ${c.id}: ${c.build} at offset [${c.offset.join(', ')}], scale ${c.scale ?? 1}, bounds [${c.bounds.join(', ')}], shift [${c.shift.join(', ')}] on ${c.shifted.bones.length} first-level bone(s), ${c.shifted.root_regions.length} region(s) on root and ${c.shifted.root_weights} weight(s) bound to root; ${c.bones} bone(s), ${c.slots} slot(s), ${c.tracks} track(s), ${c.constraints} constraint(s), rig_scale ${c.rig_scale}, idle ${c.idle_duration} s${c.accepted === undefined ? '' : `; its own check FAILED ${c.accepted.join(', ')}, accepted — the scene is for looking, not shipping`}${clipped}`);
1924
1968
  }
1925
1969
  say(` order (declared, judged by nothing): ${r.order.declared.join(', ')} -> ${r.order.slots.length} slot(s), back to front`);
1926
1970
  const texts: Array<[string, string]> = [
@@ -1960,9 +2004,17 @@ export function composeStage(input: ComposeInput, run: ComposeRunners, log: Log)
1960
2004
  for (const [file, text] of texts) writeFileSync(join(rigDir, file), text);
1961
2005
  writeFileSync(join(input.out, SCENE_REPORT_FILE), rigJsonText(r));
1962
2006
  say(`wrote ${join(rigDir, 'rig.json')}, motion.json and ${composed.images.length} image(s) under ${join(rigDir, 'images')}, and ${join(input.out, SCENE_REPORT_FILE)}`);
2007
+ let checkRigc = run.check;
2008
+ if (r.characters.some(c => c.canvas_clip === true)) {
2009
+ const stage = composed.rig.skeleton;
2010
+ const viewport = [stage.x, stage.y, stage.width, stage.height].join(',');
2011
+ checkRigc = args => run.check(args[0] === 'render' && !args.includes('--viewport') && !args.includes('--viewport-from')
2012
+ ? [...args, '--viewport', viewport]
2013
+ : args);
2014
+ }
1963
2015
  let report: CheckReport;
1964
2016
  try {
1965
- report = checkStage({ rig: rigDir, out: join(input.out, 'check'), pageEdges: mode.pageEdges, packShape: mode.packShape, ...(pageSize === undefined ? {} : { pageSize }), ...(input.requirements === undefined ? {} : { requirements: input.requirements }) }, run.check, run.checkBin, prefix('check'));
2017
+ report = checkStage({ rig: rigDir, out: join(input.out, 'check'), pageEdges: mode.pageEdges, packShape: mode.packShape, ...(pageSize === undefined ? {} : { pageSize }), ...(input.requirements === undefined ? {} : { requirements: input.requirements }) }, checkRigc, run.checkBin, prefix('check'));
1966
2018
  } catch (err) {
1967
2019
  return refused('check', err, composed);
1968
2020
  }