@rig-c/parts 2.42.0 → 2.43.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
@@ -6235,7 +6235,7 @@ outside the consumed inputs pending [#1177](https://github.com/rig-c/parts/issue
6235
6235
  | <a id="CHECK_SETUP_PAINTING_MEASURED"></a>`CHECK_SETUP_PAINTING_MEASURED` | missing native setup/ownership or unsupported clipping | supply observable textured setup geometry; an unavailable instrument never passes |
6236
6236
  | <a id="CHECK_BOUNDARY_COLOUR_STEP"></a>`CHECK_BOUNDARY_COLOUR_STEP` | the requirements file declares `boundary_colour.max_step_excess` and a part boundary's colour step in the rig's render exceeds the same boundary's step in the rig's own pieces by more than it; the part pair, the frame (`setup` or `idle frame <n> (t <s> s)`), the stage pixel, the excess, the declared allowance and both steps are quoted. Unlike [`CHECK_SETUP_MATCHES_PAINTING`](#CHECK_SETUP_MATCHES_PAINTING), which compares the painting per declared region at the setup pose, this compares against the rig's own flat pieces (`parts.json` placement at setup, each piece's rest colour through its art UVs on every idle frame), so a part drawn over its neighbour's line art is not a failure | the pair's rig image or mesh: `rig/images/<part>.png` (a texture stretched into its padded UVs, or a notch cut out of it), or that part's mesh in `config.json` `meshes` when the mesh cuts a corner off the art; see [Boundary colour step](#boundary-colour-step-issue-942) |
6237
6237
  | <a id="CHECK_BOUNDARY_COLOUR_UNMEASURED"></a>`CHECK_BOUNDARY_COLOUR_UNMEASURED` | `boundary_colour` is declared and the step cannot be taken: no `parts.json`, no `idle`, or a default-skin region or mesh image without a sequence, with a parts record, whose rig image is not its parts PNG with one even pad on every side (refused before anything is built); otherwise a drawn slot has no `parts.json` piece, is clipped, or its rig image is not its parts PNG with one even pad on every side (the slot and frame are named). Never a pass | make every drawn slot a `parts.json` piece, or drop `boundary_colour` from the requirements file (the bar then reports SKIP) |
6238
- | <a id="CHECK_BEHIND_PART_SEAMS"></a>`CHECK_BEHIND_PART_SEAMS` | `behind_seams` is declared and a selected pair exceeds its allowance in the independent motion-opened or standing reading at setup or on an idle frame; the pair, behind slots, reading, frame, counted seam cells and allowance are named | repair the declared seam or author its per-pair allowance; no WARN mode or rest-visible mask; see [Behind-part seams](#behind-part-seams-issue-1314) |
6238
+ | <a id="CHECK_BEHIND_PART_SEAMS"></a>`CHECK_BEHIND_PART_SEAMS` | `behind_seams` is declared and a selected pair exceeds its allowance in the independent motion-opened or standing reading at setup, on an idle frame or at an opted-in named turn pose; the pair, behind slots, reading, frame, counted seam cells and allowance are named | repair the declared seam or author its per-pair allowance; no WARN mode or rest-visible mask; see [Behind-part seams](#behind-part-seams-issue-1314) |
6239
6239
  | <a id="CHECK_BEHIND_PART_SEAMS_UNMEASURED"></a>`CHECK_BEHIND_PART_SEAMS_UNMEASURED` | a pair with an authored effective threshold cannot read a mandatory population: selected pair, eligible behind slots, idle, readable setup, motion support, boundary population, or verified render/grid/material evidence; mandatory unread evidence makes the combined line FAIL. A missing threshold alone is a nonrequired SKIP and HOLE without this refusal code | supply the named measurement evidence; an invalid selected-pair override also refuses by name, and existing renderer or sidecar refusals remain refusals |
6240
6240
  | <a id="SETUP_PAINTING_REQUIRED_LIMIT"></a>`SETUP_PAINTING_REQUIRED_LIMIT` | `setup_painting.required` is `true` and a limit the check needs is absent: `rgb_tolerance`, `regions`, or a region's `max_pixels` (the object names the region). Refused when the requirements file is read, before anything is built (issue #943) | author the named limit; none is derived from the art. Without `required` the same region reports SKIP |
6241
6241
  | <a id="CHECK_SOURCE_GRID"></a>`CHECK_SOURCE_GRID` | the setup-pose still and its black-tinted twin (the coverage `SETUP_POSE_VS_SOURCE` reads) did not come back on one grid over one opaque background | a rigc problem; report it |
@@ -6289,7 +6289,7 @@ outside the consumed inputs pending [#1177](https://github.com/rig-c/parts/issue
6289
6289
  | <a id="BUILD_REQUIREMENTS_CONFLICT"></a>`BUILD_REQUIREMENTS_CONFLICT` | `build --requirements <file>` names a file with other bytes than the one `config.requirements` declares (issue #556): the detail names both, each resolved (the flag against the working directory, the declaration against the config's) with its sha256 — or `no such file`. Refused before assemble writes anything. The same file by both, or a copy of its bytes, is not refused: the declaration is read and recorded | drop the flag to build from the config's file, or point `config.requirements` at the flag's |
6290
6290
  | <a id="BUILD_STAGE_REQUEST"></a>`BUILD_STAGE_REQUEST` | an internal build worker was given a missing or malformed request, an unknown stage, or incomplete runner, input, output or scratch paths; the worker refuses before running a stage. This is the internal process protocol, not a public command or option | invoke `rig-parts build` with its documented flags; if that command produces this refusal, report the named request defect rather than constructing or modifying a worker request |
6291
6291
  | <a id="REQUIREMENTS_FILE"></a>`REQUIREMENTS_FILE` | `--requirements` names no file, or one that does not parse as a JSON object. Refused before anything is built (by `build`, before assemble) | the path of a `spine-parts-requirements/1` file |
6292
- | <a id="REQUIREMENTS_FIELD"></a>`REQUIREMENTS_FIELD` | a field of the file is missing, of the wrong type, or not one the format reads: `spec`, `fps` (a positive number when supplied, required only when a declared measurement reads the file's sampling rate, with no default), `requirements`, each requirement's `name` (letters, digits, underscores; once each), `kind`, `animation` and its kind's fields — every bar among them (`within_px`, `fraction`, `tolerance`, `least_drive` above 0, `within_degrees` from 0 to 180, `lo_degrees` ≤ `hi_degrees`, `within_ratio` ≥ 1) — and each target's `bone`, `animation` and exactly one of `at` and `keys` (times strictly increasing), and `not_planted`, `not_swinging`, `rises` and `rests` when given (each a non-empty list of part names, each once; no part both in `not_swinging` and in `rises` or `rests`), and `may_fold` when given (a non-empty list of `{ "slot", "animation", "why" }`, every one a non-blank string, each pair once; issue #320), and `pinholes` when given (an object whose one field, `required`, is `true` or `false`; issue #944), `seam_over_motion` when given (the same shape; issue #941), and `boundary_colour` when given (an object whose one field, `max_step_excess`, is an integer from 0 through 255; issue #942), and `motion_seams` when given (an array of `{part, neighbour}`, each an unordered pair of distinct output part names, once per list; issue #1269), and `behind_seams` when given (optional `threshold`, `allowance`, `pairs`; each pair requires distinct nonempty `part` and `neighbour`, with optional `threshold` and `allowance`; thresholds are integers from 0 through 255, allowances are nonnegative safe integers, and reverse duplicates are invalid; issue #1314). `note`, `*_note` (strings) and `x-…` (any value) are read by nothing, as in the config | write the field; the bar is yours. For a pair read only by `seam_over_motion.required`, declare requirements-level `motion_seams` `[{part, neighbour}]` and omit a seam requirement; this leaves a frozen `parts.json` untouched. `config.motion_seams` remains an assemble-time carrier into `parts.json`. See the [carrier contract](#CONFIG_MOTION_SEAM) and [background over every frame](#background-over-every-frame-issue-941). |
6292
+ | <a id="REQUIREMENTS_FIELD"></a>`REQUIREMENTS_FIELD` | a field of the file is missing, of the wrong type, or not one the format reads: `spec`, `fps` (a positive number when supplied, required only when a declared measurement reads the file's sampling rate, with no default), `requirements`, each requirement's `name` (letters, digits, underscores; once each), `kind`, `animation` and its kind's fields — every bar among them (`within_px`, `fraction`, `tolerance`, `least_drive` above 0, `within_degrees` from 0 to 180, `lo_degrees` ≤ `hi_degrees`, `within_ratio` ≥ 1) — and each target's `bone`, `animation` and exactly one of `at` and `keys` (times strictly increasing), and `not_planted`, `not_swinging`, `rises` and `rests` when given (each a non-empty list of part names, each once; no part both in `not_swinging` and in `rises` or `rests`), and `may_fold` when given (a non-empty list of `{ "slot", "animation", "why" }`, every one a non-blank string, each pair once; issue #320), and `pinholes` when given (an object whose one field, `required`, is `true` or `false`; issue #944), `seam_over_motion` when given (the same shape; issue #941), and `boundary_colour` when given (an object whose one field, `max_step_excess`, is an integer from 0 through 255; issue #942), and `motion_seams` when given (an array of `{part, neighbour}`, each an unordered pair of distinct output part names, once per list; issue #1269), and `behind_seams` when given (optional `threshold`, `allowance`, `pairs`, `turn: true`; each pair requires distinct nonempty `part` and `neighbour`, with optional `threshold` and `allowance`; thresholds are integers from 0 through 255, allowances are nonnegative safe integers, and reverse duplicates are invalid; issue #1314). `note`, `*_note` (strings) and `x-…` (any value) are read by nothing, as in the config | write the field; the bar is yours. For a pair read only by `seam_over_motion.required`, declare requirements-level `motion_seams` `[{part, neighbour}]` and omit a seam requirement; this leaves a frozen `parts.json` untouched. `config.motion_seams` remains an assemble-time carrier into `parts.json`. See the [carrier contract](#CONFIG_MOTION_SEAM) and [background over every frame](#background-over-every-frame-issue-941). |
6293
6293
  | <a id="REQUIREMENTS_RESOLVES"></a>`REQUIREMENTS_RESOLVES` | a bone, an `ik` or `transform` constraint (by name and `constraint_type`, as rig-c resolves it), a slot, a mesh attachment or an animation the file names is not in `rig.json` or `motion.json`, or a seam's part, a requirements-level `motion_seams` part or neighbour, or a `not_planted`, `not_swinging`, `rises` or `rests` name is not in `parts.json` — the detail lists the ones that are; or an animation whose name cannot be a directory. Refused before anything is built | the name as the rig spells it |
6294
6294
  | <a id="REQUIREMENTS_CONSTRAINT_DRIVES"></a>`REQUIREMENTS_CONSTRAINT_DRIVES` | a `follow` names a bone its constraint does not constrain, or a property it does not drive: an `ik` drives `rotate` only; a `transform` drives `rotate` when a `to` names `rotate`, `translate` when one names `x` or `y` | the constraint's own bone and property |
6295
6295
  | <a id="REQUIREMENTS_TARGET_PARENT"></a>`REQUIREMENTS_TARGET_PARENT` | a scene target's bone is the root or is not parented to it, or the root is not at rest at the origin, or the animation keys the root — a stage point is a bone's position only under a root that stands still at the origin | a bone under the root for the scene to place |
@@ -7922,11 +7922,41 @@ It cannot establish a behind-part PASS.
7922
7922
  | --- | --- |
7923
7923
  | `behind_seams.threshold` | Optional authored T, an integer from 0 through 255. There is no default. A pair override can supply it; a pair with neither value reports SKIP and a HOLE. |
7924
7924
  | `behind_seams.allowance` | Optional nonnegative safe integer counted-cell allowance for both independent halves. The explicit design ruling sets omission to 0. |
7925
+ | `behind_seams.turn` | Optional literal `true`: measure existing declared turn slider endpoints and full corners; no range is declared here. Omit for byte-identical setup/idle-only output. |
7925
7926
  | `behind_seams.pairs` | Optional array of selected-pair overrides; no adjacency is guessed. |
7926
7927
  | `behind_seams.pairs[i].part`, `behind_seams.pairs[i].neighbour` | Required distinct nonempty part names. They must resolve to known parts in the selected declaration population; repeating a pair in either order is invalid. |
7927
7928
  | `behind_seams.pairs[i].threshold` | Optional authored integer T from 0 through 255, overriding the rig value for this pair. No effective T means SKIP and a HOLE. |
7928
7929
  | `behind_seams.pairs[i].allowance` | Optional nonnegative safe integer, overriding the rig allowance for both halves of this pair. |
7929
7930
 
7931
+ With `turn: true`, `BEHIND_PART_SEAMS.turn` is separate from setup and idle.
7932
+ For each declared local dial, sample its `from` and `max` with all others at
7933
+ setup, followed by every full min/max corner; duplicate poses occur once.
7934
+ For yaw, pitch and body yaw this means six axis endpoints and eight corners.
7935
+ Each row names the planned and observed dial locals and observed slider mapped
7936
+ times, using independent t=0 reset samples rather than idle time. The turn block records selected pose names, per-pair native
7937
+ frames and sampled/read/unmeasured pose counts, and separate standing and
7938
+ motion-opened maxima. No sweep or temporal span is claimed. Its stock transported
7939
+ setup-overlap evidence is computed separately with the official seam reader;
7940
+ the idle's exact stock binding is unchanged. One throwaway rig-c build appends a
7941
+ duration-0 animation for each selected pose, retaining the accepted setup,
7942
+ sliders, existing animations, build profile and pack flags. Its public motion
7943
+ tracks use `rotate`, `translatex` or `translatey`, with planned local minus
7944
+ setup as the key offset. The official facade samples each animation at t=0;
7945
+ rig-c applies its timeline before constraints. Local channels and slider times
7946
+ are observations after constraints, not a pre-constraint hook. Planned locals
7947
+ must match the observed locals at float32 precision. No second poser, projection
7948
+ or skinning implementation is used. The copy must retain the actual poser,
7949
+ atlas text, decoded pages and setup geometry; any mismatch or build refusal is
7950
+ a named turn HOLE while unrelated readings continue. Turn limitations record
7951
+ the original accepted skeleton SHA-256 once. The scratch copy is removed even
7952
+ on refusal; without the turn opt-in no copy or extra build is created.
7953
+ A missing optional poser is a named HOLE. A missing dial persists turn SKIP and
7954
+ its HOLE; an effective T makes it a required-unmeasured failure. Legacy `turn.x`
7955
+ has no finite range declaration and stays unread. Unread corridors cannot become
7956
+ zero counts. Thresholds and per-pair allowances apply unchanged to turn. A pair
7957
+ without its own effective T stays SKIP with a HOLE; another pair's override
7958
+ does not make that optional reading fail the turn block.
7959
+
7930
7960
  Malformed shapes and fields are [`REQUIREMENTS_FIELD`](#REQUIREMENTS_FIELD).
7931
7961
  Pair names must resolve to known parts and the pair must already belong to
7932
7962
  the actual selected declarations; neither is inferred from tags or body roles. Existing limb-segment, proven body-root and explicit
@@ -8246,6 +8276,16 @@ parents and stops keep their emitted names; Core creates the draw bones later.
8246
8276
  A name ending in `_d` alone is not an alias: a missing non-stop bone still
8247
8277
  raises `RIG_TURN_SURFACE_MESH_BINDINGS`. No new config field is required.
8248
8278
 
8279
+ All surfaces in one turn group share the reference already used by its sampled
8280
+ units: the first surface's opaque-art depth median, with `face` preferred for
8281
+ the head. When both eye landmarks exist, the head uses their mean depth sampled
8282
+ on that primary surface instead. Generated grids and authored weighted meshes
8283
+ both move by `-(pivot + z - zRef) * sin(angle)` along the active axis. Each
8284
+ surface samples its own sheet for `z`; it does not subtract its own median or
8285
+ eye samples. The depth recipe's `median` is encoded upstream in that sheet,
8286
+ so relative placements between surfaces survive the turn. Each group keeps
8287
+ its own reference; a single surface keeps its existing motion bytes.
8288
+
8249
8289
  Depth-turn `"surface"` parts may use authored weighted `grid`, `contour`,
8250
8290
  `influence` or `explicit` meshes, or the turn-generated grid when attached as
8251
8291
  a region. `auto` cannot combine with `"surface"` in either `turn.roles` or
@@ -8951,15 +8991,18 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
8951
8991
  | `ANIMATIONS_DO_NOT_FOLD.declared_not_folding` | `ANIMATIONS_DO_NOT_FOLD.declared_not_folding` | part when the supplied mapping resolves a piece; otherwise rig | finding | resolved piece for e.slot; otherwise [] | [check.ts:3550](../src/check.ts#L3550) |
8952
8992
  | `ANIMATIONS_DO_NOT_FOLD.folding` | `ANIMATIONS_DO_NOT_FOLD.folding` | part when the supplied mapping resolves a piece; otherwise rig | finding when entry === undefined; otherwise evidence | resolved piece for slot; otherwise [] | [check.ts:3512](../src/check.ts#L3512) |
8953
8993
  | `ART_JOINT_DISTANCE.joints` | `ART_JOINT_DISTANCE.joints` | 'rig' | finding when status === 'FAIL'; otherwise evidence | [] | [artjoints.ts:86](../src/artjoints.ts#L86) |
8954
- | `BEHIND_PART_SEAMS.contributors` | `BEHIND_PART_SEAMS.pairs[].setup.motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].setup.standing.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].frames[].motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.samples[].contributors` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:348](../src/behindseams.ts#L348) |
8955
- | `BEHIND_PART_SEAMS.hits` | `BEHIND_PART_SEAMS.pairs[].motion_opened.frames`; `BEHIND_PART_SEAMS.pairs[].standing.frames`; `BEHIND_PART_SEAMS.pairs[].motion_opened.worst`; `BEHIND_PART_SEAMS.pairs[].standing.worst` | 'pair' | finding when r.px > allowance; otherwise evidence | parts | [behindseams.ts:408](../src/behindseams.ts#L408) |
8956
- | `BEHIND_PART_SEAMS.pairs` | `BEHIND_PART_SEAMS.pairs` | 'pair' | finding when failed; otherwise evidence | parts | [behindseams.ts:485](../src/behindseams.ts#L485) |
8994
+ | `BEHIND_PART_SEAMS.contributors` | `BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.samples[].contributors`; `BEHIND_PART_SEAMS.turn.pairs[].frames[].motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].setup.motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].setup.standing.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].frames[].motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.samples[].contributors` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:396](../src/behindseams.ts#L396) |
8995
+ | `BEHIND_PART_SEAMS.hits` | `BEHIND_PART_SEAMS.pairs[].motion_opened.frames`; `BEHIND_PART_SEAMS.pairs[].standing.frames`; `BEHIND_PART_SEAMS.pairs[].motion_opened.worst`; `BEHIND_PART_SEAMS.pairs[].standing.worst` | 'pair' | finding when r.px > allowance; otherwise evidence | parts | [behindseams.ts:456](../src/behindseams.ts#L456) |
8996
+ | `BEHIND_PART_SEAMS.pairs` | `BEHIND_PART_SEAMS.pairs` | 'pair' | finding when failed; otherwise evidence | parts | [behindseams.ts:533](../src/behindseams.ts#L533) |
8957
8997
  | `BEHIND_PART_SEAMS.pairs[].frames` | `BEHIND_PART_SEAMS.pairs[].frames` | | | | |
8958
8998
  | `BEHIND_PART_SEAMS.pairs[].setup` | `BEHIND_PART_SEAMS.pairs[].setup` | | | | |
8959
- | `BEHIND_PART_SEAMS.samples` | `BEHIND_PART_SEAMS.pairs[].setup.motion_opened.samples`; `BEHIND_PART_SEAMS.pairs[].setup.standing.samples`; `BEHIND_PART_SEAMS.pairs[].frames[].motion_opened.samples`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.samples` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:347](../src/behindseams.ts#L347) |
8960
- | `BEHIND_PART_SEAMS.spans` | `BEHIND_PART_SEAMS.pairs[].motion_opened.spans`; `BEHIND_PART_SEAMS.pairs[].standing.spans` | 'pair' | evidence | parts | [behindseams.ts:416](../src/behindseams.ts#L416) |
8961
- | `BEHIND_PART_SEAMS.unmeasured` | `BEHIND_PART_SEAMS.unmeasured` | pair === null ? 'rig' : 'pair'; 'rig' | finding when required; otherwise evidence; finding | pair === null ? [] : [pair.a, pair.b]; [] | [behindseams.ts:429](../src/behindseams.ts#L429), [behindseams.ts:562](../src/behindseams.ts#L562), [behindseams.ts:590](../src/behindseams.ts#L590) |
8962
- | `BEHIND_PART_SEAMS.unread_corridors` | `BEHIND_PART_SEAMS.pairs[].setup.standing.unread_corridors`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.unread_corridors` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:271](../src/behindseams.ts#L271) |
8999
+ | `BEHIND_PART_SEAMS.samples` | `BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.samples`; `BEHIND_PART_SEAMS.turn.pairs[].frames[].motion_opened.samples`; `BEHIND_PART_SEAMS.pairs[].setup.motion_opened.samples`; `BEHIND_PART_SEAMS.pairs[].setup.standing.samples`; `BEHIND_PART_SEAMS.pairs[].frames[].motion_opened.samples`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.samples` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:395](../src/behindseams.ts#L395) |
9000
+ | `BEHIND_PART_SEAMS.spans` | `BEHIND_PART_SEAMS.pairs[].motion_opened.spans`; `BEHIND_PART_SEAMS.pairs[].standing.spans` | 'pair' | evidence | parts | [behindseams.ts:464](../src/behindseams.ts#L464) |
9001
+ | `BEHIND_PART_SEAMS.turn.pairs` | `BEHIND_PART_SEAMS.turn.pairs` | 'pair' | finding when required; otherwise evidence; finding when motion.status === 'FAIL' &#124;&#124; standing.status === 'FAIL' &#124;&#124; threshold !== null && read !== turn.poses.length; otherwise evidence | [pair.a, pair.b]; parts | [behindseams.ts:563](../src/behindseams.ts#L563), [behindseams.ts:605](../src/behindseams.ts#L605) |
9002
+ | `BEHIND_PART_SEAMS.turn.pairs[].frames` | `BEHIND_PART_SEAMS.turn.pairs[].frames` | | | | |
9003
+ | `BEHIND_PART_SEAMS.turn.unmeasured` | `BEHIND_PART_SEAMS.turn.unmeasured` | pair === null ? 'rig' : 'pair' | finding when mandatory; otherwise evidence | pair === null ? [] : [pair.a, pair.b] | [behindseams.ts:555](../src/behindseams.ts#L555) |
9004
+ | `BEHIND_PART_SEAMS.unmeasured` | `BEHIND_PART_SEAMS.unmeasured` | pair === null ? 'rig' : 'pair'; 'rig' | finding when required; otherwise evidence; finding | pair === null ? [] : [pair.a, pair.b]; [] | [behindseams.ts:477](../src/behindseams.ts#L477), [behindseams.ts:806](../src/behindseams.ts#L806), [behindseams.ts:838](../src/behindseams.ts#L838) |
9005
+ | `BEHIND_PART_SEAMS.unread_corridors` | `BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.unread_corridors`; `BEHIND_PART_SEAMS.pairs[].setup.standing.unread_corridors`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.unread_corridors` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:319](../src/behindseams.ts#L319) |
8963
9006
  | `BOUNDARY_COLOUR_STEP.over` | `BOUNDARY_COLOUR_STEP.over` | 'pair' | finding | r.parts | [boundarycolour.ts:221](../src/boundarycolour.ts#L221) |
8964
9007
  | `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) |
8965
9008
  | `CLOTH_SETTLES.rows` | `CLOTH_SETTLES.rows` | 'rig' | finding when speeds.length > 0 && s < speeds.length; otherwise evidence | [] | [check.ts:5996](../src/check.ts#L5996) |
@@ -8983,21 +9026,21 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
8983
9026
  | `SEAM_OVER_RANGE.joints[].poses` | `SEAM_OVER_RANGE.joints[].poses` | 'part' | finding when fail; otherwise evidence | [j.part] | [check.ts:4411](../src/check.ts#L4411) |
8984
9027
  | `SETUP_MATCHES_PAINTING.regions` | `SETUP_MATCHES_PAINTING.regions` | 'rig' | finding when status === 'FAIL'; otherwise evidence | [] | [setuppainting.ts:175](../src/setuppainting.ts#L175) |
8985
9028
  | `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:176](../src/setuppainting.ts#L176) |
8986
- | `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:9026](../src/check.ts#L9026) |
8987
- | `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:9012](../src/check.ts#L9012), [check.ts:9017](../src/check.ts#L9017) |
9029
+ | `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:9062](../src/check.ts#L9062) |
9030
+ | `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:9048](../src/check.ts#L9048), [check.ts:9053](../src/check.ts#L9053) |
8988
9031
  | `STRESS_OFF_CHAIN.not_read` | `STRESS_OFF_CHAIN.not_read` | 'part' | evidence | [r.part] | [check.ts:3971](../src/check.ts#L3971) |
8989
9032
  | `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:3959](../src/check.ts#L3959) |
8990
9033
  | `STRESS_OFF_CHAIN.per_part[].off_chain` | `STRESS_OFF_CHAIN.per_part[].off_chain` | 'part' | evidence | [r.part] | [check.ts:3959](../src/check.ts#L3959) |
8991
9034
  | `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:3927](../src/check.ts#L3927), [check.ts:3945](../src/check.ts#L3945) |
8992
- | `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:9676](../src/check.ts#L9676), [check.ts:9686](../src/check.ts#L9686) |
8993
- | `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:8430](../src/check.ts#L8430), [check.ts:8435](../src/check.ts#L8435), [check.ts:8456](../src/check.ts#L8456), [check.ts:8467](../src/check.ts#L8467) |
9035
+ | `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:9712](../src/check.ts#L9712), [check.ts:9722](../src/check.ts#L9722) |
9036
+ | `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:8466](../src/check.ts#L8466), [check.ts:8471](../src/check.ts#L8471), [check.ts:8492](../src/check.ts#L8492), [check.ts:8503](../src/check.ts#L8503) |
8994
9037
  | `WIND_BAND.pairs` | `WIND_BAND.pairs` | 'pair' | finding when !holdsAll; otherwise evidence | [p.a, p.b] | [check.ts:6500](../src/check.ts#L6500) |
8995
9038
  | `WIND_BAND.pairs[].steps` | `WIND_BAND.pairs[].steps` | 'pair' | finding when !s.holds; otherwise evidence | [p.a, p.b] | [check.ts:6511](../src/check.ts#L6511) |
8996
9039
  | `figure_openings.openings` | `figure_openings.openings` | 'pair' | finding | [ps.under, ps.above] | [check.ts:5817](../src/check.ts#L5817) |
8997
- | `loop_physics` | `loop_physics` | 'rig' | evidence | [] | [check.ts:7498](../src/check.ts#L7498) |
8998
- | `requirements.lines.* (bone)` | `requirements.lines.*` | 'rig' | finding when line.status === 'FAIL'; otherwise evidence | [] | [check.ts:7800](../src/check.ts#L7800) |
8999
- | `requirements.lines.* (seam)` | `requirements.lines.*` | 'pair' | finding when line.status === 'FAIL'; otherwise evidence | [r.part, r.neighbour] | [check.ts:7800](../src/check.ts#L7800) |
9000
- | `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:7800](../src/check.ts#L7800) |
9040
+ | `loop_physics` | `loop_physics` | 'rig' | evidence | [] | [check.ts:7534](../src/check.ts#L7534) |
9041
+ | `requirements.lines.* (bone)` | `requirements.lines.*` | 'rig' | finding when line.status === 'FAIL'; otherwise evidence | [] | [check.ts:7836](../src/check.ts#L7836) |
9042
+ | `requirements.lines.* (seam)` | `requirements.lines.*` | 'pair' | finding when line.status === 'FAIL'; otherwise evidence | [r.part, r.neighbour] | [check.ts:7836](../src/check.ts#L7836) |
9043
+ | `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:7836](../src/check.ts#L7836) |
9001
9044
  | `seam_cells.frames` | `frames` | 'pair' | evidence | [p.a, p.b] | [check.ts:4702](../src/check.ts#L4702) |
9002
9045
  | `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:4662](../src/check.ts#L4662) |
9003
9046
  | `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:2508](../src/check.ts#L2508) |
package/docs/DEPTH.md CHANGED
@@ -46,6 +46,14 @@ use. Three things we learned the hard way are built into that path:
46
46
  `median`) and how deep its own shape is (its `relief`) are declared in rig
47
47
  pixels, and the tool never guesses them.
48
48
 
49
+ Surfaces in one turn group share one depth reference: the first surface's
50
+ opaque-art median, preferring the face in a head group. With both eye landmarks,
51
+ the head instead anchors to their mean depth on that primary surface. A surface
52
+ keeps the depth encoded from its declared `median` relative to this shared
53
+ anchor; its own median is not subtracted again. Thus two touching parts retain
54
+ their declared depth difference when they turn. Head and body groups have
55
+ separate anchors, and this applies to generated grids and authored meshes alike.
56
+
49
57
  See-through, the layer decomposition this package reads, also writes a per-layer
50
58
  depth sheet, and a config can register those directly (`config.depth`,
51
59
  [Per-layer depth sheets](AUTHORING.md#per-layer-depth-sheets-773)). In
package/docs/STABILITY.md CHANGED
@@ -1200,7 +1200,7 @@ route. See [Background over every frame](AUTHORING.md#background-over-every-fram
1200
1200
  The optional `behind_seams` key in `spine-parts-requirements/1` (issue #1314,
1201
1201
  additive) declares the required `BEHIND_PART_SEAMS` check, independently of the
1202
1202
  existing requirement kinds and without a new CLI flag. Its optional fields are
1203
- `threshold`, `allowance` and `pairs`; pair entries require distinct nonempty
1203
+ `threshold`, `allowance`, `pairs` and `turn`; pair entries require distinct nonempty
1204
1204
  `part` and `neighbour` names and may override `threshold` and `allowance`.
1205
1205
  Names must resolve to known parts and an already selected pair; duplicate
1206
1206
  pairs, including reversed pairs, are invalid. Shape errors use `REQUIREMENTS_FIELD`.
@@ -1222,6 +1222,36 @@ motion support, boundary population or verified render evidence is a HOLE,
1222
1222
  not a zero PASS. Existing render/sidecar refusals remain refusals. The standing
1223
1223
  bracketed-run definition does not certify curved or diagonal openings.
1224
1224
 
1225
+ Issue #1323 adds `behind_seams.turn: true` as an explicit opt-in. It references
1226
+ existing emitted turn slider ranges, never a second range declaration. Without
1227
+ this key no turn rows are written and existing `check.json` bytes are unchanged.
1228
+ With it, `BEHIND_PART_SEAMS.turn` records named independent reset poses: each
1229
+ dial's declared `from` and `max` with other dials at setup, then every full
1230
+ min/max corner, deduplicated in that order. It records planned and observed dial locals and observed slider mapped times, per-pair
1231
+ `frames`, `sampled_poses`, `read_poses`, `unmeasured_poses`, and separate
1232
+ `motion_opened` / `standing` status and maximum counts. There are no temporal
1233
+ spans: pose indices are sample identities, and time is 0 for every reset.
1234
+ Turn uses its own setup, rest geometry and transported stock seam evidence;
1235
+ idle stock and idle counts are unchanged. The same thresholds, allowances,
1236
+ rear-set and unread rules apply. Optional unread-corridor evidence also applies
1237
+ to turn standing rows. No declared dial persists turn SKIP and a named HOLE;
1238
+ an effective authored T makes that missing required reading a
1239
+ `CHECK_BEHIND_PART_SEAMS_UNMEASURED` failure. Legacy `turn.x` has no declared
1240
+ finite range and is explicitly unread, never given a guessed range. The
1241
+ official facade supplies geometry from one throwaway gated build that appends
1242
+ one duration-0 pose animation per selected endpoint/corner, retaining setup,
1243
+ sliders, original animations, profile and pack flags. Timeline properties are
1244
+ `rotate` / `translatex` / `translatey`, with offsets from setup. Actual local
1245
+ channels (after constraints) must match planned locals at float32 precision;
1246
+ slider mapped times are also retained. Actual poser, atlas text, decoded pages
1247
+ and setup geometry must match the accepted build, or turn is a named HOLE.
1248
+ Build refusal also leaves unrelated readings available, with scratch cleanup
1249
+ in all cases. The original skeleton SHA-256 is recorded once in turn limitations.
1250
+ Without opt-in there is no scratch copy or extra build. Missing effective T for
1251
+ one pair is optional SKIP even when another pair has a required override.
1252
+ An unavailable poser or source is a HOLE. Other animations, between-sample turns and alternate
1253
+ skins remain unmeasured.
1254
+
1225
1255
  Issue #1325 adds the following optional evidence fields to
1226
1256
  `BEHIND_PART_SEAMS.pairs[].setup.standing` and
1227
1257
  `BEHIND_PART_SEAMS.pairs[].frames[].standing` only. Paths in the table are
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rig-c/parts",
3
- "version": "2.42.0",
3
+ "version": "2.43.0",
4
4
  "description": "AI-authored 2D character parts from one anime painting and its See-through layer decomposition: measured parts, weighted-mesh rig specs, verified through rig-c before anything is written. A CLI for agents that cannot see the image.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,12 +1,14 @@
1
1
  import { readFileSync } from 'node:fs';
2
+ import { createHash } from 'node:crypto';
2
3
  import { isAbsolute, join, relative, resolve } from 'node:path';
3
4
  import type { Plate } from '@rig-c/core/plate';
4
5
  import type { AttachmentRest, Frame } from '@rig-c/core/render-shared';
5
- import { seamGridOf, type SeamCell, type SeamGrid } from '@rig-c/core/seam';
6
+ import { seamGridOf, seamsOf, setupCellReader, type SeamCell, type SeamGrid } from '@rig-c/core/seam';
6
7
  import { DRAWN_ALPHA } from '@rig-c/core/passthrough';
7
8
  import { checkRow } from './checkrow.ts';
8
9
  import { seamSourceAttachment, type MotionSeamPair } from './check.ts';
9
10
  import type { Problem } from './errors.ts';
11
+ import { BODY_TURN_ANIM, BODY_YAW_DIAL_BONE, PITCH_DIAL_BONE, TURN_BONE, YAW_DIAL_BONE } from './turn.ts';
10
12
 
11
13
  export const BEHIND_SEAM_LINE = 'BEHIND_PART_SEAMS';
12
14
  export const UNDECLARED_BEHIND_SEAM_REASON = 'HOLE: no requirements.behind_seams declares an authored threshold T; not measured, never a pass';
@@ -14,6 +16,8 @@ export const BEHIND_SEAM_CODE = 'CHECK_BEHIND_PART_SEAMS';
14
16
  export const BEHIND_SEAM_UNMEASURED_CODE = 'CHECK_BEHIND_PART_SEAMS_UNMEASURED';
15
17
 
16
18
  export interface BehindSeams {
19
+ /** Opt in to the rig's declared ranges; never supplies or guesses a range. */
20
+ turn?: true;
17
21
  threshold?: number;
18
22
  allowance?: number;
19
23
  pairs?: Array<{ part: string; neighbour: string; threshold?: number; allowance?: number }>;
@@ -34,6 +38,42 @@ export interface BehindSeamsFramesInput {
34
38
  pages: Map<string, Plate>;
35
39
  stock: readonly BehindSeamsStockPair[] | null;
36
40
  fps: number;
41
+ turn?: BehindSeamsTurnInput;
42
+ }
43
+ export interface BehindSeamsTurnPose {
44
+ name: string;
45
+ values: Record<string, number>;
46
+ observed_values?: Record<string, number>;
47
+ slider_times?: Record<string, number>;
48
+ }
49
+ export interface BehindSeamsTurnInput {
50
+ poses: BehindSeamsTurnPose[];
51
+ frames: Array<Frame | null>;
52
+ setup: Frame | null;
53
+ rest: readonly AttachmentRest[];
54
+ stock: readonly BehindSeamsStockPair[] | null;
55
+ reason?: string;
56
+ sourceSkeletonSha256?: string;
57
+ poser?: string;
58
+ }
59
+ export interface BehindSeamsTurnPair {
60
+ pair: string;
61
+ parts: [string, string];
62
+ threshold: number | null;
63
+ allowance: number;
64
+ frames: BehindSeamsFrame[];
65
+ sampled_poses: number;
66
+ read_poses: number;
67
+ unmeasured_poses: number;
68
+ motion_opened: { status: BehindSeamsCount['status']; max_px: number };
69
+ standing: { status: BehindSeamsCount['status']; max_px: number };
70
+ }
71
+ export interface BehindSeamsTurnMeasured {
72
+ status: BehindSeamsCount['status'];
73
+ poses: string[];
74
+ pairs: BehindSeamsTurnPair[];
75
+ unmeasured: BehindSeamsMeasured['unmeasured'];
76
+ limitations: string;
37
77
  }
38
78
  export interface BehindSeamsSample {
39
79
  x: number;
@@ -69,7 +109,11 @@ export interface BehindSeamsStanding extends BehindSeamsCount {
69
109
  unread_corridors?: BehindSeamsUnreadCorridor[];
70
110
  }
71
111
  export interface BehindSeamsFrame {
72
- animation: 'idle' | null;
112
+ animation: 'idle' | 'turn' | null;
113
+ pose?: string;
114
+ values?: Record<string, number>;
115
+ observed_values?: Record<string, number>;
116
+ slider_times?: Record<string, number>;
73
117
  index: number;
74
118
  time: number;
75
119
  behind_slots: string[];
@@ -118,6 +162,7 @@ export interface BehindSeamsMeasured {
118
162
  pairs: BehindSeamsPair[];
119
163
  unmeasured: Array<{ pair: string | null; frame: string; reason: string }>;
120
164
  limitations: string;
165
+ turn?: BehindSeamsTurnMeasured;
121
166
  }
122
167
 
123
168
  /** The orchestration input: only an already gated build and its full stock seam
@@ -129,6 +174,7 @@ export interface BehindSeamsInput {
129
174
  stockDir: string | null;
130
175
  fps: number;
131
176
  unsupported?: string;
177
+ turnBuild?: { build?: string; reason?: string };
132
178
  }
133
179
 
134
180
  const LIMITATIONS = 'setup and every idle frame; motion uses transported setup-overlap support; standing certifies horizontal and vertical bracketed runs, not all curved or diagonal openings; rear-set attribution is not individual-slot blame; other animations and alternate skins are not measured';
@@ -142,7 +188,8 @@ export function behindSeamsProblems(value: unknown, at: string): Problem[] {
142
188
  const bad = (object: string, detail: string): void => { problems.push({ code: 'REQUIREMENTS_FIELD', object, detail }); };
143
189
  const block = (v: unknown, where: string, pair: boolean): void => {
144
190
  if (!record(v)) { bad(where, `is ${JSON.stringify(v)}; requires a behind_seams record with an authored threshold and optional allowance/pair overrides`); return; }
145
- for (const k of Object.keys(v)) if (!(pair ? ['part', 'neighbour', 'threshold', 'allowance'] : ['threshold', 'allowance', 'pairs']).includes(k) && !freeKey(k, v[k])) bad(`${where}.${k}`, 'is not a field this block reads (threshold, allowance, pairs; pair entries name part and neighbour; note or *_note as a string; x-<name> as a record)');
191
+ for (const k of Object.keys(v)) if (!(pair ? ['part', 'neighbour', 'threshold', 'allowance'] : ['threshold', 'allowance', 'pairs', 'turn']).includes(k) && !freeKey(k, v[k])) bad(`${where}.${k}`, 'is not a field this block reads (threshold, allowance, pairs, turn; pair entries name part and neighbour; note or *_note as a string; x-<name> as a record)');
192
+ if (!pair && 'turn' in v && v.turn !== true) bad(`${where}.turn`, 'requires true to read the rig\'s declared turn range endpoints and corners; omit to retain setup/idle only; no ranges are supplied here');
146
193
  if ('threshold' in v && (typeof v.threshold !== 'number' || !Number.isInteger(v.threshold) || v.threshold < 0 || v.threshold > 255)) bad(`${where}.threshold`, `is ${JSON.stringify(v.threshold)}; requires an authored integer from 0 through 255; no threshold is derived from the art`);
147
194
  if ('allowance' in v && (typeof v.allowance !== 'number' || !Number.isSafeInteger(v.allowance) || v.allowance < 0)) bad(`${where}.allowance`, `is ${JSON.stringify(v.allowance)}; requires a nonnegative safe integer count of seam cells`);
148
195
  if (pair) {
@@ -215,9 +262,10 @@ interface RasterCache { full: Plate; hidden: Plate }
215
262
 
216
263
  function readBehindFrame(api: BehindSeamsApi, input: BehindSeamsFramesInput, pair: MotionSeamPair, frame: Frame, setup: boolean,
217
264
  stock: BehindSeamsStockPair | undefined, threshold: number, allowance: number, unread: (frame: string, reason: string) => void,
218
- cache: Map<Frame, Map<string, RasterCache>>): BehindSeamsFrame {
219
- const label = setup ? 'setup' : `idle frame ${frame.index}`;
220
- const row: BehindSeamsFrame = { ...checkRow(setup ? 'BEHIND_PART_SEAMS.pairs[].setup' : 'BEHIND_PART_SEAMS.pairs[].frames', 'pair', false, [pair.a, pair.b]), animation: setup ? null : 'idle', index: frame.index, time: frame.time, behind_slots: [], grid: null, motion_opened: emptyCount(), standing: emptyCount() };
265
+ cache: Map<Frame, Map<string, RasterCache>>, pose?: BehindSeamsTurnPose): BehindSeamsFrame {
266
+ const label = pose !== undefined ? `turn ${pose.name}` : setup ? 'setup' : `idle frame ${frame.index}`;
267
+ const family = pose !== undefined ? 'BEHIND_PART_SEAMS.turn.pairs[].frames' : setup ? 'BEHIND_PART_SEAMS.pairs[].setup' : 'BEHIND_PART_SEAMS.pairs[].frames';
268
+ const row: BehindSeamsFrame = { ...checkRow(family, 'pair', false, [pair.a, pair.b]), animation: pose !== undefined ? 'turn' : setup ? null : 'idle', index: frame.index, time: frame.time, ...(pose === undefined ? {} : { pose: pose.name, values: { ...pose.values }, ...(pose.observed_values === undefined ? {} : { observed_values: pose.observed_values, slider_times: pose.slider_times }) }), behind_slots: [], grid: null, motion_opened: emptyCount(), standing: emptyCount() };
221
269
  const fail = (reason: string): BehindSeamsFrame => { unread(label, reason); return row; };
222
270
  if (pair.unread !== undefined) return fail(pair.unread);
223
271
  if (frame.attachments === undefined) return fail('draw order/whole attachment geometry is unavailable');
@@ -290,7 +338,7 @@ function readBehindFrame(api: BehindSeamsApi, input: BehindSeamsFramesInput, pai
290
338
  let motionReadable = setup;
291
339
  const motionCells = new Map<number, SeamCell>();
292
340
  if (!setup) {
293
- if (stock === undefined || stock.frames !== input.idle.length || stock.drawn !== stock.frames || stock.banded !== stock.frames) unread(label, 'stock transported setup-overlap support is unavailable on every idle frame; motion-opened is not measured');
341
+ if (stock === undefined || stock.frames !== input.idle.length || stock.drawn !== stock.frames || stock.banded !== stock.frames) unread(label, `stock transported setup-overlap support is unavailable on every ${pose === undefined ? 'idle frame' : 'named turn pose'}; motion-opened is not measured`);
294
342
  else {
295
343
  motionReadable = true;
296
344
  const hits = stock.gapCovered.filter(h => h.index === frame.index);
@@ -393,7 +441,7 @@ function readBehindFrame(api: BehindSeamsApi, input: BehindSeamsFramesInput, pai
393
441
  row.motion_opened.geometric_px = motionHits.size; row.motion_opened.raw_px = motionHits.size;
394
442
  counted(row.motion_opened, motionHits, grid, allowance);
395
443
  if (!motionReadable) row.motion_opened.status = 'SKIP';
396
- return { ...row, ...checkRow(setup ? 'BEHIND_PART_SEAMS.pairs[].setup' : 'BEHIND_PART_SEAMS.pairs[].frames', 'pair', row.standing.status === 'FAIL' || row.motion_opened.status === 'FAIL', [pair.a, pair.b]) };
444
+ return { ...row, ...checkRow(family, 'pair', row.standing.status === 'FAIL' || row.motion_opened.status === 'FAIL', [pair.a, pair.b]) };
397
445
  } catch (e) { return fail(`official raster/source reading unavailable: ${e instanceof Error ? e.message : String(e)}`); }
398
446
  }
399
447
 
@@ -486,9 +534,198 @@ export function measureBehindSeamFrames(api: BehindSeamsApi, input: BehindSeamsF
486
534
  sampled_frames: input.idle.length, read_frames: readFrames, unmeasured_frames: input.idle.length - readFrames });
487
535
  }
488
536
  line.status = problems.length > start ? 'FAIL' : line.pairs.length === 0 || line.pairs.some(p => p.threshold === null || p.motion_opened.status === 'SKIP' || p.standing.status === 'SKIP') ? 'SKIP' : 'PASS';
537
+ if (declared.turn === true) {
538
+ line.turn = measureBehindTurnFrames(api, input, declared, problems);
539
+ if (line.turn.status === 'FAIL' || problems.length > start) line.status = 'FAIL';
540
+ else if (line.turn.status === 'SKIP' && line.status !== 'FAIL') line.status = 'SKIP';
541
+ }
489
542
  return line;
490
543
  }
491
544
 
545
+ /** Turn observations are independent t=0 reset samples, never temporal spans. */
546
+ function measureBehindTurnFrames(api: BehindSeamsApi, input: BehindSeamsFramesInput, declared: BehindSeams, problems: Problem[]): BehindSeamsTurnMeasured {
547
+ const turn = input.turn;
548
+ const result: BehindSeamsTurnMeasured = { status: 'SKIP', poses: turn?.poses.map(p => p.name) ?? [], pairs: [], unmeasured: [],
549
+ limitations: 'independent setup-reset turn endpoints and full range corners only; no sweep, idle motion, temporal spans or alternate skins; standing and transported setup-overlap are separate' };
550
+ if (turn?.poser !== undefined) result.limitations += `; poser ${turn.poser}`;
551
+ if (turn?.sourceSkeletonSha256 !== undefined) result.limitations += `; original skeleton sha256 ${turn.sourceSkeletonSha256}`;
552
+ const required = declared.threshold !== undefined || declared.pairs?.some(p => p.threshold !== undefined) === true;
553
+ let mandatoryUnread = false;
554
+ const unread = (pair: MotionSeamPair | null, frame: string, reason: string, mandatory: boolean): void => {
555
+ result.unmeasured.push({ ...checkRow('BEHIND_PART_SEAMS.turn.unmeasured', pair === null ? 'rig' : 'pair', mandatory, pair === null ? [] : [pair.a, pair.b]), pair: pair?.pair ?? null, frame, reason: `HOLE: ${reason}` });
556
+ if (mandatory) mandatoryUnread = true;
557
+ if (mandatory) problems.push({ code: BEHIND_SEAM_UNMEASURED_CODE, object: `${pair?.pair ?? BEHIND_SEAM_LINE} (${frame})`, detail: `HOLE: ${reason}; required turn reading cannot pass unmeasured` });
558
+ };
559
+ if (turn === undefined || turn.poses.length === 0) {
560
+ unread(null, 'turn', turn?.reason ?? 'no declared finite turn dial range; turn is SKIP, never a pass', required);
561
+ result.pairs = input.pairs.map(pair => {
562
+ const override = declared.pairs?.find(p => keyOf(p.part, p.neighbour) === keyOf(pair.a, pair.b));
563
+ return { ...checkRow('BEHIND_PART_SEAMS.turn.pairs', 'pair', required, [pair.a, pair.b]), pair: pair.pair, parts: [pair.a, pair.b],
564
+ threshold: override?.threshold ?? declared.threshold ?? null, allowance: override?.allowance ?? declared.allowance ?? 0,
565
+ frames: [], sampled_poses: 0, read_poses: 0, unmeasured_poses: 0,
566
+ motion_opened: { status: 'SKIP', max_px: 0 }, standing: { status: 'SKIP', max_px: 0 } };
567
+ });
568
+ return result;
569
+ }
570
+ if (turn.reason !== undefined) unread(null, 'turn', turn.reason, required);
571
+ const complete = turn.frames.length === turn.poses.length && new Set(turn.poses.map(p => p.name)).size === turn.poses.length;
572
+ if (!complete) unread(null, 'turn', 'missing or duplicate named turn sample; every preselected endpoint and corner is required', required);
573
+ const frames = turn.frames.filter((f): f is Frame => f !== null);
574
+ const posedInput: BehindSeamsFramesInput = { ...input, setup: turn.setup, idle: frames, rest: turn.rest, stock: turn.stock };
575
+ const cache = new Map<Frame, Map<string, RasterCache>>();
576
+ for (const pair of input.pairs) {
577
+ const override = declared.pairs?.find(p => keyOf(p.part, p.neighbour) === keyOf(pair.a, pair.b));
578
+ const threshold = override?.threshold ?? declared.threshold ?? null, allowance = override?.allowance ?? declared.allowance ?? 0;
579
+ const parts: [string, string] = [pair.a, pair.b];
580
+ const stockRows = turn.stock?.filter(s => s.pair === pair.pair) ?? [];
581
+ const rows: BehindSeamsFrame[] = [];
582
+ if (threshold === null) unread(pair, 'turn declaration', 'no authored threshold T; turn pair is SKIP, never a pass', false);
583
+ else {
584
+ if (turn.setup === null) unread(pair, 'turn setup', 'actual turn setup pose is unavailable', true);
585
+ for (const [index, pose] of turn.poses.entries()) {
586
+ const frame = turn.frames[index];
587
+ if (frame === undefined || frame === null || frame.index !== index || frame.time !== 0) {
588
+ unread(pair, `turn ${pose.name}`, 'preselected turn pose is missing or has the wrong identity; it cannot become zero cells', true);
589
+ continue;
590
+ }
591
+ const row = readBehindFrame(api, posedInput, pair, frame, false, stockRows.length === 1 ? stockRows[0] : undefined,
592
+ threshold, allowance, (where, why) => unread(pair, where, why, true), cache, pose);
593
+ rows.push(row); cache.clear();
594
+ for (const kind of ['motion_opened', 'standing'] as const) if (row[kind].status === 'FAIL') problems.push({ code: BEHIND_SEAM_CODE,
595
+ object: `pair "${pair.pair}" turn ${pose.name} ${kind}`, detail: `${row[kind].px} native seam cells exceeds allowance ${allowance}; authored threshold ${threshold}; independent declared turn pose` });
596
+ }
597
+ }
598
+ const read = rows.filter(row => row.motion_opened.status !== 'SKIP' && row.standing.status !== 'SKIP' &&
599
+ !result.unmeasured.some(u => u.pair === pair.pair && u.frame === `turn ${row.pose}`)).length;
600
+ const aggregate = (kind: 'motion_opened' | 'standing'): BehindSeamsTurnPair['standing'] => ({
601
+ status: rows.some(r => r[kind].status === 'FAIL') ? 'FAIL' : complete && rows.length === turn.poses.length && rows.every(r => r[kind].status === 'PASS') ? 'PASS' : 'SKIP',
602
+ max_px: Math.max(0, ...rows.map(r => r[kind].px)),
603
+ });
604
+ const motion = aggregate('motion_opened'), standing = aggregate('standing');
605
+ result.pairs.push({ ...checkRow('BEHIND_PART_SEAMS.turn.pairs', 'pair', motion.status === 'FAIL' || standing.status === 'FAIL' || threshold !== null && read !== turn.poses.length, parts),
606
+ pair: pair.pair, parts, threshold, allowance, frames: rows, sampled_poses: turn.poses.length, read_poses: read, unmeasured_poses: turn.poses.length - read,
607
+ motion_opened: motion, standing });
608
+ }
609
+ if (input.pairs.length === 0) unread(null, 'turn selection', 'no selected seam pair; turn boundary population is unavailable', required);
610
+ result.status = result.pairs.some(p => p.motion_opened.status === 'FAIL' || p.standing.status === 'FAIL') || mandatoryUnread ? 'FAIL'
611
+ : result.pairs.length === 0 || result.pairs.some(p => p.motion_opened.status === 'SKIP' || p.standing.status === 'SKIP') ? 'SKIP' : 'PASS';
612
+ return result;
613
+ }
614
+
615
+ interface BehindTurnDial { bone: string; field: 'rotation' | 'x' | 'y'; min: number; max: number; setup: number }
616
+ /** Read emitted declarations, not config defaults, dial-name guesses or animation times. */
617
+ export function behindTurnPlan(rig: Record<string, unknown>): { dials: BehindTurnDial[]; poses: BehindSeamsTurnPose[]; reason?: string } {
618
+ const bones = (Array.isArray(rig.bones) ? rig.bones : []).filter(record);
619
+ const sliders = (Array.isArray(rig.constraints) ? rig.constraints : []).filter(record).filter(c => c.type === 'slider' &&
620
+ ([YAW_DIAL_BONE, PITCH_DIAL_BONE, BODY_YAW_DIAL_BONE, TURN_BONE].includes(String(c.bone)) || ['turn', 'tilt', BODY_TURN_ANIM].includes(String(c.animation))));
621
+ const dials: BehindTurnDial[] = [];
622
+ for (const c of sliders) {
623
+ const matched = bones.filter(b => b.name === c.bone), field = c.property === 'rotate' ? 'rotation' : c.property === 'x' ? 'x' : c.property === 'y' ? 'y' : null;
624
+ if (typeof c.bone !== 'string' || matched.length !== 1 || field === null || c.local !== true ||
625
+ typeof c.from !== 'number' || !Number.isFinite(c.from) || typeof c.max !== 'number' || !Number.isFinite(c.max) || c.from >= c.max || dials.some(d => d.bone === c.bone)) {
626
+ return { dials: [], poses: [], reason: `turn slider "${String(c.name)}" has no unique local dial with finite increasing from/max range; no range is invented` };
627
+ }
628
+ const setup = matched[0][field] ?? 0;
629
+ if (typeof setup !== 'number' || !Number.isFinite(setup) || setup < c.from || setup > c.max) return { dials: [], poses: [], reason: `turn dial "${c.bone}" has no finite in-range setup value` };
630
+ dials.push({ bone: c.bone, field, min: c.from, max: c.max, setup });
631
+ }
632
+ if (bones.some(b => b.name === TURN_BONE) && !dials.some(d => d.bone === TURN_BONE)) return { dials: [], poses: [], reason: `legacy dial "${TURN_BONE}" has no declared finite range; no x range is invented` };
633
+ if (dials.length === 0) return { dials, poses: [], reason: 'no declared turn dial; turn is SKIP, never a pass' };
634
+ const poses: BehindSeamsTurnPose[] = [], seen = new Set<string>();
635
+ const add = (values: Record<string, number>): void => {
636
+ const key = JSON.stringify(values);
637
+ if (!seen.has(key)) { seen.add(key); poses.push({ name: dials.map(d => `${d.bone}=${values[d.bone]}`).join(','), values }); }
638
+ };
639
+ const setup = Object.fromEntries(dials.map(d => [d.bone, d.setup]));
640
+ for (const dial of dials) for (const value of [dial.min, dial.max]) add({ ...setup, [dial.bone]: value });
641
+ const corners = (index: number, values: Record<string, number>): void => {
642
+ if (index === dials.length) { add(values); return; }
643
+ const dial = dials[index];
644
+ for (const value of [dial.min, dial.max]) corners(index + 1, { ...values, [dial.bone]: value });
645
+ };
646
+ corners(0, {});
647
+ return { dials, poses };
648
+ }
649
+
650
+ /** One gated copy can carry every selected pose. Motion keys are offsets from
651
+ * setup, so convert planned absolute locals to the public timeline schema. */
652
+ export function behindTurnAnimations(rig: Record<string, unknown>): Record<string, { duration: number; tracks: Array<{ bone: string; property: string; keys: Array<{ t: number; v: number[] }> }> }> {
653
+ const plan = behindTurnPlan(rig);
654
+ return Object.fromEntries(plan.poses.map(pose => [behindTurnAnimationName(pose.name), {
655
+ duration: 0,
656
+ tracks: plan.dials.map(d => ({ bone: d.bone, property: d.field === 'rotation' ? 'rotate' : d.field === 'x' ? 'translatex' : 'translatey',
657
+ keys: [{ t: 0, v: [pose.values[d.bone] - d.setup] }] })),
658
+ }]));
659
+ }
660
+ /** Injective safe encoding of the pose name, including every UTF-16 code unit;
661
+ * no index, truncation or per-pose digest can hide a sample identity. */
662
+ export function behindTurnAnimationName(name: string): string {
663
+ return `_behind_seams_turn_${name.split('').map(c => c.charCodeAt(0).toString(16).padStart(4, '0')).join('')}`;
664
+ }
665
+
666
+ /** Read the throwaway gated copy through the same public facade as idle.
667
+ * No skeleton, model, setup or poser implementation is changed here. */
668
+ function sampleBehindTurn(api: typeof import('@rig-c/core/render-shared'), input: BehindSeamsInput,
669
+ accepted: ReturnType<typeof api.loadCandidate>, acceptedSetup: Frame | null, acceptedPoser: string): BehindSeamsTurnInput {
670
+ const plan = behindTurnPlan(input.rig);
671
+ const empty: BehindSeamsTurnInput = { poses: plan.poses, frames: [], setup: null, rest: [], stock: null };
672
+ if (plan.reason !== undefined) return { ...empty, reason: plan.reason };
673
+ try {
674
+ empty.sourceSkeletonSha256 = createHash('sha256').update(readFileSync(join(input.build, 'skeleton.json'))).digest('hex');
675
+ if (input.turnBuild?.reason !== undefined) throw new Error(input.turnBuild.reason);
676
+ const build = input.turnBuild?.build;
677
+ if (build === undefined) throw new Error('gated turn animation copy is unavailable');
678
+ const skeleton = join(build, 'skeleton.json'), atlas = join(build, 'skeleton.atlas');
679
+ const atlasText = readFileSync(atlas, 'utf8');
680
+ if (atlasText !== readFileSync(join(input.build, 'skeleton.atlas'), 'utf8')) throw new Error('turn copy atlas text differs from accepted build');
681
+ const candidate = api.loadCandidate({ skeletonText: readFileSync(skeleton, 'utf8'), atlasText, atlasDir: build, label: 'behind seams turn samples' }, { skeleton, atlas }, undefined);
682
+ if (candidate.pages.size !== accepted.pages.size || [...accepted.pages].some(([name, page]) => {
683
+ const other = candidate.pages.get(name);
684
+ return other === undefined || other.width !== page.width || other.height !== page.height || !Buffer.from(other.data).equals(Buffer.from(page.data));
685
+ })) throw new Error('turn copy decoded atlas pages differ from accepted build');
686
+ const observed = api.throughPoser(candidate.choice, poser => {
687
+ const opts = { geometry: true, texture: true };
688
+ const setup = api.sampleSetupPose(poser, opts)[0] ?? null;
689
+ if (setup === null || JSON.stringify(setup) !== JSON.stringify(acceptedSetup)) throw new Error('turn copy setup geometry differs from accepted build');
690
+ const poses: BehindSeamsTurnPose[] = [];
691
+ const frames = plan.poses.map((pose, index) => {
692
+ const name = behindTurnAnimationName(pose.name);
693
+ const samples = api.sampleAnimation(poser, name, input.fps, { ...opts, channels: true });
694
+ if (samples.length !== 1 || samples[0].time !== 0) throw new Error(`turn ${pose.name}: animation "${name}" does not supply exactly one t=0 sample`);
695
+ const frame = samples[0];
696
+ if (frame.channelError !== undefined || frame.channels === undefined) throw new Error(`turn ${pose.name}: dial channels unavailable`);
697
+ const observed_values: Record<string, number> = {}, slider_times: Record<string, number> = {};
698
+ for (const dial of plan.dials) {
699
+ const property = dial.field === 'rotation' ? 'rotate' : `translate.${dial.field}`;
700
+ const local = frame.channels.filter(c => JSON.stringify(c.path) === JSON.stringify(['bone', dial.bone, property]));
701
+ const want = pose.values[dial.bone];
702
+ // The compiler stores float32 keys; compare at that declared precision.
703
+ if (local.length !== 1 || !Number.isFinite(local[0].value) || Math.fround(local[0].value) !== Math.fround(want)) throw new Error(`turn ${pose.name}: dial "${dial.bone}" did not reach planned local ${want}`);
704
+ observed_values[dial.bone] = local[0].value;
705
+ const slider = (Array.isArray(input.rig.constraints) ? input.rig.constraints : []).filter(record).find(c => c.type === 'slider' && c.bone === dial.bone);
706
+ const times = frame.channels.filter(c => JSON.stringify(c.path) === JSON.stringify(['slider', slider?.name, 'mapped-time']));
707
+ if (times.length !== 1 || !Number.isFinite(times[0].value)) throw new Error(`turn ${pose.name}: slider on "${dial.bone}" has no finite mapped-time observation`);
708
+ slider_times[String(slider!.name)] = times[0].value;
709
+ }
710
+ poses.push({ ...pose, observed_values, slider_times });
711
+ return { ...frame, index, time: 0 };
712
+ });
713
+ const rest = poser.rest(undefined, [setup.attachments ?? [], ...frames.map(f => f.attachments ?? [])]);
714
+ return { poses, frames, setup, rest };
715
+ });
716
+ if (observed.poser !== acceptedPoser) throw new Error(`turn copy poser "${observed.poser}" differs from accepted "${acceptedPoser}"`);
717
+ const { poses, frames, setup, rest } = observed.value;
718
+ const sources = sourceProblems(input.rig, [setup, ...frames]);
719
+ if (sources.length > 0) throw new Error(sources.join('; '));
720
+ const pairs = input.pairs.filter(p => p.unread === undefined);
721
+ const stock = seamsOf(pairs, rest, frames.map(f => ({ ...f, attachments: f.attachments ?? [] })), candidate.pages, {},
722
+ { cells: setupCellReader(() => setup.pieces, candidate.pages) }).map((read, i) => ({ pair: pairs[i].pair,
723
+ frames: frames.length, drawn: read.drawn, banded: read.banded,
724
+ gapCovered: read.gapCovered.frames.map(hit => ({ index: hit.index, time: hit.time, cell: hit.cell, cells: hit.cells ?? [] })) }));
725
+ return { poses, frames, setup, rest, stock, sourceSkeletonSha256: empty.sourceSkeletonSha256, poser: observed.poser };
726
+ } catch (e) { return { ...empty, reason: `official turn copy unread: ${e instanceof Error ? e.message : String(e)}` }; }
727
+ }
728
+
492
729
  function jsonAt(path: string): Record<string, unknown> {
493
730
  const value: unknown = JSON.parse(readFileSync(path, 'utf8'));
494
731
  if (!record(value)) throw new Error('required sidecar is not an object');
@@ -555,7 +792,14 @@ function sourceProblems(rig: Record<string, unknown>, frames: readonly Frame[]):
555
792
  export function measureBehindSeams(api: typeof import('@rig-c/core/render-shared'), input: BehindSeamsInput, declared: BehindSeams, problems: Problem[]): BehindSeamsMeasured {
556
793
  const empty: BehindSeamsFramesInput = { pairs: input.pairs, setup: null, idle: [], rest: [], pages: new Map(), stock: null, fps: input.fps };
557
794
  const active = declared.threshold !== undefined || declared.pairs?.some(p => p.threshold !== undefined) === true;
558
- if (!active) return measureBehindSeamFrames(api, empty, declared, problems);
795
+ if (!active) {
796
+ if (declared.turn === true) {
797
+ const plan = behindTurnPlan(input.rig);
798
+ empty.turn = { poses: plan.poses, frames: [], setup: null, rest: [], stock: null,
799
+ reason: plan.reason ?? 'no authored threshold T; turn samples are not measured, never a pass' };
800
+ }
801
+ return measureBehindSeamFrames(api, empty, declared, problems);
802
+ }
559
803
  const fail = (reason: string): BehindSeamsMeasured => {
560
804
  const line = measureBehindSeamFrames(api, empty, declared, problems);
561
805
  line.status = 'FAIL';
@@ -566,16 +810,19 @@ export function measureBehindSeams(api: typeof import('@rig-c/core/render-shared
566
810
  if (input.unsupported !== undefined) return fail(input.unsupported);
567
811
  let candidate: ReturnType<typeof api.loadCandidate>;
568
812
  let sampled: { setup: Frame | null; idle: Frame[]; rest: AttachmentRest[] };
813
+ let acceptedPoser: string;
569
814
  try {
570
815
  const skeleton = join(input.build, 'skeleton.json'), atlas = join(input.build, 'skeleton.atlas');
571
816
  candidate = api.loadCandidate({ skeletonText: readFileSync(skeleton, 'utf8'), atlasText: readFileSync(atlas, 'utf8'), atlasDir: input.build, label: 'behind-part seams' }, { skeleton, atlas }, undefined);
572
- sampled = api.throughPoser(candidate.choice, p => {
817
+ const observed = api.throughPoser(candidate.choice, p => {
573
818
  const opts = { geometry: true, texture: true };
574
819
  const setup = api.sampleSetupPose(p, opts)[0] ?? null;
575
820
  const idle = p.animations.some(a => a.name === 'idle') ? api.sampleAnimation(p, 'idle', input.fps, opts) : [];
576
821
  const rest = p.rest(undefined, [...(setup?.attachments === undefined ? [] : [setup.attachments]), ...idle.map(f => f.attachments ?? [])]);
577
822
  return { setup, idle, rest };
578
- }).value;
823
+ });
824
+ sampled = observed.value;
825
+ acceptedPoser = observed.poser;
579
826
  const sources = sourceProblems(input.rig, [...(sampled.setup === null ? [] : [sampled.setup]), ...sampled.idle]);
580
827
  if (sources.length > 0) return fail(sources.join('; '));
581
828
  } catch (e) { return fail(`official renderer/source unavailable: ${e instanceof Error ? e.message : String(e)}`); }
@@ -584,7 +831,8 @@ export function measureBehindSeams(api: typeof import('@rig-c/core/render-shared
584
831
  if (input.stockDir === null || sampled.setup === null) throw new Error('existing full stock seam render/setup is unavailable');
585
832
  stock = stockOf(input.stockDir, input.pairs.filter(p => p.unread === undefined), input.fps, sampled.setup, sampled.idle, sampled.rest);
586
833
  } catch (e) { stockError = e instanceof Error ? e.message : String(e); }
587
- const line = measureBehindSeamFrames(api, { ...sampled, pairs: input.pairs, pages: candidate.pages, stock, fps: input.fps }, declared, problems);
834
+ const line = measureBehindSeamFrames(api, { ...sampled, pairs: input.pairs, pages: candidate.pages, stock, fps: input.fps,
835
+ ...(declared.turn === true ? { turn: sampleBehindTurn(api, input, candidate, sampled.setup, acceptedPoser) } : {}) }, declared, problems);
588
836
  if (stockError !== null) {
589
837
  line.status = 'FAIL';
590
838
  line.unmeasured.push({ ...checkRow('BEHIND_PART_SEAMS.unmeasured', 'rig', true, []), pair: null, frame: 'stock render', reason: `HOLE: ${stockError}` });
@@ -607,6 +855,11 @@ export function behindSeamLines(line: BehindSeamsMeasured | null): string[] {
607
855
  const setupStanding = setup === null ? '' : setup.standing.px > 0 && setup.standing.status === 'SKIP' ? `${setup.standing.px} cells` : `${setup.standing.status}, ${setup.standing.px} cells`;
608
856
  return [summary('motion_opened'), summary('standing'), `${BEHIND_SEAM_LINE}: pair "${p.pair}" setup ${setup === null ? 'SKIP — HOLE: setup not read' : `standing ${setupStanding}; motion_opened ${setup.motion_opened.status}, ${setup.motion_opened.px} cells; behind [${setup.behind_slots.join(', ')}]`}`];
609
857
  }),
858
+ ...(line.turn === undefined ? [] : [
859
+ `${BEHIND_SEAM_LINE}: turn ${line.turn.status} — ${line.turn.poses.length} preselected endpoint/corner pose(s); ${line.turn.limitations}`,
860
+ ...line.turn.pairs.flatMap(p => p.frames.map(f => `${BEHIND_SEAM_LINE}: pair "${p.pair}" turn ${f.pose} — motion_opened ${f.motion_opened.status}, ${f.motion_opened.px} cells; standing ${f.standing.status}, ${f.standing.px} cells; threshold ${p.threshold}, allowance ${p.allowance}`)),
861
+ ...line.turn.unmeasured.map(u => `${BEHIND_SEAM_LINE}: ${u.pair === null ? 'rig' : `pair "${u.pair}"`} ${u.frame} SKIP — ${u.reason}`),
862
+ ]),
610
863
  ...line.unmeasured.map(u => {
611
864
  const target = u.pair === null ? 'rig' : `pair "${u.pair}"`;
612
865
  const pair = u.pair === null ? undefined : line.pairs.find(p => p.pair === u.pair);
package/src/check.ts CHANGED
@@ -8,7 +8,7 @@ import { readMaterialSources } from './cutmaterialio.ts';
8
8
  import { CUT_MATERIAL_LINE, checkJointMaterial, type MaterialLine } from './cutmaterial.ts';
9
9
  import { ART_JOINT_LINE, artJointLine, type ArtJointLine } from './artjoints.ts';
10
10
  import { BOUNDARY_COLOUR_LINE, BOUNDARY_COLOUR_UNMEASURED_CODE, BOUNDARY_COLOUR_UNMEASURED_SUFFIX, measureBoundaryColour, type BoundaryColourMeasured } from './boundarycolour.ts';
11
- import { BEHIND_SEAM_LINE, measureBehindSeams, type BehindSeamsMeasured } from './behindseams.ts';
11
+ import { BEHIND_SEAM_LINE, behindTurnAnimations, measureBehindSeams, type BehindSeamsMeasured } from './behindseams.ts';
12
12
  import { baseAnchorMoves, type AnchorRegion } from './baseanchor.ts';
13
13
  /**
14
14
  * The check stage: build a rig through rig-c, gate it under both
@@ -7477,10 +7477,46 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
7477
7477
  ...(set === undefined ? [] : ['--set skin binding is not measured']),
7478
7478
  ...(allSets ? ['--all-sets skin binding is not measured'] : []),
7479
7479
  ];
7480
- const behindSeams = behindDeclared === undefined ? null : measureBehindSeams(officialRenderer(), {
7481
- build: buildDir, rig: inp.rig, pairs: behindPairs, stockDir: behindStockDir, fps: IDLE_FPS,
7482
- ...(behindUnsupported.length === 0 ? {} : { unsupported: behindUnsupported.join('; ') }),
7483
- }, behindDeclared, problems);
7480
+ let behindSeams: BehindSeamsMeasured | null = null;
7481
+ if (behindDeclared !== undefined) {
7482
+ const turnDir = join(out, '_behind_seams_turn');
7483
+ let turnScratch = false;
7484
+ let turnBuild: { build?: string; reason?: string } | undefined;
7485
+ try {
7486
+ const active = behindDeclared.threshold !== undefined || behindDeclared.pairs?.some(p => p.threshold !== undefined) === true;
7487
+ if (behindDeclared.turn === true && active && behindUnsupported.length === 0) {
7488
+ const animations = behindTurnAnimations(inp.rig);
7489
+ if (Object.keys(animations).length > 0) {
7490
+ const original = inp.motion.animations;
7491
+ if (original === null || typeof original !== 'object' || Array.isArray(original)) turnBuild = { reason: 'turn copy requires the accepted motion animation record' };
7492
+ else if (Object.keys(animations).some(name => Object.hasOwn(original, name))) turnBuild = { reason: 'turn sample animation name collides with an accepted animation; no animation is replaced' };
7493
+ else {
7494
+ try {
7495
+ turnScratch = true;
7496
+ rmSync(turnDir, { recursive: true, force: true });
7497
+ mkdirSync(turnDir, { recursive: true });
7498
+ const images = typeof inp.rig.images === 'string' ? resolve(inp.rigDir, inp.rig.images) : inp.rig.images;
7499
+ // Keep setup, constraints and sliders; append only the pose timelines.
7500
+ writeFileSync(join(turnDir, 'rig.json'), JSON.stringify({ ...inp.rig, images }));
7501
+ writeFileSync(join(turnDir, 'motion.json'), JSON.stringify({ ...inp.motion, animations: { ...original, ...animations } }));
7502
+ const build = join(turnDir, 'build');
7503
+ const built = rigc(['build', '--rig', join(turnDir, 'rig.json'), '--motion', join(turnDir, 'motion.json'), '--out', build, ...packedBuildArgs(mode)]);
7504
+ const errors = buildGateLines(built.out).filter(line => line.includes('FAIL') || line.includes('compile error'));
7505
+ const detail = (errors.length > 0 ? errors.join('; ') : built.out.trim() || 'no gate diagnostic returned').slice(0, 1200);
7506
+ turnBuild = built.status === 0 ? { build } : { reason: `gated turn copy build refused (exit ${built.status}): ${detail}; no turn sample is available` };
7507
+ } catch (e) { turnBuild = { reason: `gated turn copy unavailable: ${e instanceof Error ? e.message : String(e)}` }; }
7508
+ }
7509
+ }
7510
+ }
7511
+ behindSeams = measureBehindSeams(officialRenderer(), {
7512
+ build: buildDir, rig: inp.rig, pairs: behindPairs, stockDir: behindStockDir, fps: IDLE_FPS,
7513
+ ...(turnBuild === undefined ? {} : { turnBuild }),
7514
+ ...(behindUnsupported.length === 0 ? {} : { unsupported: behindUnsupported.join('; ') }),
7515
+ }, behindDeclared, problems);
7516
+ } finally {
7517
+ if (turnScratch) rmSync(turnDir, { recursive: true, force: true });
7518
+ }
7519
+ }
7484
7520
 
7485
7521
  // 5. the scene's declared requirements (issue #93), only under --requirements
7486
7522
  const reqProblems: Problem[] = [];
package/src/checkrow.ts CHANGED
@@ -9,14 +9,21 @@ export const CHECK_ROW_PATHS = {
9
9
  'ART_JOINT_DISTANCE.joints': ['ART_JOINT_DISTANCE.joints'],
10
10
  'BOUNDARY_COLOUR_STEP.over': ['BOUNDARY_COLOUR_STEP.over'],
11
11
  'BOUNDARY_COLOUR_STEP.unmeasured': ['BOUNDARY_COLOUR_STEP.unmeasured'],
12
+ 'BEHIND_PART_SEAMS.turn.pairs': ['BEHIND_PART_SEAMS.turn.pairs'],
13
+ 'BEHIND_PART_SEAMS.turn.pairs[].frames': ['BEHIND_PART_SEAMS.turn.pairs[].frames'],
14
+ 'BEHIND_PART_SEAMS.turn.unmeasured': ['BEHIND_PART_SEAMS.turn.unmeasured'],
12
15
  'BEHIND_PART_SEAMS.pairs': ['BEHIND_PART_SEAMS.pairs'],
13
16
  'BEHIND_PART_SEAMS.pairs[].setup': ['BEHIND_PART_SEAMS.pairs[].setup'],
14
17
  'BEHIND_PART_SEAMS.pairs[].frames': ['BEHIND_PART_SEAMS.pairs[].frames'],
15
18
  'BEHIND_PART_SEAMS.samples': [
19
+ 'BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.samples',
20
+ 'BEHIND_PART_SEAMS.turn.pairs[].frames[].motion_opened.samples',
16
21
  'BEHIND_PART_SEAMS.pairs[].setup.motion_opened.samples', 'BEHIND_PART_SEAMS.pairs[].setup.standing.samples',
17
22
  'BEHIND_PART_SEAMS.pairs[].frames[].motion_opened.samples', 'BEHIND_PART_SEAMS.pairs[].frames[].standing.samples',
18
23
  ],
19
24
  'BEHIND_PART_SEAMS.contributors': [
25
+ 'BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.samples[].contributors',
26
+ 'BEHIND_PART_SEAMS.turn.pairs[].frames[].motion_opened.samples[].contributors',
20
27
  'BEHIND_PART_SEAMS.pairs[].setup.motion_opened.samples[].contributors', 'BEHIND_PART_SEAMS.pairs[].setup.standing.samples[].contributors',
21
28
  'BEHIND_PART_SEAMS.pairs[].frames[].motion_opened.samples[].contributors', 'BEHIND_PART_SEAMS.pairs[].frames[].standing.samples[].contributors',
22
29
  ],
@@ -26,6 +33,7 @@ export const CHECK_ROW_PATHS = {
26
33
  ],
27
34
  'BEHIND_PART_SEAMS.spans': ['BEHIND_PART_SEAMS.pairs[].motion_opened.spans', 'BEHIND_PART_SEAMS.pairs[].standing.spans'],
28
35
  'BEHIND_PART_SEAMS.unread_corridors': [
36
+ 'BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.unread_corridors',
29
37
  'BEHIND_PART_SEAMS.pairs[].setup.standing.unread_corridors',
30
38
  'BEHIND_PART_SEAMS.pairs[].frames[].standing.unread_corridors',
31
39
  ],
package/src/turn.ts CHANGED
@@ -1624,6 +1624,11 @@ function buildDepth25DTurnGroup(
1624
1624
  if (problems.length > startProblems) return;
1625
1625
 
1626
1626
  const primarySurface = (group.useEyeLandmarksForZRef ? surfaceSheets.get('face') : undefined) ?? [...surfaceSheets.values()][0];
1627
+ // Units already use this anchor. Surfaces must share it too: subtracting
1628
+ // each sheet's own eye sample or median erases their relative placement.
1629
+ if (primarySurface !== undefined) {
1630
+ for (const sheet of surfaceSheets.values()) sheet.zRef = primarySurface.zRef;
1631
+ }
1627
1632
  const pivot = pyRound(group.pivot, 4);
1628
1633
  const counter = group.counter;
1629
1634
  const rearDepth = pyRound(-counter * pivot, 4);