rig-parts 1.45.0 → 1.46.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/cli.ts CHANGED
@@ -1292,7 +1292,7 @@ function cmdPropose(args: string[]): number {
1292
1292
  const prop =
1293
1293
  fullRun === undefined && headRun === undefined
1294
1294
  ? drafted
1295
- : withTurn(drafted, draftTurn(P, { ...(fullRun === undefined ? {} : { full: readLayers(fullRun) }), ...(headRun === undefined ? {} : { head: readLayers(headRun) }) }));
1295
+ : withTurn(drafted, draftTurn(P, { ...(fullRun === undefined ? {} : { full: readLayers(fullRun) }), ...(headRun === undefined ? {} : { head: readLayers(headRun) }) }, drafted));
1296
1296
  // Emit only after green: a proposal the config loader would refuse is not written, nor a basis record that does not hold to it.
1297
1297
  checkProposal(P, prop);
1298
1298
  const bfile = basisFile(P, prop, basis, cfg === null || cmpPath === undefined ? null : { where: cmpPath, config: cfg });
package/docs/AUTHORING.md CHANGED
@@ -126,7 +126,7 @@ read by no CPU stage).
126
126
  | `motion.animations_from` | rig; check (named; read for folds) | optional, never proposed (issue #183): a path, relative to the config file's directory, to a file in rig-c's motion-spec shape, `{"spec": "rigc-motion/1", "animations": {"<name>": {"duration": …, "tracks": [...]}, …}}` — an expression, a gesture, anything beside the idle. On every `rig` and `build` each of its animations is written into `rig/motion.json` after `idle`, as read: nothing added, re-keyed or judged here (except `derive` keys on `turn`/`tilt`, issue #436, and `{"t": …, "set": "<name>" \| null}` keys on slot `"attachment"` tracks, issue #473, which expand to `"v": "<set>_<slot>"` or `"v": null` when the set hides the slot, or `"v": "<slot>"` for `null`, refused with `CONFIG_SET_COVERS_SLOT` when the set is undeclared or does not cover the track's slot), and each is rigc's to accept or refuse at the rig stage's gate, in rigc's words. It may name what `motion.json` already holds — the bones `bones` declares, the easings `shut` and `open`, the groups `eyes` and `brows` when the blink writes them — and nothing else from the file reaches it. The loader refuses, every problem at once: no such file or one that cannot be read (`CONFIG_FILE_PRESENT`), text that is not JSON (`CONFIG_IS_JSON`), a file that is not an object, a `spec` other than `"rigc-motion/1"`, an `animations` that is not a table of objects (`CONFIG_FIELD_TYPE`), any other key — rig-c's `easings`, `groups`, `setup`, `physics`, `mix`, `archetype` and `cut` included, which would be read and not written (`CONFIG_KEY_KNOWN`), an animation named `idle` (`CONFIG_ANIMATION_NAME_FREE`), and a key written twice in one object of the file, which JSON would fold into its last value without a word (`CONFIG_KEY_UNIQUE`). `check` names the others on one line (`beside the idle: …`) and reads each for folds, with the idle — `ANIMATIONS_DO_NOT_FOLD` (§7, issues #320, #333); every other bar reads the idle. Absent, `motion.json` holds the idle alone, byte for byte as before, and `check` reads that idle for folds |
127
127
  | `constraints` | rig (handed to rig-c as `rig.json`'s `constraints`); `compare` and the coverage lines (roles) | **authored**, optional; `propose` writes none, but with `--cloth` (issue #364), where it writes the recipe's physics and swing transforms (*Recipe: cloth and hair that answer the world*, below). A list of constraints in **rig-c's own rig-spec shape** (`RigConstraint`: `ik`, `transform`, `path`, `physics`, `slider` — rig-c's `src/rig.ts` documents every field), in the order rigc applies them. The loader checks only what this package owns: each entry is an object with a `type` rigc names (`CONFIG_CONSTRAINT_TYPE_KNOWN`) and a non-empty `name`, unique within its kind as rigc finds constraints (`CONFIG_CONSTRAINT_NAME_UNIQUE`; an ik and a transform may share one); every bone it names — `bones`, an ik's `target`, a transform's `source`, a physics or slider constraint's `bone` — is a bone `bones` declares, a chain link as `<chain><i>` (`CONFIG_NAME_RESOLVES`); the bone a constraint follows does not sit under a bone it drives (`CONFIG_CONSTRAINT_TARGET_DETACHED`). Every other field (`mix`, `softness`, `properties`, a path's `slot`, a slider's `animation`) and every value is rigc's to accept or refuse at the rig stage's gate, in rigc's words (`RIG_RIGC_GREEN`) — an ik's `bones` as a shape too: from rig-c 2.15.0 rigc refuses an ik over more than two bones, or over a pair whose second bone is not the first's child (issue #103; this loader refused both itself until then). A note and an `x-` record may ride on an entry; the rig stage leaves them out of what it hands rigc. Under the default `--idle-keys ctl` a two-bone ik whose child link the idle keys is split by that link's control, and rigc refuses the pair: run `rig --idle-keys direct` or `build --idle-keys direct` (the rig stage adds that sentence, naming the flag on the command that ran, to rigc's line; `build` forwards it to its rig stage, issue #95). Each bone a constraint follows is declared to rigc as `invariants.detached` from every bone it drives, which rigc's gate rule `A25` checks |
128
128
  | `stops` | rig (handed to rig-c as `rig.json`'s `stops`, and moves slots, mesh weights and child bones on stopped links onto `<link>_d`); `propose --from-config` (`LINT stop on <chain> …`) | **authored**, optional (issues #404, #447): `[{chain, links?, against, at, inward, outward, lower?: {inward, outward}}]` — rig-c's leg stops (`RigStop`, rig-c 2.56.0, `rig-c/src/stop.ts`). `chain` is a chain `bones` declares (`CONFIG_NAME_RESOLVES`, `RIG_NAME_RESOLVES`); `links`, optional, is a non-empty list of links of that chain (`CONFIG_NAME_RESOLVES`, `CONFIG_FIELD_TYPE`), or absent for every link of `chain` in chain order; `against` is a bone `bones` declares, a chain link as `<chain><i>` (`CONFIG_NAME_RESOLVES`, `RIG_NAME_RESOLVES`); `at` is `[x, y]` in `against`'s local space, as rig-c's stop takes it (`CONFIG_FIELD_TYPE`): since each chain link (`leg_r0`, `leg_r1`) is turned to point along its segment (`+x` from origin to next link or tip, `+y` 90° counter-clockwise in Spine world), `at: [d, n]` sits `d` px from `against`'s origin toward its end and `n` px perpendicular to it; `inward`, `outward` and `lower.inward`, `lower.outward` are finite numbers (`CONFIG_FIELD_TYPE`). Every other stop rule — non-negative bounds, each stopped link written by a constraint, `against` not under the stopped chain, the aim not degenerate, `\|rest\| + outward <= 180°` (`RIG_STOP_BOUNDS`) — is rigc's to accept or refuse at the rig stage's gate, in rigc's words (`RIG_RIGC_GREEN`). **Rising-limb / prone geometry (issue #447):** rig-c's `expandStops` aims `<chain>_rest` from `links[0]`'s setup origin at `<chain>_touch` (`at` in `against`'s local frame) and clamps `<link>_d` inside `[rest − inward, rest + outward]`; Spine wraps rotation at `±180°`, so `\|rest\| + outward <= 180°` is required (`RIG_STOP_BOUNDS`). Whenever `<chain>_touch` lies **above** `links[0]`'s root in rig pixels (`ty < y0`, i.e. higher Spine `y` — e.g. stopping a hanging cloth chain against a rising shin `leg_<s1>` in a prone or kneeling pose where the knee sits below `links[0]` and the ankle above it, so positive `at[0]` walks upward along the shin past `links[0]`'s root), `rest` lands in the upper half-plane (`\|rest\| > 90°`) and `\|rest\| + outward` exceeds `180°`. Stop against the descending thigh (`leg_<s0>`), set `links` to start at a link whose root sits above `<chain>_touch`, or omit the stop when the rising shin sits outside the hanging chain's sweep; `propose --from-config` prints `LINT stop on <chain> …` with the exact coordinates and angles when `<chain>_touch` lies above `links[0]`'s root or `\|rest\| + outward > 180°`. For every stopped link `<link>`, the rig stage moves any slot on `<link>`, any mesh weight on `<link>`, and any bone whose parent is `<link>` (a branched cloth tree's branches hanging from `<trunk_last>`, before `--idle-keys ctl` adds `<bone>_ctl` and before `turn` adds `turn_<part>_<bone>`) onto `<link>_d`, the drawn link bone rig-c's `expandStops` creates at `<link>`'s setup frame to carry the clamped rotation. Absent, `rig.json` carries no `stops` and no byte of any output moves |
129
- | `turn` | rig (adds the turn control) | **proposed** only with `propose --full`/`--head` (issue #251), then corrected: `{pivot, depths, deform?, band?, radius?, surface?: {radius?}, head?: {pivot?, radius?}}`. `depths` holds, per part, the See-through layer's `depth_median` the part came from (larger = further back), read from the run the part was assembled from; a `painting:` patch has none and is not carried. A rider (issue #271) — a part from an `eyewhite`, `irides`, `eyelash`, `eyebrow`, `nose` or `mouth` layer — is drafted at the `face` part's depth, 0.001 nearer when parts.json draws it after the face and 0.001 further when before: See-through makes no depth of its own for the eye group (it cuts them from one depth map of the combined eyes) and clamps nose and mouth to the face's median − 0.001, and the two runs' own medians for these layers disagreed by up to 0.47 and swapped their order against the face. Every other layer — ears, headwear and earwear included — keeps its own median. With no `face` part, or more than one, the riders keep their own and a note says so. One note lists each part's depth and where it came from; a carrier the other run places more than 10 % of `pivot − nearest` away gets a note naming both values and the run read — the two runs are not reconciled. `pivot` is the depth that stays put; `propose` drafts the mean of the parts' depths weighted by `opaque_px`, the one depth at which the painted pixels' centroid does not slide under the dial. The rig stage adds a bone `turn` under `root` at its origin that nothing keys — its local x is the dial, in rig px — and carries each part by `(pivot − depth) / (pivot − nearest depth)` of it: the nearest part all of it, a part behind the pivot the other way, a part at the pivot not at all. Each part rides leaf twins (`turn_<part>_<bone>`, an identity child of every bone its slot and weights bind) moved by one `transform` constraint (`turn_<part>`, after the config's own); the idle's keys, the `<bone>_ctl` controls and a physics constraint stay on the bones, and the dial moves none of them. Optional `deform` (`Partial<FaceDeformFractions>`, issue #436) overrides the Set B ×2.5 face surface deformation table (`FACE_DEFORM_FRACTIONS`, checked against `FACE_DEFORM_RANGES` by `CONFIG_TURN_DEFORM_RANGE`); when `applyFaceSurfaceDeform` runs on a rig whose `motion` carries `tilt` or `turn` slider `derive` keys, it requires `config.turn` (`CONFIG_TURN_REQUIRED`, issue #478; `propose --full`/`--head` drafts it), promotes `face` on `head` (or `turn_face_head` when `turn` is declared) to the uneven 5×5 grid mesh, keys `face`, `hair_front` and `hair_back` deform timelines and ear/topknot tracks from `evalPitchFaceSurface` and `evalYawFaceSurface`, and samples the same deform field across each `features` member's rest span (`featRx = (24 / 106) · W`, `featRy = (12 / 128) · H`) with its depth fraction `z / zRef` as the field's angle input and chord foreshortening (`scalex` narrowing on the leading side and widening on the trailing side, `scaley` on pitch) so every feature's bounding box stays inside the deformed face plate across the rated band (issue #468). On yaw (`issue #479`), `evalYawFaceSurface` evaluates a **cylinder projection** (`cylinderYawDx`: `Δx(x, θ, R) = R · (sin(clamp(arcsin(clamp(x / R, −1, 1)) − θ, −π/2, π/2)) − clamp(x / R, −1, 1))`) of radius `R` (`turnSurfaceRadius`: `turn.surface.radius ?? turn.radius ?? turn.head.radius`, positive rig px checked by `CONFIG_FIELD_TYPE`, defaulting to half the face plate's opaque width `W / 2`) tapered by a cubic Hermite outline weight (`wOutline = 1` for `\|ux\| <= 0.7`, reaching `0` at `\|ux\| = 1.0`) so features slide across a fixed outline (`iris` shift within `±2%` of `cylinderYawDx`), the trailing cheek strip widens (`>= 1.54×` at `±15°`), and the leading jaw edge holds fixed (`0 px` shift) unless explicit horizontal `turn.deform` overrides (`turn_mid_x`, `turn_lead_compress_x`, `turn_trail_shift_x`) request the flat yaw table. On yaw (`issue #478`), `applyFaceSurfaceDeform` also derives a **head-only pivot** (`headTurnPivot`: `turn.head.pivot` when authored, otherwise the `opaque_px`-weighted mean of `depths[part]` across the head parts `DEFAULT_HEAD_TURN_PARTS` — `face`, `hair_front`, `hair_back`, `ear_r`, `ear_l`, `hairpin` — from `parts.json`, falling back to `turn.pivot`) so a forward torso or arm in `turn.depths` does not pull the head's rotation axis in front of `face`: `hair_back` (`depth_median > headPivot`, negative `headTurnFraction`) and `hairpin` behind `headPivot` translate opposite to the face's turn (`dx = s · turn_face_center_x · W · (headPivot − depth) / (headPivot − nearestHeadDepth)`), emerging on the trailing side to compensate for the leading-cheek foreshortening and keeping the combined head silhouette width near-constant across `±15°` without any same-sign `turn_hair_back_cheek_x` term. Optional `band` (`number` or `{yaw?, pitch?}`, positive degrees, issue #472) declares the rig's rated face turn band (default `FACE_RATED_BAND`: `yaw <= 15°`, `pitch <= 12°`); declaring a `turn.band` or a `motion.animations_from` `turn`/`tilt` `derive.degrees` above `±15°` yaw or `±12°` pitch without an `assemble.alternates` entry that replaces `face` is refused (`CONFIG_FACE_BAND_EXCEEDED`), and on a single-plate rig `applyFaceSurfaceDeform` adds self-targeting transform constraints `yaw_clamp` (`[-15, 15]`) and `pitch_clamp` (`[-12, 12]`) ahead of the slider constraints so driving `yaw` or `pitch` beyond the rated band clamps at the boundary. At rest: with `turn` declared, no pixel differs by more than 1 level at dial 0 (not byte-identical; the cause is float noise in the identity child bones, and the constraints add nothing); without `turn`, byte-identical. Neither `pivot` nor `depths` has a default (`CONFIG_FIELD_PRESENT`); `pivot` and `head.pivot` must lie behind the nearest part (`CONFIG_TURN_PIVOT_BEHIND_NEAREST`). Absent, no control is added and no byte of any output moves |
129
+ | `turn` | rig (adds the turn control) | **proposed** only with `propose --full`/`--head` (issue #251), then corrected: `{pivot, depths, deform?, band?, radius?, surface?: {radius?}, head?: {pivot?, radius?}}`. `depths` holds, per part, the See-through layer's `depth_median` the part came from (larger = further back), read from the run the part was assembled from; a `painting:` patch has none and is not carried. A rider (issue #271) — a part from an `eyewhite`, `irides`, `eyelash`, `eyebrow`, `nose` or `mouth` layer — is drafted at the `face` part's depth, 0.001 nearer when parts.json draws it after the face and 0.001 further when before: See-through makes no depth of its own for the eye group (it cuts them from one depth map of the combined eyes) and clamps nose and mouth to the face's median − 0.001, and the two runs' own medians for these layers disagreed by up to 0.47 and swapped their order against the face. Every other layer — ears, headwear and earwear included — keeps its own median, unless it rides another part's bone. With no `face` part, or more than one, the riders keep their own and a note says so. A rider by bone (issue #535) — a part every *ownable* bone of which (a chain link, or a bone no other bone hangs from; `head`, `chest` and any bone with a child are shared and never count on their own) is *hosted* by another carried part, the host of a bone being the carried part that binds it (its region's bone; a mesh's `segments`, `contour` and `auto` regions' bones) with the most `opaque_px`, the earlier in parts.json on a tie, and which hosts no bone itself — is drafted at its host's depth, 0.001 nearer when drawn after the host and 0.001 further when before, and a note names the host, the bones and its own median: a pin, clip or ornament on the back hair's links travels with the back hair, not with its own layer's depth. `propose` reads the proposal's own `bones`, `meshes` and `regions`; the face riders are read by their tag first and never by their bones. A part bound to two hosts' bones rides neither and a note says so. In the rig stage, an authored depth on a rider by bone whose fraction differs from its host's by more than 0.1 of the dial (`TURN_RIDER_APART`, a share of `pivot − nearest`) is refused (`CONFIG_TURN_RIDER_DEPTH`); the host is read off `parts.json`'s `opaque_px`, so the config loader cannot see it. One note lists each part's depth and where it came from; a carrier the other run places more than 10 % of `pivot − nearest` away gets a note naming both values and the run read — the two runs are not reconciled. `pivot` is the depth that stays put; `propose` drafts the mean of the parts' depths weighted by `opaque_px`, the one depth at which the painted pixels' centroid does not slide under the dial. The rig stage adds a bone `turn` under `root` at its origin that nothing keys — its local x is the dial, in rig px — and carries each part by `(pivot − depth) / (pivot − nearest depth)` of it: the nearest part all of it, a part behind the pivot the other way, a part at the pivot not at all. Each part rides leaf twins (`turn_<part>_<bone>`, an identity child of every bone its slot and weights bind) moved by one `transform` constraint (`turn_<part>`, after the config's own); the idle's keys, the `<bone>_ctl` controls and a physics constraint stay on the bones, and the dial moves none of them. Optional `deform` (`Partial<FaceDeformFractions>`, issue #436) overrides the Set B ×2.5 face surface deformation table (`FACE_DEFORM_FRACTIONS`, checked against `FACE_DEFORM_RANGES` by `CONFIG_TURN_DEFORM_RANGE`); when `applyFaceSurfaceDeform` runs on a rig whose `motion` carries `tilt` or `turn` slider `derive` keys, it requires `config.turn` (`CONFIG_TURN_REQUIRED`, issue #478; `propose --full`/`--head` drafts it), promotes `face` on `head` (or `turn_face_head` when `turn` is declared) to the uneven 5×5 grid mesh, keys `face`, `hair_front` and `hair_back` deform timelines and ear/topknot tracks from `evalPitchFaceSurface` and `evalYawFaceSurface`, and samples the same deform field across each `features` member's rest span (`featRx = (24 / 106) · W`, `featRy = (12 / 128) · H`) with its depth fraction `z / zRef` as the field's angle input and chord foreshortening (`scalex` narrowing on the leading side and widening on the trailing side, `scaley` on pitch) so every feature's bounding box stays inside the deformed face plate across the rated band (issue #468). On yaw (`issue #479`), `evalYawFaceSurface` evaluates a **cylinder projection** (`cylinderYawDx`: `Δx(x, θ, R) = R · (sin(clamp(arcsin(clamp(x / R, −1, 1)) − θ, −π/2, π/2)) − clamp(x / R, −1, 1))`) of radius `R` (`turnSurfaceRadius`: `turn.surface.radius ?? turn.radius ?? turn.head.radius`, positive rig px checked by `CONFIG_FIELD_TYPE`, defaulting to half the face plate's opaque width `W / 2`) tapered by a cubic Hermite outline weight (`wOutline = 1` for `\|ux\| <= 0.7`, reaching `0` at `\|ux\| = 1.0`) so features slide across a fixed outline (`iris` shift within `±2%` of `cylinderYawDx`), the trailing cheek strip widens (`>= 1.54×` at `±15°`), and the leading jaw edge holds fixed (`0 px` shift) unless explicit horizontal `turn.deform` overrides (`turn_mid_x`, `turn_lead_compress_x`, `turn_trail_shift_x`) request the flat yaw table. On yaw (`issue #478`), `applyFaceSurfaceDeform` also derives a **head-only pivot** (`headTurnPivot`: `turn.head.pivot` when authored, otherwise the `opaque_px`-weighted mean of `depths[part]` across the head parts `DEFAULT_HEAD_TURN_PARTS` — `face`, `hair_front`, `hair_back`, `ear_r`, `ear_l`, `hairpin` — from `parts.json`, falling back to `turn.pivot`) so a forward torso or arm in `turn.depths` does not pull the head's rotation axis in front of `face`: `hair_back` (`depth_median > headPivot`, negative `headTurnFraction`) and `hairpin` behind `headPivot` translate opposite to the face's turn (`dx = s · turn_face_center_x · W · (headPivot − depth) / (headPivot − nearestHeadDepth)`), emerging on the trailing side to compensate for the leading-cheek foreshortening and keeping the combined head silhouette width near-constant across `±15°` without any same-sign `turn_hair_back_cheek_x` term. Optional `band` (`number` or `{yaw?, pitch?}`, positive degrees, issue #472) declares the rig's rated face turn band (default `FACE_RATED_BAND`: `yaw <= 15°`, `pitch <= 12°`); declaring a `turn.band` or a `motion.animations_from` `turn`/`tilt` `derive.degrees` above `±15°` yaw or `±12°` pitch without an `assemble.alternates` entry that replaces `face` is refused (`CONFIG_FACE_BAND_EXCEEDED`), and on a single-plate rig `applyFaceSurfaceDeform` adds self-targeting transform constraints `yaw_clamp` (`[-15, 15]`) and `pitch_clamp` (`[-12, 12]`) ahead of the slider constraints so driving `yaw` or `pitch` beyond the rated band clamps at the boundary. At rest: with `turn` declared, no pixel differs by more than 1 level at dial 0 (not byte-identical; the cause is float noise in the identity child bones, and the constraints add nothing); without `turn`, byte-identical. Neither `pivot` nor `depths` has a default (`CONFIG_FIELD_PRESENT`); `pivot` and `head.pivot` must lie behind the nearest part (`CONFIG_TURN_PIVOT_BEHIND_NEAREST`). Absent, no control is added and no byte of any output moves |
130
130
  | `scene` | assemble (the recomposite, its holes and the figure's mask); check, through `parts.json`'s `scene` block (`RECOMPOSITE_HOLES`, the seam) | **authored**, optional; `propose` writes none (issue #242). `{}` declares the painting a scene: the figure and its surroundings in one image, See-through's full run holding only the figure. With it, `assemble` reads the recomposite figures, the hole list and the `uncovered:` lines inside the figure — the rig pixels where any full-run layer's alpha is above 8 (`OPAQUE_ALPHA_ABOVE`, the cut every layer's painted pixels are read by) — each line starting `inside the figure (config.scene: …, <n> of <m> rig px)`; writes that figure as `figure_rig.png` (white on black) beside the recomposite, and a `scene` block in `parts.json`; flags error pixels on the error map inside it only (outside, the painting grey); and `check` leaves out of the seam every frame pixel whose composite sample reaches the painting's outermost row or column, saying how many (`seam_border` in `check.json`, and on the seam line). It takes no field: the figure and its threshold are derived. A key in it other than a record or an annotation is `CONFIG_KEY_KNOWN`. Absent, no byte of any output moves |
131
131
  | `cloth` | `propose --cloth` only; no other stage reads it, so it moves no byte of any build | **authored**, optional (issue #364): one recipe per tag, `{"bottomwear": {…}, "back hair": {…}, "front hair": {…}}`, each `{chains, links, wind, gravity, split?, length_ratio?, strength?, damping?, alternate_damping?, translate?, swing?, part?, influence?}`. `influence` (issue #518) — `{across, max, shape, radius?}`: the parts this recipe meshes are drafted in the influence mode (`meshes.<part>.influence` above) at their lattice's cell, with `across`, `max` and `shape` as declared (each required — the reading behind the radius did not vary them) and `radius` as declared or, absent, drafted as the farthest vertex's distance plus 3 cells (the `influence.radius` row); without it the parts keep their lattice. `chains` — trees across the piece (for `back hair`, per side of the eye axis), a whole number, 1 or more; `links` — links from root to tip on every path, 1 or more; `split` — `{at, into}`: the first `at` links are the trunk, which forks into `into` (2 or more) branches; `at` below `links` (`CONFIG_CLOTH_SPLIT_BEFORE_TIP`); `length_ratio` — a path's last link over its first, above 0, default 0.5; `strength` — `{trunk, branch, edge}`, each above 0 and below the spring's stability bound (`CONFIG_CLOTH_SPRING_STABLE`), default 100 / 100 / 50; `damping` — in [0, 1], absent: rig-c's default; `alternate_damping` — the odd trees' damping, in [0, 1], beside `damping` and different from it (`CONFIG_CLOTH_ALTERNATE_DIFFERS`); `wind`, `gravity` — `[root, tip]`, each 0 or more, tip at or above root (`CONFIG_CLOTH_RESPONSE_GROWS_TO_TIP`); `translate` — the x and y mix of a dangling end's flutter, above 0 and at most 1; `swing` — `bottomwear` only, `{scales}`, one positive scale per tree (`CONFIG_CLOTH_SWING_SCALE_PER_TREE`); `part` — `bottomwear` only (`CONFIG_CLOTH_PART_ON_BOTTOMWEAR`), a non-empty part or cut-piece name: the `topwear` part that holds a skirt See-through returned inside it (a dress), or its skirt piece cut by `assemble.cuts`, which takes the skirt's trees (issue #402, *A skirt inside topwear* below; the part is checked by `propose`, `PROPOSE_CLOTH_PART`). The two defaults are the recipe's own, measured on its synthetic fixture (the recipe below). The recipe below says what each field drafts |
132
132
  | `proposed_rig_scale` | assemble, rig, build, `propose --from-config`/`--compare` | **proposed** by `propose` (issue #354): `parts.json`'s `scale_rig_per_source`, the `assemble.rig_scale` the rig sections (`bones`, `meshes`, `limbs`, `motion`) were drafted at. Held equal to `assemble.rig_scale` when present (`CONFIG_PROPOSED_RIG_SCALE`; 0, negative or not a number: `CONFIG_FIELD_TYPE`). Absent on a hand-authored config, where no byte of any output moves |
@@ -2744,6 +2744,7 @@ See-through with another seed.
2744
2744
  | <a id="CONFIG_CONSTRAINT_NAME_UNIQUE"></a>`CONFIG_CONSTRAINT_NAME_UNIQUE` | two `constraints` entries of one kind share a `name`; rigc finds a constraint by its kind and its name, so an ik and a transform may share one | rename one |
2745
2745
  | <a id="CONFIG_CONSTRAINT_TARGET_DETACHED"></a>`CONFIG_CONSTRAINT_TARGET_DETACHED` | the bone an ik follows (`target`) or a transform reads (`source`) is one of the bones that constraint drives, or sits under one (the detail gives the line of parents) — driving them would move what they follow. This package's refusal: rig-c 2.15.0 gates such a rig green when nothing declares the parentage (measured on the selftest's rig fixture, issue #103) | a bone beside the chain; a scene target is a single bone parented to `root` (§3) |
2746
2746
  | <a id="CONFIG_TURN_PIVOT_BEHIND_NEAREST"></a>`CONFIG_TURN_PIVOT_BEHIND_NEAREST` | `turn.pivot` is at or in front of the nearest part's depth: the law `(pivot − depth) / (pivot − nearest)` has no value there, and in front of it every part travels against the dial | a pivot above the smallest depth in `turn.depths` |
2747
+ | <a id="CONFIG_TURN_RIDER_DEPTH"></a>`CONFIG_TURN_RIDER_DEPTH` | the rig stage, with `turn`: a part that rides another part's bone (issue #535 — every ownable bone it binds is hosted by one other carried part, the one binding it with the most `opaque_px`) has a `turn.depths` entry whose fraction `(pivot − depth) / (pivot − nearest)` differs from its host's by more than `TURN_RIDER_APART` (0.1) of the dial, so the turn would move it off what it is pinned to; the detail names the part, its host, the bones, both depths, both fractions, the difference and the bound | the host's depth − 0.001 when parts.json draws the part after its host (+ 0.001 when before), or redraft the turn with `propose --full`/`--head` |
2747
2748
  | <a id="CONFIG_CLOTH_SPLIT_BEFORE_TIP"></a>`CONFIG_CLOTH_SPLIT_BEFORE_TIP` | a `cloth` recipe's `split.at` is at or past its `links`: the trunk would leave no link for the branches (issue #364) | `split.at` below `links`, or leave `split` out |
2748
2749
  | <a id="CONFIG_CLOTH_RESPONSE_GROWS_TO_TIP"></a>`CONFIG_CLOTH_RESPONSE_GROWS_TO_TIP` | a `cloth` recipe's `wind` or `gravity` is `[root, tip]` with tip below root: the response grows from the root to the tip, where the motion accumulates down the chain | that pair |
2749
2750
  | <a id="CONFIG_CLOTH_ALTERNATE_DIFFERS"></a>`CONFIG_CLOTH_ALTERNATE_DIFFERS` | a `cloth` recipe's `alternate_damping` without `damping`, or equal to it: neighbouring trees are declared out of phase, and an alternate that alternates nothing declares nothing | `damping` beside it, a different value, or leave `alternate_damping` out |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rig-parts",
3
- "version": "1.45.0",
3
+ "version": "1.46.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": {
package/src/config.ts CHANGED
@@ -683,6 +683,95 @@ export function weightsABone(rg: AutoRegionSpec): rg is AutoWeightRegionSpec {
683
683
  return 'bone' in rg;
684
684
  }
685
685
 
686
+ /** The three sections a part's bones are read from: a config's, or a proposal's, which has the same shape (issue #535). */
687
+ export interface PartBinding {
688
+ bones: readonly BoneEntry[];
689
+ meshes: Readonly<Record<string, MeshSpec>>;
690
+ regions: Readonly<Record<string, string>>;
691
+ }
692
+
693
+ /**
694
+ * The bones each part binds (issue #535): a region's `regions.<part>`; for a
695
+ * mesh, every bone its `segments` name (a chain's name standing for each of
696
+ * its links `<chain>0`, `<chain>1`, …; an explicit segment's bone), its
697
+ * `contour` regions' bones (a declared `bust` included) and its `auto`
698
+ * regions' that weight one. The same reading the rig stage makes of the parts
699
+ * an alternate set covers (issue #476). Parts in `meshes` first, then
700
+ * `regions`, each part's bones in the order they are named, once. Pure: a bone
701
+ * that does not resolve is kept by name — the loader and the rig stage refuse
702
+ * it on their own.
703
+ */
704
+ export function partBoundBones(b: PartBinding): Map<string, string[]> {
705
+ const chains = new Map<string, string[]>();
706
+ for (const e of b.bones) if ('chain' in e) chains.set(e.chain, e.points.map((_, k) => `${e.chain}${k}`));
707
+ const out = new Map<string, string[]>();
708
+ const bind = (part: string, bone: string): void => {
709
+ const list = out.get(part) ?? [];
710
+ if (!list.includes(bone)) list.push(bone);
711
+ out.set(part, list);
712
+ };
713
+ for (const [part, m] of Object.entries(b.meshes)) {
714
+ for (const sg of m.segments) {
715
+ if (typeof sg !== 'string') bind(part, sg[0]);
716
+ else for (const l of chains.get(sg) ?? [sg]) bind(part, l);
717
+ }
718
+ if ('contour' in m) for (const rg of contourRegionsOf(m.contour)) bind(part, rg.bone);
719
+ if ('auto' in m) for (const rg of m.auto.regions ?? []) if (weightsABone(rg)) bind(part, rg.bone);
720
+ }
721
+ for (const [part, bone] of Object.entries(b.regions)) bind(part, bone);
722
+ return out;
723
+ }
724
+
725
+ /**
726
+ * The bones a part can own (issue #535): every chain link, and every bone no
727
+ * other bone hangs from. A trunk bone — `head`, `chest`, anything with a child —
728
+ * is shared by nature, so binding it is never a rider relation on its own.
729
+ */
730
+ export function ownableBones(bones: readonly BoneEntry[]): Set<string> {
731
+ const parents = new Set(bones.map((e) => e.parent));
732
+ const out = new Set<string>();
733
+ for (const e of bones) {
734
+ if ('chain' in e) e.points.forEach((_, k) => out.add(`${e.chain}${k}`));
735
+ else if (!parents.has(e.name)) out.add(e.name);
736
+ }
737
+ return out;
738
+ }
739
+
740
+ /**
741
+ * Issue #535's rider by bone, read off a binding for the carried parts (each
742
+ * with its `opaque_px`, in parts.json's draw order): the host of an ownable
743
+ * bone ({@link ownableBones}) is the carried part binding it with the most
744
+ * opaque pixels, the earlier in draw order on a tie; a part is a rider of `H`
745
+ * when it binds at least one ownable bone, every one of them is hosted by `H`,
746
+ * and it hosts none itself. A part whose ownable bones have two or more hosts
747
+ * rides none of them and is returned in `split` with its hosts. Parts not in
748
+ * `carried` neither host nor ride.
749
+ */
750
+ export function turnRidersByBone(b: PartBinding, carried: ReadonlyArray<{ part: string; area: number }>): { riders: Map<string, { host: string; bones: string[] }>; split: Array<{ part: string; hosts: string[] }> } {
751
+ const bound = partBoundBones(b);
752
+ const ownable = ownableBones(b.bones);
753
+ const host = new Map<string, { part: string; area: number }>();
754
+ for (const c of carried) {
755
+ for (const bone of bound.get(c.part) ?? []) {
756
+ if (!ownable.has(bone)) continue;
757
+ const h = host.get(bone);
758
+ if (h === undefined || c.area > h.area) host.set(bone, c);
759
+ }
760
+ }
761
+ const hosts = new Set([...host.values()].map((h) => h.part));
762
+ const riders = new Map<string, { host: string; bones: string[] }>();
763
+ const split: Array<{ part: string; hosts: string[] }> = [];
764
+ for (const c of carried) {
765
+ if (hosts.has(c.part)) continue;
766
+ const own = (bound.get(c.part) ?? []).filter((bone) => host.has(bone));
767
+ if (own.length === 0) continue;
768
+ const of = [...new Set(own.map((bone) => (host.get(bone) as { part: string }).part))];
769
+ if (of.length === 1) riders.set(c.part, { host: of[0], bones: own });
770
+ else split.push({ part: c.part, hosts: of });
771
+ }
772
+ return { riders, split };
773
+ }
774
+
686
775
  export interface SingleTrack {
687
776
  bone: string;
688
777
  prop: SingleProp;
package/src/propose.ts CHANGED
@@ -127,7 +127,7 @@
127
127
  import { existsSync } from 'node:fs';
128
128
  import { join } from 'node:path';
129
129
  import { drawText, GLYPH_H } from 'rig-c/tools/font5x7.ts';
130
- import { type BoneEntry, type ConfigConstraint, type ConfigStop, contourRegionsOf, deriveBustRegions, type Limb, type MeshSpec, parseConfig, type Point, type Segment, type SkeletonSections } from './config.ts';
130
+ import { type BoneEntry, type ConfigConstraint, type ConfigStop, contourRegionsOf, deriveBustRegions, type Limb, type MeshSpec, type PartBinding, parseConfig, type Point, type Segment, type SkeletonSections, turnRidersByBone } from './config.ts';
131
131
  export { contourRegionsOf, deriveBustRegions };
132
132
  import { computeExactFrameTransforms, cropToSpineY, normaliseDegrees, toWorld } from './coords.ts';
133
133
  import { PartsError, type Problem, refuseIfAny } from './errors.ts';
@@ -486,8 +486,17 @@ export type TurnRuns = Partial<Record<'full' | 'head', LayerSet>>;
486
486
  * A rider (issue #271, {@link TURN_RIDER_TAGS}: the eye group, nose, mouth)
487
487
  * does not carry its own median: it takes the face part's, offset by
488
488
  * {@link turnRiderDepth} by draw order. With no face part, or more than one,
489
- * the riders keep their own medians and a note says so. Every other layer is
490
- * its own carrier.
489
+ * the riders keep their own medians and a note says so.
490
+ *
491
+ * A rider by bone (issue #535, {@link turnRidersByBone} over `binds` — the
492
+ * proposal's own `bones`, `meshes` and `regions`, which the CLI passes): a part
493
+ * every ownable bone of which another carried part hosts takes its host's
494
+ * drafted depth, offset by {@link turnRiderDepth} by draw order as the face's
495
+ * riders are, and a note names the host, the bones and its own median. The tag
496
+ * rule is read first: a face rider is never read as a rider by bone, nor as a
497
+ * host. A part bound to two hosts' bones keeps its own median and a note says
498
+ * so. Without `binds` no part is read as a rider by bone — the draft as it was
499
+ * before #535. Every other layer is its own carrier.
491
500
  *
492
501
  * With no part to carry, or every carried part at one depth (nothing nearer
493
502
  * than the pivot), no `turn` is drafted and a note says why. Otherwise one note
@@ -496,7 +505,7 @@ export type TurnRuns = Partial<Record<'full' | 'head', LayerSet>>;
496
505
  * each carrier the other run places more than {@link TURN_RUN_APART} of the
497
506
  * span away.
498
507
  */
499
- export function draftTurn(P: PartSet, runs: TurnRuns): { turn: TurnSpec | null; notes: string[] } {
508
+ export function draftTurn(P: PartSet, runs: TurnRuns, binds?: PartBinding): { turn: TurnSpec | null; notes: string[] } {
500
509
  P = P.beforeLimbs();
501
510
  const problems: Problem[] = [];
502
511
  const read: Array<{ part: string; run: 'full' | 'head'; tag: string; base: string | null; own: number; area: number; order: number; piece: boolean }> = [];
@@ -553,11 +562,28 @@ export function draftTurn(P: PartSet, runs: TurnRuns): { turn: TurnSpec | null;
553
562
  `turn: rider(s) ${riders.map((x) => `"${x.part}"`).join(', ')} keep their own See-through depth_median: ${faces.length === 0 ? `no part comes from a "${TURN_CARRIER_TAG}" layer` : `${faces.length} parts (${faces.map((x) => `"${x.part}"`).join(', ')}) come from a "${TURN_CARRIER_TAG}" layer, and which one carries them cannot be read off the parts`} — a value in config.turn.depths sets one`,
554
563
  );
555
564
  }
556
- const rows = read.map((x) => {
557
- if (face === null || !isRider(x)) return { ...x, depth: x.own, source: `own, ${x.run}:${x.tag}` };
565
+ const tagRider = (x: { base: string | null }): boolean => face !== null && isRider(x);
566
+ const tagRows = read.map((x) => {
567
+ if (!tagRider(x) || face === null) return { ...x, depth: x.own, source: `own, ${x.run}:${x.tag}`, host: null as string | null };
558
568
  const above = x.order > face.order;
559
- return { ...x, depth: turnRiderDepth(face.own, above), source: `"${face.part}" ${above ? '-' : '+'} ${TURN_RIDER_OFFSET}, drawn ${above ? 'above' : 'under'} it; own ${x.run}:${x.tag} ${x.own}` };
569
+ return { ...x, depth: turnRiderDepth(face.own, above), source: `"${face.part}" ${above ? '-' : '+'} ${TURN_RIDER_OFFSET}, drawn ${above ? 'above' : 'under'} it; own ${x.run}:${x.tag} ${x.own}`, host: null as string | null };
560
570
  });
571
+ // Issue #535: the riders by bone, read after the tag rule over the parts it left their own carriers.
572
+ const byBone = binds === undefined ? null : turnRidersByBone(binds, tagRows.filter((x) => !tagRider(x)).map((x) => ({ part: x.part, area: x.area })));
573
+ const rowOf = new Map(tagRows.map((x) => [x.part, x]));
574
+ const rows = tagRows.map((x) => {
575
+ const ride = byBone?.riders.get(x.part);
576
+ if (ride === undefined) return x;
577
+ const h = rowOf.get(ride.host) as (typeof tagRows)[number];
578
+ const above = x.order > h.order;
579
+ notes.push(
580
+ `turn: "${x.part}" rides "${ride.host}" by bone — every ownable bone it binds (${ride.bones.join(', ')}) is hosted by "${ride.host}", the carried part binding it with the most opaque px — so it is drafted at "${ride.host}"'s depth ${h.depth} ${above ? '-' : '+'} ${TURN_RIDER_OFFSET}, drawn ${above ? 'above' : 'under'} it; own ${x.run}:${x.tag} ${x.own} (issue #535)`,
581
+ );
582
+ return { ...x, depth: turnRiderDepth(h.depth, above), source: `"${ride.host}" by bone ${above ? '-' : '+'} ${TURN_RIDER_OFFSET}, drawn ${above ? 'above' : 'under'} it; own ${x.run}:${x.tag} ${x.own}`, host: ride.host };
583
+ });
584
+ for (const sp of byBone?.split ?? []) {
585
+ notes.push(`turn: "${sp.part}" binds ownable bones hosted by ${sp.hosts.map((h) => `"${h}"`).join(' and ')}, so it rides none of them by bone and keeps its own See-through depth_median — a value in config.turn.depths sets one (issue #535)`);
586
+ }
561
587
  const pivot = turnPivot(rows);
562
588
  const depths = Object.create(null) as Record<string, number>;
563
589
  for (const r of rows) depths[r.part] = r.depth;
@@ -580,7 +606,7 @@ export function draftTurn(P: PartSet, runs: TurnRuns): { turn: TurnSpec | null;
580
606
  // Issue #271: a carrier the other run places elsewhere is named; the run read stays the part's own.
581
607
  const span = pivot - nearest.depth;
582
608
  for (const r of rows) {
583
- if (isRider(r) && face !== null) continue;
609
+ if ((isRider(r) && face !== null) || r.host !== null) continue;
584
610
  const other = r.run === 'full' ? 'head' : 'full';
585
611
  const there = runs[other]?.layers.find((l) => l.name === r.tag);
586
612
  if (there === undefined || there.depth === null || there.opaquePx === 0 || !(there.depth < 1)) continue;
package/src/rig.ts CHANGED
@@ -132,7 +132,7 @@
132
132
  * touches the disk, and the same inputs give the same bytes (key order is the
133
133
  * order the objects are built in, and every number is rounded by `pyRound`).
134
134
  */
135
- import { type AutoSpec, type BoneEntry, type InfluenceMeshSpec, type WeightRule, type CharacterConfig, type ConfigConstraint, type ConfigStop, CONSTRAINT_FOLLOWS, constraintForRig, contourRegionsOf, type ContourSpec, DEFAULT_BUST_BONE_L, DEFAULT_BUST_BONE_R, type Point, type RibsSpec, ROOT_BONE, stopForRig, weightsABone } from './config.ts';
135
+ import { type AutoSpec, type BoneEntry, type InfluenceMeshSpec, type WeightRule, type CharacterConfig, type ConfigConstraint, type ConfigStop, CONSTRAINT_FOLLOWS, constraintForRig, contourRegionsOf, type ContourSpec, DEFAULT_BUST_BONE_L, DEFAULT_BUST_BONE_R, type Point, type RibsSpec, ROOT_BONE, stopForRig, turnRidersByBone, weightsABone } from './config.ts';
136
136
  import { type BoneTransform, computeExactFrameTransforms, cropToSpineY, normaliseDegrees, toBoneLocal, toWorld } from './coords.ts';
137
137
  import { type Problem, refuseIfAny } from './errors.ts';
138
138
  import { eyeLineDegrees } from './headframe.ts';
@@ -170,12 +170,13 @@ import { skeletonLimbJoints } from './limbs.ts';
170
170
  import { artCoverage, ART_ALPHA, latticeCells, latticeMesh, latticeStray, ONE_LOOP_PASSES } from './mesh.ts';
171
171
  import { bindFaceSurfaceDeform, BLINK, blinkHoldMisses, blinkSpan, CONTROL_SUFFIX, controlledBones, IDLE_FPS, idleMotion, type MotionSpec, moveKeysToControls } from './motion.ts';
172
172
  import { type AlternateSetMap, PAINTING_RUN, type PartsFile, readFrom, tagOf } from './parts.ts';
173
+ import { readTag } from './tags.ts';
173
174
  import { EYE_GROUP_TAGS } from './propose.ts';
174
175
  import { alphaAbove, crop, pad, type Raster } from './raster/index.ts';
175
176
  import { pyRound } from './round.ts';
176
177
  import { boneHeat, type HeatDust, heatInfluences, HEAT_LIMITS, heatRow, type HeatRow, latticeSilhouette, tracedSilhouette } from './heat.ts';
177
178
  import type { PosePoints } from './skeleton.ts';
178
- import { applyFaceSurfaceDeform, FACE_RATED_BAND, TURN_BONE, type TurnSpec, turnConstraintName, turnFractions, turnTwin } from './turn.ts';
179
+ import { applyFaceSurfaceDeform, FACE_RATED_BAND, TURN_BONE, TURN_CARRIER_TAG, TURN_PLACES, TURN_RIDER_APART, TURN_RIDER_TAGS, turnRiderDepth, type TurnSpec, turnConstraintName, turnFractions, turnNearest, turnTwin } from './turn.ts';
179
180
  import { DISTANCE_EXPONENT, type FloorForm, type Influence, influences, type InfluenceLimits, type MeshInfluences, meshLimits, type Segment } from './weights.ts';
180
181
 
181
182
  /** Transparent pixels added round every part image — the reference's `PAD`. */
@@ -558,6 +559,62 @@ export function detachedRules(constraints: readonly ConfigConstraint[]): Detache
558
559
  return out;
559
560
  }
560
561
 
562
+ /** A fraction as the turn refusals print it: signed, 4 places. */
563
+ function signed4(v: number): string {
564
+ const r = pyRound(v, 4);
565
+ return `${r >= 0 ? '+' : '-'}${Math.abs(r).toFixed(4)}`;
566
+ }
567
+
568
+ /**
569
+ * Issue #535: `CONFIG_TURN_RIDER_DEPTH` — an authored `turn.depths` entry for a
570
+ * rider by bone ({@link turnRidersByBone}: a part every ownable bone of which
571
+ * another carried part hosts, the host being the one binding it with the most
572
+ * `opaque_px`) whose fraction differs from its host's by more than
573
+ * {@link TURN_RIDER_APART} of the dial: the ornament would float off what it is
574
+ * pinned to. Read here, not by the config loader, because the host is chosen by
575
+ * `opaque_px`, which only parts.json holds. The candidates are the parts
576
+ * `turn.depths` carries, in parts.json order; a face rider (issue #271: a part
577
+ * from an eye-group, nose or mouth layer beside exactly one part from a `face`
578
+ * layer) is read by its tag, never by its bones, as `propose` reads it.
579
+ */
580
+ function turnRiderProblems(turn: TurnSpec, cfg: CharacterConfig, recs: PartsFile['parts']): Problem[] {
581
+ const baseOf = (from: string): string | null => {
582
+ const t = tagOf(from);
583
+ return t === null ? null : (readTag(t)?.base ?? null);
584
+ };
585
+ const faces = recs.filter((r) => baseOf(r.from) === TURN_CARRIER_TAG && r.cut_from === undefined);
586
+ const tagRider = (from: string): boolean => {
587
+ const b = baseOf(from);
588
+ return faces.length === 1 && b !== null && TURN_RIDER_TAGS.includes(b);
589
+ };
590
+ const carried = recs.filter((r) => Object.hasOwn(turn.depths, r.name) && !tagRider(r.from));
591
+ const { riders } = turnRidersByBone(cfg, carried.map((r) => ({ part: r.name, area: r.opaque_px })));
592
+ if (riders.size === 0) return [];
593
+ const nearest = turnNearest(turn.depths);
594
+ if (nearest === null) return [];
595
+ const span = turn.pivot - nearest.depth;
596
+ const order = recs.map((r) => r.name);
597
+ const frac = new Map(turnFractions(turn, order).map((f) => [f.part, f.fraction]));
598
+ const problems: Problem[] = [];
599
+ for (const [part, ride] of riders) {
600
+ const fp = frac.get(part) as number;
601
+ const fh = frac.get(ride.host) as number;
602
+ const diff = Math.abs(fp - fh);
603
+ if (!(diff > TURN_RIDER_APART)) continue;
604
+ const above = order.indexOf(part) > order.indexOf(ride.host);
605
+ const want = pyRound(turnRiderDepth(turn.depths[ride.host], above), TURN_PLACES + 3);
606
+ problems.push({
607
+ code: 'CONFIG_TURN_RIDER_DEPTH',
608
+ object: `config.turn.depths.${part}`,
609
+ detail:
610
+ `is ${turn.depths[part]}, fraction ${signed4(fp)} of the dial; "${part}" rides "${ride.host}" by bone — every ownable bone it binds (${ride.bones.join(', ')}) is hosted by "${ride.host}", the carried part binding it with the most opaque px — ` +
611
+ `whose depth ${turn.depths[ride.host]} travels ${signed4(fh)}: the difference ${pyRound(diff, 4)} is more than ${TURN_RIDER_APART} of pivot − nearest (${turn.pivot} − ${nearest.depth} = ${pyRound(span, TURN_PLACES)}), so at the dial's x the part leaves what it rides by ${pyRound(diff, 4)} of it; ` +
612
+ `the host's depth ${above ? '−' : '+'} 0.001 (${want}, drawn ${above ? 'above' : 'under'} it) is required, or redraft the turn with propose --full/--head`,
613
+ });
614
+ }
615
+ return problems;
616
+ }
617
+
561
618
  /** One carried part of the turn control (issue #251): its depth, its fraction, and the twins that carry it. */
562
619
  export interface TurnRow {
563
620
  part: string;
@@ -2485,6 +2542,7 @@ export function buildRig(
2485
2542
  const stops = cfg.stops === undefined ? null : applyStops(cfg.stops, chains, bones, slots, skin);
2486
2543
  // ---- the turn control (issue #251) -------------------------------------
2487
2544
  // Only when the config has `turn`: every other build adds nothing here, so no byte moves.
2545
+ if (cfg.turn !== undefined) refuseIfAny(turnRiderProblems(cfg.turn, cfg, parts.parts));
2488
2546
  const turned = cfg.turn === undefined ? null : applyTurn(cfg.turn, parts.parts.map((p) => p.name), bones, slots, skin, cfg.constraints ?? []);
2489
2547
 
2490
2548
  const name = `${cfg.key}_painting`;
package/src/turn.ts CHANGED
@@ -63,6 +63,15 @@ export function turnRiderDepth(carrier: number, above: boolean): number {
63
63
  return above ? carrier - TURN_RIDER_OFFSET : carrier + TURN_RIDER_OFFSET;
64
64
  }
65
65
 
66
+ /**
67
+ * The share of the span (`pivot − nearest`) past which a rider by bone's
68
+ * fraction (issue #535: a part whose every ownable bone another carried part
69
+ * hosts, `turnRidersByBone` in `src/config.ts`) is refused for differing from
70
+ * its host's (`CONFIG_TURN_RIDER_DEPTH`, the rig stage). #535's judgment line,
71
+ * set before it was measured: the same bar as `propose`'s `TURN_RUN_APART`.
72
+ */
73
+ export const TURN_RIDER_APART = 0.1;
74
+
66
75
  /** The control bone the rig stage adds under `root` when the config has `turn`: nothing keys it, and its local x is the dial. */
67
76
  export const TURN_BONE = 'turn';
68
77