@rig-c/parts 1.41.0 → 1.42.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/NOTICE.md CHANGED
@@ -75,14 +75,16 @@ terms and not a term of this project:
75
75
 
76
76
  1. What rig-parts produces is input to rig-c, whose output **is Spine
77
77
  skeleton data**.
78
- 2. Playing Spine skeleton data in a product requires a Spine Runtime, and the
79
- Spine Runtimes License requires **each user of such a product to own a
80
- Spine Editor license**.
81
- 3. rig-c no longer installs `spine-core`, and rig-parts does not either;
82
- the obligation in 2 attaches to the Spine skeleton data rig-c writes,
83
- which the stages of rig-parts that call it produce, and to `spine-core`
84
- wherever it is installed beside them — this repository's development
85
- dependency included.
78
+ 2. A product that plays it with **a Spine Runtime** has integrated the Spine
79
+ Runtimes; what the terms turn on is **the integration**. Integrating a Spine
80
+ Runtime into a product is permitted **under Section 2 of the Spine Editor
81
+ License Agreement**, or otherwise on the condition that **each user of the
82
+ product obtains their own Spine Editor license** and the product carries the
83
+ Runtimes licence and copyright notice.
84
+ 3. rig-c does not install `spine-core`, and rig-parts does not either. The terms
85
+ in 2 apply where a Spine Runtime is integrated — a product that plays the data
86
+ with one, and this repository, whose development dependency it is — and
87
+ nothing in this chain attaches to the skeleton data as a file.
86
88
 
87
89
  rig-parts also imports rig-c's own modules directly, by deep path: its PNG codec
88
90
  (`tools/plate.ts`, `src/png.ts`), its 5x7 label font (`tools/font5x7.ts`) and
package/README.md CHANGED
@@ -442,10 +442,14 @@ selftest and CI do; `check.json`'s `rigc_entry` records which one gated a build.
442
442
 
443
443
  ## Licence posture
444
444
 
445
- rig-parts is MIT, and it depends on rig-c, whose output is Spine skeleton data:
446
- using what it produces in a product requires a Spine Editor licence, as any Spine data
447
- does. Neither package installs Esoteric Software's `spine-core` any more; this
448
- repository uses it in development, for the round trip in its selftest and CI. [NOTICE.md](NOTICE.md) records that chain and every other
445
+ rig-parts is MIT. It writes rig-c's input, and rig-c writes Spine skeleton data. If a
446
+ product integrates a Spine Runtime to play that data, the integration is under Esoteric
447
+ Software's Spine Runtimes License: permitted under Section 2 of the Spine Editor License
448
+ Agreement, or otherwise on the condition that each user of the product obtains their own
449
+ Spine Editor license. What those terms turn on is the integration, as rig-c's
450
+ [NOTICE.md](https://github.com/rig-c/core/blob/main/NOTICE.md) states it, not the data as
451
+ a file. Neither package installs `spine-core`; this repository uses it in development,
452
+ for the round trip in its selftest and CI. [NOTICE.md](NOTICE.md) records that chain and every other
449
453
  third-party term this package touches, See-through's included.
450
454
 
451
455
  ## Development
package/cli.ts CHANGED
@@ -27,7 +27,7 @@ import { makeInputs } from './src/inputs.ts';
27
27
  import { idleKeysOf, isIdleKeys } from './src/rig.ts';
28
28
  import { depthSkipLine, exportLayers, figuresPhrase, hiddenLayerLine, implausibleRules, layerFigures, type LayerSet, layerSetDiff, pct, readLayers, readWrapperLayers, ruleSummary, templateLayerNames, templatePsdBytes, times } from './src/layers.ts';
29
29
  import { checkImageSize, choosePerson, KEYPOINTS_SPEC, loadKeypoints, type RigJoints, toRigJoints } from './src/keypoints.ts';
30
- import { basisLines, branchSqueezeLine, checkProposal, compare, compareLines, DEFAULT_GRID_RULE, draftTurn, drawLandmarks, FIGURE_GRID_DIVISOR, FRINGE_STEP_PX, GRID_RULES, type GridRule, HIP_MIN_FRACTION, lint, lintLine, type PartSet, proposeWithBasis, readPartSet, serializeProposal, withTurn, WRIST_ON_PART_PX } from './src/propose.ts';
30
+ import { basisLines, branchSqueezeLine, checkProposal, compare, compareLines, DEFAULT_GRID_RULE, draftTurn, drawLandmarks, FIGURE_GRID_DIVISOR, FRINGE_STEP_PX, GRID_RULES, type GridRule, HIP_MIN_FRACTION, type DraftLintFinding, lint, lintLine, type PartSet, proposeWithBasis, readPartSet, serializeProposal, withTurn, WRIST_ON_PART_PX } from './src/propose.ts';
31
31
  import { BASIS_FILE, BASIS_SPEC, basisFile, basisLine, coverageLines, serializeBasis } from './src/diagnostics.ts';
32
32
  import { BEND_DEGREES, BEND_WORST_SHARE, DUST_MAX_PX, DUST_MAX_SHARE, IDLE_BOUND_PX, MESH_DRAFT_REPORT, MESH_DRAFT_SPEC, meshDraftStage, MORE_TRIANGLES_FLAG, TOLERANCE_FIGURE_DIVISOR } from './src/meshdraft.ts';
33
33
  import { PROVENANCE_FILE, REMESH_SPEC, remeshStage } from './src/remesh.ts';
@@ -217,7 +217,12 @@ usage:
217
217
  refused (PROPOSE_CLOTH_DRAFTED). A topwear part shaped like a skirt (a
218
218
  dress) is named in a note, never drafted on its shape; a bottomwear
219
219
  recipe's "part" declares it, and its trees hang from the hip over the
220
- part's art below it (PROPOSE_CLOTH_PART). Without --cloth nothing changes.
220
+ part's art below it (PROPOSE_CLOTH_PART). A recipe's "influence"
221
+ ({across, max, shape}, issue #518) drafts the parts it meshes in the
222
+ influence mode at their lattice's cell, the radius as stated or drafted
223
+ as the farthest lattice vertex from its nearest link plus 3 cells, and
224
+ a LINT line names each drafted radius and both figures. Without --cloth
225
+ nothing changes.
221
226
 
222
227
  rig-parts propose --parts <dir> --source <painting.png> --out <dir> --from-config <config.json>
223
228
  Draw the config's CURRENT bones instead (<out>/render/landmarks_config.png
@@ -1112,8 +1117,8 @@ function parseCanvas(v: string): { w: number; h: number } | null {
1112
1117
  return m === null ? null : { w: Number(m[1]), h: Number(m[2]) };
1113
1118
  }
1114
1119
 
1115
- function printLint(P: PartSet, spec: { bones: CharacterConfig['bones']; meshes: CharacterConfig['meshes']; regions: CharacterConfig['regions']; motion: CharacterConfig['motion']; constraints?: CharacterConfig['constraints'] }, joints?: RigJoints): number {
1116
- const res = lint(P, spec, joints);
1120
+ function printLint(P: PartSet, spec: { bones: CharacterConfig['bones']; meshes: CharacterConfig['meshes']; regions: CharacterConfig['regions']; motion: CharacterConfig['motion']; constraints?: CharacterConfig['constraints'] }, joints?: RigJoints, drafted: readonly DraftLintFinding[] = []): number {
1121
+ const res = lint(P, spec, joints, drafted);
1117
1122
  // Under --keypoints only: which rule set read the torso and the chains, and on what basis.
1118
1123
  if (res.basis !== undefined) for (const l of basisLines(res.basis)) console.log(l);
1119
1124
  for (const f of res.findings) console.log(lintLine(f));
@@ -1242,7 +1247,7 @@ function cmdPropose(args: string[]): number {
1242
1247
  }
1243
1248
  const cmpPath = flags.get('--compare');
1244
1249
  const cfg = cmpPath === undefined ? null : loadConfig(cmpPath);
1245
- const { proposal: drafted, basis } = proposeWithBasis(P, joints, wristSnap, gridRule, cloth);
1250
+ const { proposal: drafted, basis, draftLint } = proposeWithBasis(P, joints, wristSnap, gridRule, cloth);
1246
1251
  const fullRun = flags.get('--full');
1247
1252
  const headRun = flags.get('--head');
1248
1253
  const prop =
@@ -1260,7 +1265,7 @@ function cmdPropose(args: string[]): number {
1260
1265
  if (img.head !== null) writePng(join(render, 'landmarks_head.png'), img.head);
1261
1266
  console.log(`wrote proposal.json (${prop.bones.length} bone entries, ${Object.keys(prop.meshes).length} meshes) and render/landmarks.png (+_head) under ${out}`);
1262
1267
  for (const n of prop.notes) console.log(`note: ${n}`);
1263
- printLint(P, prop, joints);
1268
+ printLint(P, prop, joints, draftLint);
1264
1269
  console.log(basisLine(bfile, out));
1265
1270
  if (cfg !== null) for (const l of compareLines(compare(prop.bones, cfg.bones))) console.log(l);
1266
1271
  return EXIT_OK;
package/docs/AUTHORING.md CHANGED
@@ -113,7 +113,7 @@ read by no CPU stage).
113
113
  | `limbs` | assemble (the cut and the caps), rig (through `regions`), check (`LIMB_ONE_BONE`) | **proposed** by `propose --keypoints` (issue #349), then checked: `{<limb>: {segments: [{part, from, bone}, {part, from, bone, joint, range?, cap?, edge?, cap_shape?, cut_band?}, …]}}`, the upper segment first. The rule is *Limbs: cut at their joints* below the table. `part` is a new part (`CONFIG_PART_NAME`, `CONFIG_PART_UNIQUE` against the plan, patches, cuts and every other limb part); `from` a plan part or a cut's piece (`CONFIG_NAME_RESOLVES`) — the layer the segment's pixels come from, which is cut into the limb parts and is not itself made: a `meshes` or `regions` entry for it is `CONFIG_NAME_RESOLVES`, and the segments of one limb that take one part are consecutive (`CONFIG_LIMB_FROM_RUN`); `bone` a declared bone, each segment's the child of the one before (`CONFIG_LIMB_BONES_CHAIN`); the upper segment names no `joint`, `range`, `cap`, `edge`, `cap_shape` or `cut_band` (`CONFIG_KEY_KNOWN`), every other names its `joint` (`CONFIG_FIELD_PRESENT`) — the joint is its bone's origin; `range` is `[min, max]` degrees from rest with `min <= 0 <= max` (`CONFIG_LIMB_RANGE`), which `assemble` writes into the lower part's `parts.json` record and `check` poses the joint at — its two ends and its middle — reading the seam there (`SEAM_OVER_RANGE`, issue #360; rig-c needs no rotation limit); `cap` a PNG path relative to the config's directory (`CONFIG_FIELD_TYPE`); `edge` `"feather"` and `cap_shape` `"disc"` (issue #360), each the one value its field takes (`CONFIG_FIELD_TYPE` on any other) — the cut's geometry at that joint, *Limbs: cut at their joints* below; absent, the cut is hard and the cap the layer's half-disc of half the limb's width; `cut_band` a whole number of px, 1 or more (`CONFIG_FIELD_TYPE`), on a segment that takes the segment above's part — between two layers nothing is cut, so a band there is `CONFIG_KEY_KNOWN` — places the cut within that many px of the joint line (issue #360, *Limbs: cut at their joints*); absent, the cut is the joint line. Each limb part is attached like any part — `regions.<part>`, which must be the segment's `bone` (`CONFIG_LIMB_BONE`), or a mesh, which `check` holds to that bone alone (`LIMB_ONE_BONE`). With `limbs`, `assemble` reads `bones` too (`CONFIG_FIELD_PRESENT` without it). Absent, nothing is cut at a joint and no byte of any output moves |
114
114
  | `bones` | rig; `propose --from-config` | **proposed** by `propose`, then corrected. A single bone `{name, parent, at, tip?}` or a chain `{chain, parent, points, tip, link_inherit?}` whose links are named `<chain>0 … <chain>n`. Parents come before children. In `rig.json` each link is **turned along its chain** — `rotation` is the direction from its origin to the next link's (the last link's to `tip`) and `length` that distance (issue #73), so a physics constraint added downstream finds a lever; under `--idle-keys ctl` the link's `<link>_ctl` carries the turn and the length and the link sits at local rotation 0 beneath it. A single bone with a `tip` is turned the same way, towards its tip, with that distance as its length (issue #239); a tip on the bone's own origin is refused (`RIG_TIP_DISTINCT`). The five face bones `eye_r`, `eye_l`, `brow_r`, `brow_l` and `mouth` (by name, when one has no tip of its own) are turned to the eye line — the line through the origins of `eye_r` and `eye_l` as `bones` writes them, read image-left to image-right, drawn when parts.json holds both an `eyewhite-r` and an `eyewhite-l` part — so the blink's `scaley` squashes across the eye line on a tilted head; move an eye bone and the line moves with it. With one eyewhite or none, or an eye bone missing, the rig stage's `face axis:` line says so and they keep the page's axes. A bone under a face bone keeps the face's axis. With the line, `rig.json` also declares `invariants.axes` — one entry, `"face"`, through `eye_r` and `eye_l`, holding the turned face bones (and their controls) — so rig-c's gate holds the build to the line; the line is the one rigc draws through the same two bones, so the tolerance is only the float floor — the largest gap the emitted (float32) bones have to it, rounded up to 6 places plus one 6-place unit — and the `face axis:` line prints it. With the line the rig stage also adds `head_up` (issue #250): a slotless bone under `head`, at head's origin, turned to the eye line + 90 degrees and as long as the eye midpoint lies from head's origin along that axis — the head's frame, which a rule that needs it reads; `head` keeps its own frame, so no key on it or under it changes meaning, and a config bone of that name is refused (`RIG_HEAD_UP_NAME_FREE`). A face bone with its own `tip` is held too (issue #258), in a second entry, `"face_tips"`, when its tip lies along the line within whole-pixel rounding — a tip written in whole pixels sits at most sqrt(2)/2 px off the point of the line it stands for, so its direction may sit up to asin((sqrt(2)/2) / length) degrees off — with its tolerance measured the same way; a tip further off is the bone's own axis, and the `face axis:` line names it with its gap and that bound. A failure is rig-c's `A51_BONES_LIE_ALONG_THEIR_DECLARED_AXIS` line, which names the bone and the fix (rig-c's `docs/AUTHORING.md` §3.7 and §5.2); with no line no entry is written and A51 reports SKIP. Every region on a turned bone is turned back, so the setup pose does not move. Any other single bone keeps world rotation 0; one whose parent is a link is turned back upright. A single bone may declare `inherit` (issue #348): what it takes from its parent's transform, one of rig-c's own mode names exactly as rig-c's table spells them — `normal`, `onlyTranslation`, `noRotationOrReflection`, `noScale`, `noScaleOrReflection` (rig-c's `RigBone.inherit`) — written to that bone in `rig.json` as declared; any other spelling, `"NoScale"` included (the runtime would fold its first letter; nothing here folds or maps), is refused (`CONFIG_BONE_INHERIT`), and a chain takes no `inherit` (`CONFIG_KEY_KNOWN`). A chain may instead declare `link_inherit` (issue #369), an object mapping its own expanded link names to those same modes, for example `"link_inherit": {"leg_r1": "noScale"}`. Only the named link changes; omitted links inherit normally. A key outside this chain is `CONFIG_NAME_RESOLVES`, with this chain's valid link names in the detail; a non-object or non-string mode is `CONFIG_FIELD_TYPE`, and another mode spelling is `CONFIG_BONE_INHERIT`. The mode is forwarded to the expanded link, or to its control under `--idle-keys ctl`, by the same rule as a single bone. This is an authored opt-in: `propose` does not add it. Its setup rotation is the turn from where rig-c's own poser puts the bone with no rotation of its own under that mode, so it still stands upright (or along its tip) at the setup pose. Where the idle gives the bone a `<bone>_ctl`, the mode goes on the control: the control is the bone the parent's rotation reaches, and the bone under it inherits normally, so the idle's keys moved onto the control still turn it. A foot that does not take its shin's rotation (`noRotationOrReflection` or `onlyTranslation`) keeps its shoe level while the leg is posed (`FEET_STAY_LEVEL`, §7); which mode is the author's. `noScale` keeps a shin or shoe's shape under a scaled parent but still takes the parent's rotation: a shoe that must also stay level needs a separate rotation constraint, for example a transform constraint from an unrotated bone. This does not change the proposed feet's existing inheritance or `FEET_STAY_LEVEL` default. An automatic mesh weighted through a bone with a mode other than `normal` gets no derived amplitude (its row names the bone) and no residual envelope (rig-c's `SKINNING_RANGE_UNSUPPORTED`). Absent, `rig.json` carries no `inherit` and no byte moves |
115
115
  | `meshes.<part>` | rig | **proposed**, then corrected. Exactly one of `grid` (the lattice: cell size, px — what `propose` writes: by default one spacing for the figure, round(H / 37) rig px with H the height of every part's box together, a part whose tenth of its short side is already coarser keeping that, and under `propose --grid-rule part` the reference's tenth of the part's short side clamped to 5..36, issue #265), `contour` (the outline mode, authored; the next row and "A contour mesh" below) or `auto` (the automatic mode, authored; "An automatic mesh" below) — two, or none, is `CONFIG_MESH_MODE`. In every mode: `r` (added to every distance before weighting: `w = 1/(d + r)²`), `segments` (a chain name, a bone name with a `tip`, or `[bone, [x0,y0], [x1,y1]]`), and, **authored**, optional, `exponent` (issue #161): a number above 0 that replaces the 2 in that rule, `w = 1/(d + r)^exponent` — a larger one hands each vertex more fully to its nearest bone; absent is 2 and changes no byte, a value that is not a number above 0 is `CONFIG_FIELD_TYPE` at `meshes.<part>.exponent`, and a declared one is echoed as `exponent` in the mesh's `mesh_report.json` row; the exponent is the distance rule's, so declared beside `rule: "heat"` it is refused (`CONFIG_FIELD_TYPE` at `meshes.<part>.exponent`). The segment list is the one authored decision about a layer: which bones may pull it. The slot's bone is the first segment's. Optional `rule` (issue #161): `"distance"` — the rule above, and what an absent `rule` means (every byte is the same) — or `"heat"`, bone heat over the part's own silhouette, in every mode: the lattice's art (alpha above 8, less any island a declared `stray` left out) with holes filled, or for `contour` and `auto` the silhouette their outline is traced from (that mode's art — alpha above 8 for `contour`, alpha 1 and above for `auto` — less any island a declared `stray` left out, holes filled, grown by its `margin`); each bound bone's sources are the silhouette pixels whose centre lies within 0.75 px of its segment (a pixel two bones reach goes to the nearer, a tie to the first listed), held at 1 for that bone and 0 for the others; the field is solved by row-major Gauss–Seidel over-relaxation to a sweep change under 1e-7 within 20000 sweeps; a vertex reads the nearest silhouette pixel and takes the same cap and floor (and `regions`) as the distance rule; `r` is not read. The mesh's `mesh_report.json` row gains `heat` (the constants, each bone's sources and sweeps, the residual). Any other value is `CONFIG_FIELD_TYPE`; a bound bone with no source pixel is `RIG_HEAT_BONE_SOURCE`, an island no bone has a source in `RIG_HEAT_ISLAND_SOURCE`, a solve past its sweep bound `RIG_HEAT_CONVERGED` — none is weighted 0. The rule is chosen per mesh, so `RIG_HEAT_BONE_SOURCE` names three remedies: move the segment onto the art, take the bone out of `segments`, or keep this part on the distance rule — the one to take when the bone anchors the part from outside its art (a torso bone under a neck), since the first moves a bone another part placed and the second drops the anchor (issue #303). On a lattice, `RIG_HEAT_ISLAND_SOURCE` on an island that is dust — at most 4 px and at most 0.1 % of the part's art px, `mesh-draft`'s line — names `meshes.<part>.stray` and the figure that leaves it out, with the value declared; an island above that line keeps the segment remedy, a real piece being a real authoring question |
116
- | `meshes.<part>.influence` | rig | **authored**, optional (issue #378), a mode beside `grid`, `contour` and `auto`: `{cell, radius, across, max, shape}`, every field required, none defaulted. rig-c's `segments` lattice over the part at `cell` px, each vertex pulled by every link of the mesh's `segments` within `radius` px of it — a pull that falls to exactly 0 at `radius` (`shape` `"linear"` or `"smooth"`), across the `segments` entries or only within the nearest one (`across`), the strongest `max` kept. The lattice and the shares are computed by rig-c's own promised functions (`buildSegmentsLattice`, `segmentDistance`, `influenceShares`), so the rule is rig-c's (its AUTHORING §3.4.7), and the mesh is written with explicit weights like every other mode. `radius` is a length on this part: the rig stage measures the farthest lattice vertex's distance to its nearest link and refuses a radius at or under it (`RIG_INFLUENCE_REACH`), naming the distance. `r`, `exponent`, `rule`, `influences`, `stray` and `ribs` belong to the distance rule or another mode and are refused beside it (`CONFIG_INFLUENCE_MODE`). For cloth and hair that should bend as one surface across its chains |
116
+ | `meshes.<part>.influence` | rig | **authored**, optional (issue #378), a mode beside `grid`, `contour` and `auto`: `{cell, radius, across, max, shape}`, every field required, none defaulted. rig-c's `segments` lattice over the part at `cell` px, each vertex pulled by every link of the mesh's `segments` within `radius` px of it — a pull that falls to exactly 0 at `radius` (`shape` `"linear"` or `"smooth"`), across the `segments` entries or only within the nearest one (`across`), the strongest `max` kept. The lattice and the shares are computed by rig-c's own promised functions (`buildSegmentsLattice`, `segmentDistance`, `influenceShares`), so the rule is rig-c's (its AUTHORING §3.4.7), and the mesh is written with explicit weights like every other mode. `radius` is a length on this part: the rig stage measures the farthest lattice vertex's distance to its nearest link and refuses a radius at or under it (`RIG_INFLUENCE_REACH`), naming the distance. `propose --cloth` drafts it when a recipe declares `influence` and no `radius` (issue #518): the farthest vertex's distance plus 3 of the part's lattice cells, printed on a `LINT` line with both figures. Measured on the cloth fixture and the public `wind` example (#513: 8 covered parts, `render --folds` with the physics on under wind and a hip sway of 8° and 30°): a radius just above the floor folds **more** than the lattice (one skirt went from 0 to 55 folded frames), and a larger one is **not** safer (one fringe folded again at about 3–4× its farthest distance); +2 to +6 cells read 0 on every part, +2 at the edge. No ceiling is drafted, and the 3 is a hypothesis until a third subject — state `radius` in the recipe to keep your own. `r`, `exponent`, `rule`, `influences`, `stray` and `ribs` belong to the distance rule or another mode and are refused beside it (`CONFIG_INFLUENCE_MODE`). For cloth and hair that should bend as one surface across its chains |
117
117
  | `meshes.<part>.contour` | rig | **authored**, optional (issue #84): `{tolerance, margin, spacing, maxEdge?, budget?, stray?, bridges?, regions?, bust?}`. `tolerance` — rig-c's Douglas–Peucker tolerance on the traced outline, px, 0 or more; `margin` — how far the silhouette grows before it is traced, px: 0, or 1 or more (a pixel joins when its centre lies within `margin` of an art pixel's centre; a value above 0 and below 1 adds nothing and is refused, `CONFIG_FIELD_TYPE`); `spacing` — the background interior spacing, px, above 0; `maxEdge` (issue #265) — the longest outline edge, px, above 0: every simplified edge longer than it is cut into `ceil(length / maxEdge)` equal pieces, each cut point on the 1/256 px grid, before any region or rib touches the outline (absent: nothing is cut, and no byte moves; under 2/256 px the rig stage refuses it, `CONTOUR_PARAMETER`, because two cut points could snap together); the row echoes it in `params` and counts the points it added in `contour.outlineCut`, both only when declared; `budget` — the most vertices the mesh may have (refused above it, nothing thinned); `stray` — the largest island, in art pixels, that may be left out of the mesh (absent: none is); `bridges` (issue #326) — `true`, its one value: islands are read in this order — **dust first** (those `stray` leaves out), **then faint islands** (every pixel's alpha under 64, a quarter of full opacity: left out the same way, their pixels kept in the image but not meshed, so not drawn, and named in the row's `contour.bridges.faint` with their px, brightest alpha and box), **then every visible island is meshed and bridged, whatever the bridge costs** — overdraw is reported, never a reason to drop art; the largest island, or a tie for it, is never left out, faint or not: dropping it would draft the part without its art, and a part whose main body is faint is a question about the layer, which the plan and the author own, not one for the mesh — and the pieces are joined into the one outline rig-c takes by bridges — the kept islands, holes filled, grow together by `margin`, so islands closer than about twice the margin are one grown silhouette, traced as one; each silhouette is traced, simplified, capped, refined and triangulated as a one-island mesh is; then, starting from the silhouette with the most art, the nearest pair of a vertex on the joined outline and one on a silhouette still apart whose quad holds (wound as the mesh, crossing no outline, holding no other vertex, one closed outline after) is joined by that quad, two triangles over no art, until none is apart. Coverage and overshoot read the silhouettes' triangles; a bridge's area is in `meshArea` and in the row's `contour.bridges` (`islands`, `units`, and per join `unit`, `span` — its two crossing edges, px — `area`, `vertices`, `pair`; and `faint`, only when an island was left out as faint), and the row's `params` echoes `bridges`, both only when declared; `art_coverage` counts a faint island's pixels as art not covered. Absent, a second island is refused as below and no byte moves; on one island it writes the mesh the undeclared entry writes. Any other value is `CONFIG_FIELD_TYPE`; beside `ribs` it is `CONTOUR_PARAMETER` (a rib runs across one outline); a join no pair makes is `CONTOUR_BRIDGE`. A bridge stretches with whatever pulls its two ends apart, so it belongs on a part whose pieces ride one bone — the only case `mesh-draft` drafts; `regions` — local deformation regions, each `{name, shape, bone, spacing, band}` with `shape` `"circle"` (`cx, cy, r`) or `"polygon"` (`points`, 3 or more): `bone` is the region's control bone (any bone `bones` declares), `spacing` the interior spacing inside the region and its band, `band` the width the bone's weight falls across. Every length and position is **rig px**, like every other in the config; the part image is the rig less `(x − 4, y − 4)` (its box less the pad), a translation, so a length is the same number in both. A region's `cx`, `cy`, `r`, `band` and `points` are multiples of 1/256 px (`CONFIG_FIELD_TYPE` otherwise); region names are unique per mesh (`CONFIG_REGION_NAME_UNIQUE`). `bust` (issue #475) — `{apex_r, apex_l, cleavage, alpha?: 0.22, clearance?: 3.8, bone_r?: "boob_r", bone_l?: "boob_l", spacing?: 14}`: derives the two circular regions `bust_r` and `bust_l` from the three rig-px landmarks `apex_r`, `apex_l` and `cleavage` (multiples of 1/256 px, `CONFIG_FIELD_TYPE` otherwise; projecting the torso midline `neck → chest → hip` onto `apex_r → apex_l` misses the cleavage by 14–93 px across all five calibrated 3/4-yaw characters, so all three points are required). With `d_s = \|cleavage − apex_s\|` and `D = \|apex_r − apex_l\|`, each side `s ∈ {r, l}` is placed at `cx = apex_s[0]`, `cy = apex_s[1]` with outer radius `R_s = d_s − clearance`, core radius `r_s = round(alpha × R_s)` and `band_s = round(R_s) − r_s` (`alpha` = 0.22, `clearance` = 3.8 px, `spacing` = 14 px, `bone_r` = `"boob_r"`, `bone_l` = `"boob_l"` by default, reproducing the five calibrated example characters within `<= 6 px`, max `\|ΔR\| = 5 px`, max `\|Δr\| = 3 px`). Refused when `clearance <= 0`, `R_r + R_l >= D`, or a derived `r_s` or `band_s` is not positive (`CONFIG_BUST_CLEARANCE`), when `bone_r` or `bone_l` is not declared in `bones` (`CONFIG_NAME_RESOLVES`), or when `contour.regions` also names `bust_r` or `bust_l` (`CONFIG_REGION_NAME_UNIQUE`). Both `propose` and `rig` read `contour.bust` through `contourRegionsOf` (`deriveBustRegions`), and hand-written `contour.regions` entries build byte-identically when `bust` is absent. The alpha threshold is not a field: art is alpha above 8, the lattice's and `check`'s |
118
118
  | `meshes.<part>.ribs` | rig | **authored**, optional (issue #188), in the `contour` and `auto` modes: `{<chain>: {stations}, …}`, each key a chain this mesh's `segments` name. Each link of the chain gets a row of vertices across the part at its origin and at `stations` points evenly between its origin and its end (`stations`, a whole number, 0 or more, required; a chain of L links carries L × (stations + 1) ribs), each rib a row of vertices across the part, kept as a row of locked edges; the rule is "Ribs along a chain" under "A contour mesh". Absent places none and changes no byte. Refused: a lattice mesh with ribs (`CONFIG_RIBS_MODE` — its vertices are its grid's corners), a key that is not one of the mesh's chains (`CONFIG_NAME_RESOLVES`), an object naming no chain or a `stations` that is not a whole number from 0 (`CONFIG_FIELD_TYPE`); at the rig stage `CONTOUR_RIB_ART`, `CONTOUR_RIB_LINK`, `CONTOUR_RIB_CROSSING`, `CONTOUR_RIB_EDGE` (the contour refusals). The mesh's `mesh_report.json` row gains `ribs` — the declaration, the ribs placed and the vertices they hold — and its contour report (the source's, in `auto`) lists each rib's vertices |
119
119
  | `meshes.<part>.influences` | rig | **authored**, optional (issue #284), in the `grid` and `contour` modes: `{maxInfluences?, floor?}`, at least one. `maxInfluences` — the most bones that pull one vertex, a whole number 1 or more, or `null`, no cap (every bone the mesh's `segments` name; `null` is the config's spelling of a bound declared absent, as in `maxOvershoot` and `weightJump`); absent is 4. `floor` — `"cut"` (the capped shares normalised, any under 0.03 dropped, the rest normalised again; what an absent `floor` means) or `"continuous"` (0.03 subtracted from every capped share, those at or below 0 dropped, the rest normalised again, so a bone fades out of a vertex instead of leaving it in one step). Absent, the mesh is weighted at 4 and the cut and every byte is the one written before the field existed; declared, it applies under either `rule`, and is echoed as `influences` in the mesh's `mesh_report.json` row. `propose` never writes it, and `mesh-draft` carries a lattice's declaration to the contour candidate it drafts. A cap that is not a whole number 1 or more or `null` (the string `"none"` included), another `floor`, or an object naming neither is `CONFIG_FIELD_TYPE`; a vertex the declared cut leaves with no bone is `RIG_INFLUENCES_KEPT`; beside `auto` it is `CONFIG_INFLUENCES_MODE` (that mode's cap and floor are `auto.influences`). What each setting trades is "The weight cut" below |
@@ -128,7 +128,7 @@ read by no CPU stage).
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
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 |
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
- | `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?}`. `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 |
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 |
133
133
 
134
134
  **One drawing, one band; beyond it, another drawing (issue #472).** A single front-facing
@@ -2235,7 +2235,7 @@ move off it (`AS245`).
2235
2235
  | `layers` | the table, then one `author-made: layer "author:<label>" — …` line per layer the author made (group `author` in the table; §5, *A layer the author made*), then the `WARN` lines | every tag the plan will need has opaque pixels; one `face` in the head run; `0 WARN line(s)` | a run whose layer PNG is not its box's size (`LAYERS_PNG_MATCHES_BBOX`); a `WARN PLAN_LAYER_…` line (§6, *Plausibility*) |
2236
2236
  | `sheet` of both runs | the tile list (and the sheet, if you can see) | eyes, irises, lashes and brows as left/right pairs in the head run | a head box that cut off an ornament: move `head_box`, re-run the head crop |
2237
2237
  | `assemble` | one line per part — its counts (`op=` opaque, `vis=` visible, `src=` taken / candidates, `unproj=` visible but not projected, `drift=<n> (<p>% of core)`, `merged=`, `seam=`; *parts.json*, below). `drift=` is `refused_drift_px` in rig px and its share of the part's candidates, `projected_core_px`, which it is a subset of (issue #314); no bar reads either. On the four public examples the share runs to 94.5 % (`scarf` `hair_back`, 479 of 507) and the count to 26,472 (`scarf` `topwear`, 22.3 %), and the seam override repaints refused top-most pixels afterwards, so a large count says where See-through's colour was not taken, not that the part is unlike the painting: the `drift:` line below is the one that names a body of them another part holds. Then the `pixels:` totals (opaque = visible + occluded; taken; visible but not projected), then `recomposite vs source: mean \|d\|, within 8, error px > 40, uncovered error px`, then `uncovered holes (8-connected): N` and the largest five as `uncovered hole K: <px> px at x,y wxh (between "<part>" <px> px, …)`, then one `uncovered: <n> of the <N> uncovered error px lie on the full run's "<tag>", in a body of <px> px at x,y wxh; <the rule that left it out>` line per full-run layer the plan does not take from the full run whose uncovered error holds a body (5x5-opened, 8-connected, at least 150 full-run px in rig px), then one `drift: "<part>" refuses <n> px of <run>:<tag> (its colour more than 90 off the painting, max channel), in a body of <px> px at x,y wxh (…); by the plan's draw order "<holder>" holds <px> px of it (…), "<holder>" drawn in front of "<part>"` line per part whose drift refusals hold a body (the same opening and bar) that another part holds in the draw order — that layer is not what the painting shows there (none on the five public paintings); and look at `render/recomposite_error_rig.png`. Between the part lines and the totals, one `author-made: part "<part>" (<run>:author:<label>) — …` line per part from a layer the author made (below, *A layer the author made*), then one `cut: "<part>" opaque <n> = "<part>" <kept> + "<piece>" <taken> …` line per part an `assemble.cuts` entry cut (below; it ends `; under <n> px filled, <m> px left empty` when a cut of that part has `under`), then — with `config.limbs` (issue #349) — one `limb cut: "<part>" opaque <n> = "<segment part>" <px> + …` line per part a limb takes and one `limb cap:` line per joint, its cap's pixels from the cap image, from the layer and missing, and its box — under `cap_shape: "disc"` also from the upper segment, under `edge: "feather"` the pixels faded, under `cut_band` the line the cut was placed on and the stroke pixels it and the joint line cross (issue #360) (§3, *Limbs: cut at their joints*), then one `fringe pushed back: "<part>" <px> px, where the painting shows "<holder>" <px> px, …` line per part whose fringe was cleared (below) | on the examples: `reference-sample` 0.83 / 98.0 % / 4,359 / 1,185, 259 holes, the largest 94 px; `reference-demo` 2.34 / 95.8 % / 10,340 / 1,564, 453 holes, the largest 70 px (default rule) — many slivers along part edges, no hole a region could hide | one large hole: part of the figure is in no layer — a plan entry is missing, hair left the head crop sideways (reference-demo's `hair_back` is taken from the full run for that reason), or See-through split one garment into two and left the space between them in neither (a skirt as two trouser legs); the `between` parts say where. When neither run holds it at all, an `assemble.patches` entry cuts it from the painting (below) |
2238
- | `propose` | `note:` lines, `LINT` lines, the `coverage` lines, `landmarks.png`, `basis.json` | no LINT line: every chain link lies on its mesh's art, and the hip is below the chest and the figure's top quarter; the `coverage:` summary says how many bones that verdict covers — a `not checked` bone was read by no check (its line says why), and a `ratio` or `fallback` bone in `basis.json` is a guess | a link off the art (a bone on the background) — move it onto the layer; `LINT <link> at … runs to … N degrees off the head's down axis …` — a fringe link that does not lean with the head (§3, the fringe in the head's frame): move it along the lock it drives; `LINT hairback_… on mesh '<part>' (side <r\|l>): <N> tree(s) for <M> visible hair mass(es) (mass 0 columns x=<minX>..<maxX>, y=<minY>..<maxY>; …)` — back-hair cloth trees whose count does not match the side's visible hair masses (`max(1, floor(w / (4 * grid)) + 1)` per mass) or whose link or tip leaves its mass's column range (issues #445, #461): omit `chains` on `cloth."back hair"` or draft trees per visible hair mass inside its columns; `LINT <a_limb> and <b_limb> on <part> (<from>) cross at [x, y] with no per-limb split: …` — two limbs sharing one layer cross in an X without a per-limb split (issue #446): declare `config.limbs.<covering>.split` (`{ "line": [[x, y], …] }` or `{ "edge": "painting" }`, §3 *Which limb*); `LINT stop on <chain> (<firstLink> at [x0, y0]) against <against> (at [ax, ay]) places <chain>_touch at [tx, ty], above <firstLink>'s root (rest R deg, \|rest\| + outward B deg): …` — a stop's contact point `<chain>_touch` lies above `links[0]`'s root in rig px or pushes `\|rest\| + outward` past `180°` (issue #447, §2 `stops`): stop against the descending limb bone below `firstLink`, set `links` to start at a link below `<chain>_touch`, or omit the stop on a rising limb; `LINT hip at [x, y] is not below chest at [x, y]: …` or `LINT hip at [x, y] is above 0.25 of the figure height (figure y T..B, so hip y must be at least L): a hip at the shoulders` — move `hip` down to the waist (and `chest` between it and the neck); a `hanging strand … -- no chain proposed` note — that strand hangs stiff until you add a chain down the x and rows it names (§3); a `no blink: …` or `blink without brows: …` note — the idle will not blink (or its brows will not drop), because no part came from an `eyewhite` (or `eyebrow`) layer; the note names the tags looked for; a `no eyewhite part for eye_<s> …` note — the iris and lash parts it names ride `head` and do not blink, because no `eyewhite-<s>` part made that side's eye bone: take the eyewhite from the other run, or keep them on `head`; a `no face part: face box derived from …` note (always the first) — `head`, `neck` and every face-height scale come from a box guessed off the hair and neck (§3): check `head` and `neck` on `landmarks_head.png` and move them; when it adds `the blink shuts the eyes over no face part`, read `BLINK_NO_HOLE` after `check` — an eye with no face under it can open a hole (the `reference-sample` with only its face removed: 587 px). Under `--keypoints`: the `lint rule set:` line first (joints, or screen and why), then the joint notes — `missing: the rule "…" placed bone X instead` is a bone still guessed; `not used — …` names why an arm's joints did not place its sleeve (for a wrist on no part, the nearest part and the `--wrist-snap` that would bind it); a `wrist snap: …` note is a wrist bound past 15 px by the flag — check that chain's tip on `landmarks.png`; a `one handwear part holds both wrists` note is two chains on one mesh — cut the part with `assemble.cuts` to separate them; `LINT chest at … is not between the neck joint …`, `LINT hip at … is not past chest …`, `LINT hip at … is nearer the neck joint …` and `LINT <chain><i> at … does not advance from <s>_shoulder toward <s>_wrist` are the joint-frame lines: move that bone between, past or along the joints they name |
2238
+ | `propose` | `note:` lines, `LINT` lines, the `coverage` lines, `landmarks.png`, `basis.json` | no LINT line: every chain link lies on its mesh's art, and the hip is below the chest and the figure's top quarter; the `coverage:` summary says how many bones that verdict covers — a `not checked` bone was read by no check (its line says why), and a `ratio` or `fallback` bone in `basis.json` is a guess | a link off the art (a bone on the background) — move it onto the layer; `LINT <link> at … runs to … N degrees off the head's down axis …` — a fringe link that does not lean with the head (§3, the fringe in the head's frame): move it along the lock it drives; `LINT hairback_… on mesh '<part>' (side <r\|l>): <N> tree(s) for <M> visible hair mass(es) (mass 0 columns x=<minX>..<maxX>, y=<minY>..<maxY>; …)` — back-hair cloth trees whose count does not match the side's visible hair masses (`max(1, floor(w / (4 * grid)) + 1)` per mass) or whose link or tip leaves its mass's column range (issues #445, #461): omit `chains` on `cloth."back hair"` or draft trees per visible hair mass inside its columns; `LINT <a_limb> and <b_limb> on <part> (<from>) cross at [x, y] with no per-limb split: …` — two limbs sharing one layer cross in an X without a per-limb split (issue #446): declare `config.limbs.<covering>.split` (`{ "line": [[x, y], …] }` or `{ "edge": "painting" }`, §3 *Which limb*); `LINT foot_<s> at [x, y], the <s>_ankle joint and leg_<s>1's tip, lies on none of leg_<s>'s art within 1 px along its joint line (the nearest of it on that line is the pixel [x, y], D px from the joint): …` — an ankle keypoint off its leg's art on the line `assemble` sizes the ankle's cap by (issue #517): `propose` drafts every leg without its ankle cut, the shoe layer stays one part, and nothing is moved onto the art; move that ankle keypoint onto the leg's or the shoe's art and re-run `propose` (`(the line crosses none of it)` when no art lies on that line at all); `LINT stop on <chain> (<firstLink> at [x0, y0]) against <against> (at [ax, ay]) places <chain>_touch at [tx, ty], above <firstLink>'s root (rest R deg, \|rest\| + outward B deg): …` — a stop's contact point `<chain>_touch` lies above `links[0]`'s root in rig px or pushes `\|rest\| + outward` past `180°` (issue #447, §2 `stops`): stop against the descending limb bone below `firstLink`, set `links` to start at a link below `<chain>_touch`, or omit the stop on a rising limb; `LINT hip at [x, y] is not below chest at [x, y]: …` or `LINT hip at [x, y] is above 0.25 of the figure height (figure y T..B, so hip y must be at least L): a hip at the shoulders` — move `hip` down to the waist (and `chest` between it and the neck); a `hanging strand … -- no chain proposed` note — that strand hangs stiff until you add a chain down the x and rows it names (§3); a `no blink: …` or `blink without brows: …` note — the idle will not blink (or its brows will not drop), because no part came from an `eyewhite` (or `eyebrow`) layer; the note names the tags looked for; a `no eyewhite part for eye_<s> …` note — the iris and lash parts it names ride `head` and do not blink, because no `eyewhite-<s>` part made that side's eye bone: take the eyewhite from the other run, or keep them on `head`; a `no face part: face box derived from …` note (always the first) — `head`, `neck` and every face-height scale come from a box guessed off the hair and neck (§3): check `head` and `neck` on `landmarks_head.png` and move them; when it adds `the blink shuts the eyes over no face part`, read `BLINK_NO_HOLE` after `check` — an eye with no face under it can open a hole (the `reference-sample` with only its face removed: 587 px). Under `--keypoints`: the `lint rule set:` line first (joints, or screen and why), then the joint notes — `missing: the rule "…" placed bone X instead` is a bone still guessed; `not used — …` names why an arm's joints did not place its sleeve (for a wrist on no part, the nearest part and the `--wrist-snap` that would bind it); a `wrist snap: …` note is a wrist bound past 15 px by the flag — check that chain's tip on `landmarks.png`; a `one handwear part holds both wrists` note is two chains on one mesh — cut the part with `assemble.cuts` to separate them; `LINT chest at … is not between the neck joint …`, `LINT hip at … is not past chest …`, `LINT hip at … is nearer the neck joint …` and `LINT <chain><i> at … does not advance from <s>_shoulder toward <s>_wrist` are the joint-frame lines: move that bone between, past or along the joints they name |
2239
2239
  | `compare` | one line per pair (origin, parent, tip, length, direction — or SKIP and why), then the per-row summary, the unmapped bones of each side, `required:`, each side's roles and the `controls:` line | proposal against the config you corrected: the rows you changed and no others. Config against the `rig.json` `build` writes for it: measured on both examples, every origin within 6.19e-7 px (the rig's offsets are written to 6 places) and every chain link's tip and length within 4.99e-4 px (`length` is written to 3), printed to three places as `0.000` (a signed figure as `+0.000` or `-0.000`); `parent … is the right's ancestor at depth 2, <bone>_ctl between` for every keyed mesh bone, no `DIFFERENT` and no `NOT MAPPED` | `parent DIFFERENT: left a, right b` — a bone hangs from another parent than the other side's; `frames not related` — a rig with no stage (`skeleton.width`/`height`), two configs at different `rig_scale`: the distance rows SKIP, so declare the frame in a `--map` file if the author knows it; `FAIL STRUCTURE_REQUIRED_PRESENT` — a bone the map requires is missing through its pairs |
2240
2240
  | `rig` (inside `build`) | one line per mesh: vertices, triangles, bones, influences, `cover`; the `bones` line; the `idle keys` line; then rigc's gate lines (with A15's declared SKIP under `--idle-keys direct`); in `rig.json`, each chain link's (or its `_ctl`'s) `length` and `rotation` | `cover 1.00000` on every mesh, both gate summaries `0 failed` (the compile and the packed pages); every link's `length` the distance to the next link and `rotation` its direction (Spine degrees, counter-clockwise, y up, local to the parent), every offset under it — a child bone's `x, y`, a weight's bind `x, y`, a region's `x, y` — in that turned frame, and a region on a link carrying `rotation` that turns it back upright. Nothing moved: `flattenRig` (`src/rig.ts`) turns every offset back and gives the unturned numbers | `RIG_LATTICE_ONE_LOOP`: change that mesh's `grid` |
2241
2241
  | `check` (inside `build`) | the gate lines verbatim, the pack line, `loop:` (and `loop physics:` when the rig declares a physics constraint, §7), `seam:`, the six judgement lines, then — when `motion.json` holds an animation, the idle included — `ANIMATIONS_DO_NOT_FOLD` and one `folds` line per folding mesh, rigc's own (issues #320, #333), then — where a `footwear` part rides a bone that hangs from another — `FEET_STAY_LEVEL` and one `foot` line per such part (issue #348), then — when `parts.json` names a `handwear` part and there is an idle — `STRESS_OFF_CHAIN` (issue #347), then — where `parts.json` holds a limb segment's part — `LIMB_ONE_BONE` and one `limb` line per such part (issue #349), then — where a limb record carries a `range` — `SEAM_OVER_RANGE` and one `joint` line per joint and angle (issue #360), then `SEAM_OVER_MOTION` — a SKIP naming why on a rig that declares no neighbour pair, else the pairs read in every animation and one `WARN seam` line per pair and animation over the one-cell floor (issue #493, a warning and never a bar), then `CLOTH_SETTLES` — a SKIP naming why on a rig with no physics constraint, else the chains read and one `WARN chain` line per chain whose tip comes to rest before the idle's loop length (issue #501, a warning and never a bar), `RECOMPOSITE_HOLES` and, under `--source`, `SETUP_POSE_VS_SOURCE` (§7), `check.json`; the last line says how many of the bars measured — nine, ten with the fold bar, one more each with the feet-level bar, the stress bar, the limb bar and the range bar — and names the ones that said SKIP, then — where `SEAM_OVER_MOTION` read a pair — how many warnings it printed, `; N warning(s) (SEAM_OVER_MOTION, not a bar)` — with `CLOTH_SETTLES` named beside it, and N their sum, where the rig declares a physics constraint — which no bar counts | `check: PASS; 11 of 11 bar(s) measured, 0 skipped` on `demo` and `scarf`, whose sleeves each ride one chain; `check: PASS; 10 of 11 bar(s) measured, 1 skipped (STRESS_OFF_CHAIN)` on `reference-demo` and `reference-sample`, whose one `sleeves` mesh rides both sleeve chains (issue #347) — no example writes `FEET_STAY_LEVEL`, every shoe riding `root`; a judgement line SKIP only where the character lacks what it reads; on a rig spec with no `parts.json` or no `idle` (a merged rig, §7 *Measuring a rig rig-parts did not assemble*), PASS with the skipped bars named | `CHECK_SEAM_WITHIN_BAR` or `CHECK_LOOP_CLOSES` (§6); `CHECK_ANIMATIONS_DO_NOT_FOLD` — a clip turns a mesh over (§6); `CHECK_STRESS_OFF_CHAIN` — a sleeve weighted off its chain (§6); `CHECK_LIMB_ONE_BONE` — a limb part on a second bone (§6); `CHECK_SEAM_OVER_RANGE` — a joint that opens when bent (§6) |
@@ -2698,7 +2698,7 @@ whites, an earring — antialiased strokes that are mostly rim, and the largest
2698
2698
  because an opaque white garment has the page's colour and is a real part.
2699
2699
 
2700
2700
  No example layer crosses a rule, so their proposals are unchanged. For the haze the
2701
- selftest plants (`PL03`, `PL06`: near-white, four pixels in five at alpha 40, 2.000x the
2701
+ selftest plants (`PU03`, `PU06`: near-white, four pixels in five at alpha 40, 2.000x the
2702
2702
  rest of the figure), the `WARN` line and the note say the same thing:
2703
2703
 
2704
2704
  ```
@@ -2828,7 +2828,7 @@ says why each requirement exists and what breaks without it.
2828
2828
  | <a id="ASSEMBLE_UNDER_FILL_SOURCE"></a>`ASSEMBLE_UNDER_FILL_SOURCE` | a cut declares `under_fill` and has no under to fill with: it names no `under` file and its part has no hidden-art layer (issue #360) | name the cut's `under`, or drop `under_fill` |
2829
2829
  | <a id="ASSEMBLE_UNDER_DRAW"></a>`ASSEMBLE_UNDER_DRAW` | a cut with `under` draws its piece behind its part, which the fill would hide it under | that cut's `draw`: `"front"`, or `{"before": …}` the plan part after its `from` |
2830
2830
  | <a id="ASSEMBLE_LIMB_TAKES"></a><a id="ASSEMBLE_LIMB_PIXELS"></a>`ASSEMBLE_LIMB_TAKES`, `ASSEMBLE_LIMB_PIXELS` | a part a limb takes has no opaque pixel, or a limb segment gets none of it — the joint lines through the bones' origins put none of the limb's pixels on it, or another limb's polyline is nearer every one (issue #349) | the bones: their origins on the limb's art, each joint where the limb bends |
2831
- | <a id="ASSEMBLE_LIMB_JOINT"></a><a id="ASSEMBLE_LIMB_JOINT_ON_ART"></a>`ASSEMBLE_LIMB_JOINT`, `ASSEMBLE_LIMB_JOINT_ON_ART` | a joint has no line — the upper bone has no length, or the limb folds straight back on itself — or its bone's origin lies on none of the limb's art within 1 px along the line, so the limb has no width there to size the cap by (issue #349); under `cap_shape: "disc"`, also a bone's origin on the very edge of the run, which has no half-width about it (issue #360) | the joint's bone: on the limb's art, at the joint |
2831
+ | <a id="ASSEMBLE_LIMB_JOINT"></a><a id="ASSEMBLE_LIMB_JOINT_ON_ART"></a>`ASSEMBLE_LIMB_JOINT`, `ASSEMBLE_LIMB_JOINT_ON_ART` | a joint has no line — the upper bone has no length, or the limb folds straight back on itself — or its bone's origin lies on none of the limb's art within 1 px along the line, so the limb has no width there to size the cap by (issue #349) — the detail names the nearest pixel of the limb's art on that line and its distance from the joint, or says the line crosses none of it (issue #517); under `cap_shape: "disc"`, also a bone's origin on the very edge of the run, which has no half-width about it (issue #360) | the joint's bone: on the limb's art, at the joint |
2832
2832
  | <a id="ASSEMBLE_LIMB_CUT_BAND"></a>`ASSEMBLE_LIMB_CUT_BAND` | a segment's `cut_band` reaches past the limb: a line of its band, the detail names the one nearest the joint and a point it passes through, crosses none of the limb's art within 1 px of that point, so a cut placed there would cut nothing (issue #360) | `cut_band`: the widest band whose every line crosses the limb, which the detail gives |
2833
2833
  | <a id="ASSEMBLE_LIMB_CAP_PRESENT"></a><a id="ASSEMBLE_LIMB_CAP_DECODES"></a><a id="ASSEMBLE_LIMB_CAP_SIZE"></a><a id="ASSEMBLE_LIMB_CAP_EMPTY"></a>`ASSEMBLE_LIMB_CAP_PRESENT`, `ASSEMBLE_LIMB_CAP_DECODES`, `ASSEMBLE_LIMB_CAP_SIZE`, `ASSEMBLE_LIMB_CAP_EMPTY` | a segment's `cap` names no file (relative to the config's directory) or one that is not a PNG; an image not the size of the cap's box (the detail gives both, and the box's corner); or one transparent over every cap pixel (issue #349) | the image: the box the `limb cap:` line prints, `w`x`h`, its pixel `(i, j)` rig pixel `(x + i, y + j)`; to keep the layer's cap, drop `cap` |
2834
2834
  | <a id="ASSEMBLE_HIDDEN_ONE_SOURCE"></a>`ASSEMBLE_HIDDEN_ONE_SOURCE` | a cut's `under`, or a limb segment's `cap`, names a file, and the part it reads also has a hidden-art layer (`<layer>:hidden`, issue #359): reading either would be a guess | remove the file from the config, or the hidden-art layer from the input |
@@ -3620,7 +3620,7 @@ examples `rig.json`, `motion.json`, every image, the atlas, the packed page and
3620
3620
  every idle frame are byte-identical once `<id>:` and `<id>.` are taken off, and
3621
3621
  `skeleton.json` and `skeleton.model.json` equal as values but for Spine's `path`
3622
3622
  and the model's `spine.sha256`, which on each side is the sha256 of its own
3623
- `skeleton.json` and so changes with the names (selftest `SC33`).
3623
+ `skeleton.json` and so changes with the names (selftest `CH910`).
3624
3624
 
3625
3625
  **Not offered.** Reconciling two `rig_scale`s (one is required; `scale` sizes a
3626
3626
  character, it does not resample its art); a non-uniform scale, a flip or a rotation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rig-c/parts",
3
- "version": "1.41.0",
3
+ "version": "1.42.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/assemble.ts CHANGED
@@ -104,7 +104,7 @@ import { type Problem, refuseIfAny } from './errors.ts';
104
104
  import { figuresPhrase, implausibleRules, type Layer, type LayerFigures, layerFigures, type LayerSet, NEAR_WHITE_MIN, OPAQUE_ALPHA_ABOVE, ruleSummary } from './layers.ts';
105
105
  import { padToSquare, squarePad } from './inputs.ts';
106
106
  import { type CapRecord, type LimbRecord, PAINTING_RUN, type PartRecord, type PartsFile, type RecompositeRecord, type SceneRecord, type SingleRunPad } from './parts.ts';
107
- import { assignCrossedLimbs, assignOverlappingHands, type BonePlace, bonePlaces, capBox, coveredRadius, type CutPlacement, featherWeight, halfWidthAbout, inDisc, jointLine, type JointLine, jointOffsets, limbPolyline, limbRun, luma601, nearestLimb, pastJoint, placeCut, segmentOf } from './limbs.ts';
107
+ import { assignCrossedLimbs, assignOverlappingHands, type BonePlace, bonePlaces, capBox, coveredRadius, type CutPlacement, featherWeight, halfWidthAbout, inDisc, jointLine, type JointLine, jointOffsets, limbPolyline, limbRun, luma601, nearestLimb, nearestOnLine, offLineFigure, pastJoint, placeCut, segmentOf } from './limbs.ts';
108
108
  import {
109
109
  alphaComposite,
110
110
  connectedComponents,
@@ -3000,7 +3000,7 @@ function cutLimbs(
3000
3000
  problems.push({
3001
3001
  code: 'ASSEMBLE_LIMB_JOINT_ON_ART',
3002
3002
  object,
3003
- detail: `the joint, "${sg.bone}"'s origin at [${line.at.join(', ')}], lies on none of the limb's art within 1 px along its joint line, so the limb has no width there to size the cap by; a bone origin on the limb's art (alpha above ${OPAQUE_ALPHA_ABOVE}) is required — move the bone onto the joint`,
3003
+ detail: `the joint, "${sg.bone}"'s origin at [${line.at.join(', ')}], lies on none of the limb's art within 1 px along its joint line (${offLineFigure(nearestOnLine(line, art, [0, 0, W - 1, H - 1]))}), so the limb has no width there to size the cap by; a bone origin on the limb's art (alpha above ${OPAQUE_ALPHA_ABOVE}) is required — move the bone onto the joint`,
3004
3004
  });
3005
3005
  return;
3006
3006
  }
package/src/cloth.ts CHANGED
@@ -101,8 +101,26 @@ export interface ClothRecipe {
101
101
  part?: string | string[];
102
102
  /** A list of parts the recipe's trees run through in order from root to tip, one chain across the union and each link weighted to the part whose pixels it crosses (issue #437; the single-part form is the one-element list). */
103
103
  parts?: string[];
104
+ /**
105
+ * Issue #518: draft the parts this recipe meshes in the influence mode (`meshes.<part>.influence`, issue #378) rather
106
+ * than on a lattice: `across`, `max` and `shape` as declared (no default — the reading that fixed the radius did not
107
+ * vary them), `cell` the lattice cell the part would have had, and `radius` as declared or, absent, drafted as
108
+ * {@link INFLUENCE_RADIUS_CELLS} cells past the part's farthest lattice vertex from its nearest link.
109
+ */
110
+ influence?: { across: boolean; max: number; shape: 'linear' | 'smooth'; radius?: number };
104
111
  }
105
112
 
113
+ /**
114
+ * 📐 Issue #518: the drafted influence radius is the part's farthest lattice vertex from its nearest link (the figure
115
+ * `RIG_INFLUENCE_REACH` holds the radius above) plus this many of the part's lattice cells. Measured in #513 on the
116
+ * cloth fixture and the public `wind` example (8 covered parts, `render --folds` with the physics on under wind
117
+ * +1 -> -1 -> calm and a hip sway of 8 and 30 degrees, max 6, across, smooth): farthest + 2 to + 6 cells read 0
118
+ * folded frames on every part, + 2 at the window's edge on one front-hair part, and a fold returned at 8-11 cells on
119
+ * another. 3 is one cell inside that edge. [Hypothesis until a third subject: each edge rests on one part.] Past the
120
+ * floor alone the mesh folds more than its lattice, and a larger radius is not safer; no ceiling is drafted.
121
+ */
122
+ export const INFLUENCE_RADIUS_CELLS = 3;
123
+
106
124
  export type ClothRecipes = Partial<Record<ClothTarget, ClothRecipe>>;
107
125
 
108
126
  /**
package/src/config.ts CHANGED
@@ -3414,7 +3414,7 @@ function checkCloth(c: Check, v: Json): void {
3414
3414
  for (const tag of CLOTH_TARGETS) {
3415
3415
  if (!(tag in v)) continue;
3416
3416
  const path = `${at}.${JSON.stringify(tag)}`;
3417
- const r = c.object(path, v[tag], ['links', 'wind', 'gravity'], ['chains', 'split', 'length_ratio', 'strength', 'damping', 'alternate_damping', 'translate', 'swing', 'part', 'parts']);
3417
+ const r = c.object(path, v[tag], ['links', 'wind', 'gravity'], ['chains', 'split', 'length_ratio', 'strength', 'damping', 'alternate_damping', 'translate', 'swing', 'part', 'parts', 'influence']);
3418
3418
  if (r === null) continue;
3419
3419
  if (tag !== 'back hair' && !('chains' in r)) c.fail('CONFIG_FIELD_PRESENT', `${path}.chains`, 'is absent and required');
3420
3420
  const chains = 'chains' in r && c.int(`${path}.chains`, r.chains, 1) ? (r.chains as number) : null;
@@ -3431,6 +3431,17 @@ function checkCloth(c: Check, v: Json): void {
3431
3431
  }
3432
3432
  }
3433
3433
  if ('length_ratio' in r) c.number(`${path}.length_ratio`, r.length_ratio, 'positive');
3434
+ // Issue #518: the influence mode for the parts this recipe meshes; the three fields #513 did not vary are the
3435
+ // author's, each required, and radius, when stated, is kept as stated (the rig stage holds it to the reach).
3436
+ if ('influence' in r) {
3437
+ const o = c.object(`${path}.influence`, r.influence, ['across', 'max', 'shape'], ['radius']);
3438
+ if (o !== null) {
3439
+ if ('across' in o && typeof o.across !== 'boolean') c.fail('CONFIG_FIELD_TYPE', `${path}.influence.across`, `is ${show(o.across)}; true (every link within radius pulls, across the segments entries) or false (only the links of the entry nearest the vertex) is required`);
3440
+ if ('max' in o) c.int(`${path}.influence.max`, o.max, 1);
3441
+ if ('shape' in o && o.shape !== 'linear' && o.shape !== 'smooth') c.fail('CONFIG_FIELD_TYPE', `${path}.influence.shape`, `is ${show(o.shape)}; "linear" (1 - x) or "smooth" (1 - x²(3 - 2x)) is required`);
3442
+ if ('radius' in o) c.number(`${path}.influence.radius`, o.radius, 'positive');
3443
+ }
3444
+ }
3434
3445
  if ('strength' in r) {
3435
3446
  const st = c.object(`${path}.strength`, r.strength, ['trunk', 'branch', 'edge'], []);
3436
3447
  if (st !== null) for (const k of ['trunk', 'branch', 'edge'] as const) if (k in st) c.number(`${path}.strength.${k}`, st[k], 'positive');
package/src/limbs.ts CHANGED
@@ -105,6 +105,7 @@
105
105
  * crossing.
106
106
  */
107
107
  import type { BoneEntry, Limb, LimbSplit } from './config.ts';
108
+ import { pyRound } from './round.ts';
108
109
 
109
110
  export type Pt = [number, number];
110
111
 
@@ -317,6 +318,35 @@ export function limbRun(line: JointLine, art: (x: number, y: number) => boolean,
317
318
  return runOfOffsets(ts);
318
319
  }
319
320
 
321
+ /**
322
+ * The pixel of the limb's art on a joint line nearest the joint (issue #517):
323
+ * among the pixels {@link limbRun} reads (centre within half a pixel of the
324
+ * line), the one whose offset along the line is smallest in size — that
325
+ * distance from the joint, and the pixel; the first in row order wins a tie.
326
+ * Null when the line crosses none of the art. Where {@link limbRun} is null
327
+ * this is how far off the art the joint sits along its own line, the figure
328
+ * `ASSEMBLE_LIMB_JOINT_ON_ART` and propose's `limb-joint-off-art` LINT print.
329
+ */
330
+ export function nearestOnLine(line: JointLine, art: (x: number, y: number) => boolean, box: readonly [number, number, number, number]): { distance: number; at: Pt } | null {
331
+ const [ax, ay] = line.axis;
332
+ let best: { distance: number; at: Pt } | null = null;
333
+ for (let y = box[1]; y <= box[3]; y++) {
334
+ for (let x = box[0]; x <= box[2]; x++) {
335
+ const dx = x + 0.5 - line.at[0];
336
+ const dy = y + 0.5 - line.at[1];
337
+ if (Math.abs(dx * ax + dy * ay) > 0.5 || !art(x, y)) continue;
338
+ const d = Math.abs(-dx * ay + dy * ax);
339
+ if (best === null || d < best.distance) best = { distance: d, at: [x, y] };
340
+ }
341
+ }
342
+ return best;
343
+ }
344
+
345
+ /** {@link nearestOnLine}'s figure as the refusal and the LINT word it: the pixel and its distance to 3 places, or that the line crosses none of the art. */
346
+ export function offLineFigure(n: { distance: number; at: Pt } | null): string {
347
+ return n === null ? 'the line crosses none of it' : `the nearest of it on that line is the pixel [${n.at.join(', ')}], ${pyRound(n.distance, 3)} px from the joint`;
348
+ }
349
+
320
350
  /** The run through 0 of the offsets `ts` along a line ({@link limbRun}): sorted, the nearest within 1 px, grown while neighbours are at most 1.5 apart. Sorts `ts` in place. */
321
351
  function runOfOffsets(ts: number[]): [number, number] | null {
322
352
  if (ts.length === 0) return null;
package/src/propose.ts CHANGED
@@ -142,15 +142,17 @@ import { type Mask, newMask, newRaster, type Raster } from './raster/types.ts';
142
142
  import { npMean, npMedian, npPercentile, pyFixed, pyInt, pyIntList, pyRepr, pyRound, pyStrList } from './pyfmt.ts';
143
143
  import type { JointState, RigJoint, RigJoints } from './keypoints.ts';
144
144
  import { IDLE_FPS } from './motion.ts';
145
+ import { influenceFarthest } from './rig.ts';
146
+ import { type Segment as WeightSegment } from './weights.ts';
145
147
  import { pyRound as roundTo } from './round.ts';
146
148
  import { KEYPOINT_NAMES, type KeypointName } from './skeleton.ts';
147
149
  import { configRoles, type RoleOf } from './structure.ts';
148
150
  import { AUTHOR_NO_ROLE, isAuthorTag } from './tags.ts';
149
151
  import { TURN_BONE, TURN_CARRIER_TAG, TURN_PLACES, TURN_RIDER_OFFSET, TURN_RIDER_TAGS, turnFractions, turnNearest, turnPivot, turnRiderDepth, type TurnSpec } from './turn.ts';
150
152
  import { edgeLength } from './length.ts';
151
- import { bonePlaces, limbCrossing, limbPolyline, limbWidth } from './limbs.ts';
153
+ import { bonePlaces, jointLine, limbCrossing, limbPolyline, limbRun, limbWidth, nearestLimb, nearestOnLine, offLineFigure, type Pt } from './limbs.ts';
152
154
  import { type BranchSqueezeFinding, branchSqueezes, chainSqueezes, type SqueezeFinding } from './squeeze.ts';
153
- import { backHairMasses, type BackHairMass, backHairMassTrees, RECIPE_BACK_HAIR_CHAINS, RECIPE_LENGTH_RATIO, chainConstraints, clothNote, type ClothRecipe, type ClothRecipes, type ClothTarget, CLOTH_TARGETS, draftTrees, spanCrosses, swingName, type Tail, tailOverlap, type TailOverlap, type TailSpan, treeConstraints, type TreeChain, type TreeInput, type TreeMassInput } from './cloth.ts';
155
+ import { backHairMasses, type BackHairMass, backHairMassTrees, INFLUENCE_RADIUS_CELLS, RECIPE_BACK_HAIR_CHAINS, RECIPE_LENGTH_RATIO, chainConstraints, clothNote, type ClothRecipe, type ClothRecipes, type ClothTarget, CLOTH_TARGETS, draftTrees, spanCrosses, swingName, type Tail, tailOverlap, type TailOverlap, type TailSpan, treeConstraints, type TreeChain, type TreeInput, type TreeMassInput } from './cloth.ts';
154
156
  import { TEXTURE_STRETCH_CEILING } from './check.ts';
155
157
 
156
158
  // ---------------------------------------------------------------------------
@@ -1392,7 +1394,7 @@ export function proposeWithBasis(
1392
1394
  gridRule: GridRule = DEFAULT_GRID_RULE,
1393
1395
  cloth: ClothRecipes | null = null,
1394
1396
  chainRule = true,
1395
- ): { proposal: Proposal; basis: ProposalBasis } {
1397
+ ): { proposal: Proposal; basis: ProposalBasis; draftLint: DraftLintFinding[] } {
1396
1398
  // Issue #230: a piece is not given its base's rule a second time, which
1397
1399
  // needs to know which part is the piece. A file that cannot say is refused
1398
1400
  // here, and only here: every other reader of parts.json still takes it.
@@ -1423,6 +1425,8 @@ export function proposeWithBasis(
1423
1425
  const records: BoneBasis[] = [];
1424
1426
  /** Issue #349: the limbs `--keypoints` drafts, and the parts they take (not made, so not given a mesh or a region). */
1425
1427
  const limbs: Record<string, Limb> = Object.create(null) as Record<string, Limb>;
1428
+ /** Issue #517: the ankles left uncut because they lie off their leg's art — LINT lines, handed back beside the proposal. */
1429
+ const jointsOffArt: LimbJointOffArtFinding[] = [];
1426
1430
  const consumed = new Set<string>();
1427
1431
  // No prototype: a part may be named anything file-safe, "__proto__" included.
1428
1432
  const meshes = Object.create(null) as Record<string, MeshSpec>;
@@ -1557,6 +1561,8 @@ export function proposeWithBasis(
1557
1561
  // Issue #364: the trees a cloth recipe drafts, their constraints, and the tags it was used on.
1558
1562
  const clothConstraints: ConfigConstraint[] = [];
1559
1563
  const clothUsed = new Set<ClothTarget>();
1564
+ /** Issue #518: each part a recipe meshes, by the target whose recipe drafted its mesh. */
1565
+ const clothMeshed = new Map<string, ClothTarget>();
1560
1566
  const multiPartClaimed = new Set<string>();
1561
1567
  const recipeOf = (tag: ClothTarget): ClothRecipe | null => cloth?.[tag] ?? null;
1562
1568
  const declaredPartsOf = (tag: ClothTarget): { field: 'parts' | 'part'; list: PartRecord[] } | null => {
@@ -1952,6 +1958,7 @@ export function proposeWithBasis(
1952
1958
  linkSummary.push(`${q.name}: ${crossedDesc.join(', ')}`);
1953
1959
  delete regions[q.name];
1954
1960
  meshes[q.name] = { grid: gq, r: rcp.split?.hold_tip === true ? Math.max(rq, gq) : rq, segments: qSegs };
1961
+ clothMeshed.set(q.name, 'back hair');
1955
1962
  multiPartClaimed.add(q.name);
1956
1963
  }
1957
1964
  notes.push(
@@ -2119,6 +2126,7 @@ export function proposeWithBasis(
2119
2126
  ),
2120
2127
  );
2121
2128
  meshes[p.name] = { grid: g, r: rawRcp.split?.hold_tip === true ? Math.max(r, g) : r, segments: segs };
2129
+ clothMeshed.set(p.name, 'back hair');
2122
2130
  // Issue #391: the spans are this mesh's segments, the head's fixed one and every tree link, in segment order.
2123
2131
  const spans: TailSpan[] = [{ bone: 'head', a: rnd(head), b: rnd([axis, top + 13]), link: false }];
2124
2132
  for (const t of all) {
@@ -2295,6 +2303,7 @@ export function proposeWithBasis(
2295
2303
  }
2296
2304
  const frontRcp = recipeOf('front hair');
2297
2305
  meshes[p.name] = { grid: g, r: frontRcp?.split?.hold_tip === true && k > 0 ? Math.max(r, g) : r, segments: segs };
2306
+ if (frontRcp !== null && clothUsed.has('front hair')) clothMeshed.set(p.name, 'front hair');
2298
2307
  }
2299
2308
 
2300
2309
  // ---- accessories: rigid body + pendant chain where the part narrows, or one pendulum chain per hanging strand
@@ -3100,6 +3109,7 @@ export function proposeWithBasis(
3100
3109
  linkSummary.push(`${q.name}: ${crossedDesc.join(', ')}`);
3101
3110
  delete regions[q.name];
3102
3111
  meshes[q.name] = { grid: gq, r: dressRecipe.split?.hold_tip === true ? Math.max(rq, gq) : rq, segments: qSegs };
3112
+ clothMeshed.set(q.name, 'bottomwear');
3103
3113
  multiPartClaimed.add(q.name);
3104
3114
  }
3105
3115
  notes.push(
@@ -3170,6 +3180,7 @@ export function proposeWithBasis(
3170
3180
  ),
3171
3181
  );
3172
3182
  meshes[p.name] = { grid: g, r: skirtRecipe.split?.hold_tip === true ? Math.max(r, g) : r, segments: segs };
3183
+ clothMeshed.set(p.name, 'bottomwear');
3173
3184
  continue;
3174
3185
  }
3175
3186
  for (const [tag, f, ph] of [
@@ -3239,7 +3250,11 @@ export function proposeWithBasis(
3239
3250
  // shoes split between one leg's foot and no other would hand that leg the other shoe.
3240
3251
  const legChains = legPlan.chains;
3241
3252
  const feetOn = legChains.map((c) => fw.filter((q) => isOn(nearFoot.get(q) as Mask, c.ankle[0], c.ankle[1])));
3242
- const feetBound = fw.length > 0 && feetOn.every((on) => on.length === 1);
3253
+ // Issue #517: and only when every ankle lies on its leg's art along its joint line, as assemble reads it — or the
3254
+ // config drafted here is one assemble refuses by ASSEMBLE_LIMB_JOINT_ON_ART. An ankle off it is LINTed, not moved.
3255
+ const offArt = fw.length > 0 && feetOn.every((on) => on.length === 1) ? anklesOffArt(P, legChains, feetOn.map((on) => on[0])) : [];
3256
+ jointsOffArt.push(...offArt);
3257
+ const feetBound = fw.length > 0 && feetOn.every((on) => on.length === 1) && offArt.length === 0;
3243
3258
  legChains.forEach((c, ci) => {
3244
3259
  const s = c.side as 'r' | 'l';
3245
3260
  const J = (joints as RigJoints).joints;
@@ -3259,6 +3274,8 @@ export function proposeWithBasis(
3259
3274
  regions[`foot_${s}`] = `foot_${s}`;
3260
3275
  consumed.add(on[0].name);
3261
3276
  foot = `, and foot_${s}, ${on[0].name}'s share below the ankle, on bone foot_${s} at the ${s}_ankle joint under leg_${s}1 with inherit "${FOOT_INHERIT}" — the shoe keeps its setup angle while the leg turns (FEET_STAY_LEVEL)`;
3277
+ } else if (offArt.length > 0) {
3278
+ foot = `; no foot segment: ${offArt.map((f) => `${f.keypoint} at ${fmtAt(f.at)} lies on none of leg_${f.side}'s art within 1 px along its joint line (${offLineFigure(f.nearest)})`).join('; ')}, so assemble could not size the ankle's cap — every leg's ankle must lie on its leg's art for the feet to be drafted, and ${offArt.length === 1 ? 'its' : 'their'} LINT line${offArt.length === 1 ? ' says' : 's say'} how far off; move the ankle keypoint onto the art and re-run propose`;
3262
3279
  } else if (fw.length > 0) {
3263
3280
  const where = (k: number): string => {
3264
3281
  const o = feetOn[k];
@@ -3357,10 +3374,34 @@ export function proposeWithBasis(
3357
3374
  );
3358
3375
  }
3359
3376
  }
3377
+ // Issue #518: a recipe that declares `influence` has the parts it meshes drafted in the influence mode, each at the
3378
+ // cell its lattice had, and — unless the recipe states the radius — at the radius INFLUENCE_RADIUS_CELLS cells past
3379
+ // the farthest lattice vertex from its nearest link, measured as the rig stage measures it (influenceFarthest).
3380
+ const radii: InfluenceRadiusFinding[] = [];
3381
+ for (const [name, tag] of clothMeshed) {
3382
+ const decl = recipeOf(tag)?.influence;
3383
+ const m = meshes[name];
3384
+ if (decl === undefined || m === undefined || !('grid' in m)) continue;
3385
+ const segments = m.segments;
3386
+ const cell = m.grid;
3387
+ let radius = decl.radius;
3388
+ if (radius === undefined) {
3389
+ const rec = P.recs.find((q) => q.name === name) as PartRecord;
3390
+ const farthest = influenceFarthest(P.images.get(name) as Raster, rec.x, rec.y, meshSegmentsOf(bones, segments), cell);
3391
+ if (farthest === null) {
3392
+ notes.push(`${name}: config.cloth.${JSON.stringify(tag)}.influence is declared, and rig-c's segments lattice refuses the part at cell ${cell}, so no radius is measured and it keeps its lattice mesh`);
3393
+ continue;
3394
+ }
3395
+ radius = roundTo(farthest + INFLUENCE_RADIUS_CELLS * cell, 4);
3396
+ radii.push({ kind: 'influence-radius', part: name, tag, radius, farthest: roundTo(farthest, 4), cells: INFLUENCE_RADIUS_CELLS, cell });
3397
+ }
3398
+ meshes[name] = { influence: { cell, radius, across: decl.across, max: decl.max, shape: decl.shape }, segments };
3399
+ }
3360
3400
  const constrained = clothConstraints.length === 0 ? {} : { constraints: clothConstraints };
3361
3401
  return {
3362
3402
  proposal: { bones, meshes, regions, ...drafted, motion: blink === undefined ? { duration: IDLE_SECONDS, tracks: idleTracks } : { duration: IDLE_SECONDS, tracks: idleTracks, blink }, ...constrained, proposed_rig_scale: P.rigScale, notes },
3363
3403
  basis: { frame, bones: records },
3404
+ draftLint: [...jointsOffArt, ...radii],
3364
3405
  };
3365
3406
  }
3366
3407
 
@@ -3656,6 +3697,69 @@ function armsFromJoints(
3656
3697
  * joints it runs through, its two links and tip in rig px, and the legwear
3657
3698
  * part its limb takes (issue #349).
3658
3699
  */
3700
+ /**
3701
+ * Issue #517: the ankles of `legs` (each bound to the footwear part `feet[i]`) that lie on none of their leg's art
3702
+ * within 1 px along the joint line, read as assemble's cap reads it (`cutLimbs` in `src/assemble.ts`): the line
3703
+ * through the ankle across the shin bone's direction (knee -> ankle; the foot bone has no tip), the art each leg's
3704
+ * polyline (hip, knee, ankle, as the bones round them) owns by {@link nearestLimb} among the legs taking the same part,
3705
+ * in the legwear part and in its footwear part, alpha above {@link OPAQUE_ALPHA_ABOVE}. Empty when every ankle is on it.
3706
+ */
3707
+ function anklesOffArt(P: PartSet, legs: readonly LegChain[], feet: readonly PartRecord[]): LimbJointOffArtFinding[] {
3708
+ const polys = legs.map((c) => [rnd(c.hip), rnd(c.knee), rnd(c.ankle)] as Pt[]);
3709
+ const box = [0, 0, P.W - 1, P.H - 1] as const;
3710
+ const out: LimbJointOffArtFinding[] = [];
3711
+ legs.forEach((c, i) => {
3712
+ const line = jointLine(rnd(c.knee), rnd(c.ankle), null);
3713
+ if (line === null) return;
3714
+ const takers = (part: PartRecord, of: (k: number) => PartRecord): number[] => legs.map((_, k) => k).filter((k) => of(k).name === part.name);
3715
+ const owned = (part: PartRecord, of: (k: number) => PartRecord): ((x: number, y: number) => boolean) => {
3716
+ const m = P.alpha(part);
3717
+ const ks = takers(part, of);
3718
+ const lines = ks.map((k) => polys[k]);
3719
+ return (x, y) => m.data[y * P.W + x] === 1 && ks[ks.length === 1 ? 0 : nearestLimb(lines, x, y)] === i;
3720
+ };
3721
+ const onLeg = owned(c.part, (k) => legs[k].part);
3722
+ const onFoot = owned(feet[i], (k) => feet[k]);
3723
+ const art = (x: number, y: number): boolean => x >= 0 && y >= 0 && x < P.W && y < P.H && (onLeg(x, y) || onFoot(x, y));
3724
+ if (limbRun(line, art, box) !== null) return;
3725
+ out.push({ kind: 'limb-joint-off-art', side: c.side, limb: `leg_${c.side}`, keypoint: `${c.side}_ankle`, part: `foot_${c.side}`, from: feet[i].name, link: `leg_${c.side}1`, at: rnd(c.ankle), nearest: nearestOnLine(line, art, box) });
3726
+ });
3727
+ return out;
3728
+ }
3729
+
3730
+ /**
3731
+ * Issue #518: a mesh's `segments` resolved to lines on the bones `bones` declares, as the rig stage resolves them
3732
+ * (`src/rig.ts`): a chain's name to each of its links, from the link's origin to the next link's or the tip; a single
3733
+ * bone to its origin and tip; an explicit `[bone, from, to]` as written. A name with no line resolves to nothing — the
3734
+ * rig stage names it (`RIG_SEGMENT_DEFINED`, `RIG_NAME_RESOLVES`).
3735
+ */
3736
+ function meshSegmentsOf(bones: readonly BoneEntry[], segments: readonly Segment[]): WeightSegment[] {
3737
+ const out: WeightSegment[] = [];
3738
+ for (const sp of segments) {
3739
+ if (typeof sp !== 'string') {
3740
+ out.push({ bone: sp[0], a: [sp[1][0], sp[1][1]], b: [sp[2][0], sp[2][1]] });
3741
+ continue;
3742
+ }
3743
+ const chain = bones.find((e) => 'chain' in e && e.chain === sp);
3744
+ if (chain !== undefined && 'chain' in chain) {
3745
+ chain.points.forEach((q, k) => {
3746
+ const end = k + 1 < chain.points.length ? chain.points[k + 1] : chain.tip;
3747
+ out.push({ bone: `${sp}${k}`, a: [q[0], q[1]], b: [end[0], end[1]] });
3748
+ });
3749
+ continue;
3750
+ }
3751
+ const link = bones.flatMap((e) => ('chain' in e ? e.points.map((q, k) => ({ name: `${e.chain}${k}`, a: q, b: k + 1 < e.points.length ? e.points[k + 1] : e.tip })) : []));
3752
+ const l = link.find((x) => x.name === sp);
3753
+ if (l !== undefined) {
3754
+ out.push({ bone: sp, a: [l.a[0], l.a[1]], b: [l.b[0], l.b[1]] });
3755
+ continue;
3756
+ }
3757
+ const single = bones.find((e) => !('chain' in e) && e.name === sp);
3758
+ if (single !== undefined && !('chain' in single) && single.tip !== undefined) out.push({ bone: sp, a: [single.at[0], single.at[1]], b: [single.tip[0], single.tip[1]] });
3759
+ }
3760
+ return out;
3761
+ }
3762
+
3659
3763
  interface LegChain {
3660
3764
  chain: string;
3661
3765
  side: 'r' | 'l';
@@ -4336,6 +4440,42 @@ export interface StopTouchAboveRootFinding {
4336
4440
  outward: number;
4337
4441
  }
4338
4442
 
4443
+ /**
4444
+ * Issue #517: a leg's ankle keypoint lies on none of the leg's art within 1 px along its joint line, as assemble reads
4445
+ * the joint, so `propose` drafted the leg without its ankle cut ({@link anklesOffArt}): `at` the ankle (rig px), `link`
4446
+ * the chain link whose tip it is, and the nearest pixel of the leg's art on that line, or null when the line crosses
4447
+ * none. Handed to {@link lint} by `propose`; the keypoint is not moved onto the art (no value the author did not state).
4448
+ */
4449
+ export interface LimbJointOffArtFinding {
4450
+ kind: 'limb-joint-off-art';
4451
+ side: 'r' | 'l';
4452
+ limb: string;
4453
+ keypoint: KeypointName;
4454
+ part: string;
4455
+ from: string;
4456
+ link: string;
4457
+ at: Point;
4458
+ nearest: { distance: number; at: Pt } | null;
4459
+ }
4460
+
4461
+ /**
4462
+ * Issue #518: an influence radius `propose --cloth` drafted (no radius stated in the recipe): the part, the recipe's
4463
+ * target, and the rule's figures — `radius = farthest + cells × cell`, `farthest` the part's farthest lattice vertex
4464
+ * from its nearest link as `RIG_INFLUENCE_REACH` measures it. A LINT so the author sees what was drawn and from what.
4465
+ */
4466
+ export interface InfluenceRadiusFinding {
4467
+ kind: 'influence-radius';
4468
+ part: string;
4469
+ tag: ClothTarget;
4470
+ radius: number;
4471
+ farthest: number;
4472
+ cells: number;
4473
+ cell: number;
4474
+ }
4475
+
4476
+ /** What `propose` hands `lint` beside the proposal: findings of the draft itself, not of a check over the spec. */
4477
+ export type DraftLintFinding = LimbJointOffArtFinding | InfluenceRadiusFinding;
4478
+
4339
4479
  export type LintFinding =
4340
4480
  | OffArtFinding
4341
4481
  | OffLockFinding
@@ -4350,7 +4490,9 @@ export type LintFinding =
4350
4490
  | BackHairMassesFinding
4351
4491
  | OverlappingArmsFinding
4352
4492
  | CrossedLimbsFinding
4353
- | StopTouchAboveRootFinding;
4493
+ | StopTouchAboveRootFinding
4494
+ | LimbJointOffArtFinding
4495
+ | InfluenceRadiusFinding;
4354
4496
 
4355
4497
  /** Which rule set read the torso and the sleeve chains, under `--keypoints`. */
4356
4498
  export interface LintBasis {
@@ -4452,10 +4594,12 @@ export function lint(
4452
4594
  P: PartSet,
4453
4595
  spec: { bones: readonly BoneEntry[]; meshes: Readonly<Record<string, MeshSpec>>; regions?: Readonly<Record<string, string>>; motion?: SkeletonSections['motion']; constraints?: readonly ConfigConstraint[]; limbs?: Readonly<Record<string, Limb>>; stops?: readonly ConfigStop[] },
4454
4596
  joints?: RigJoints,
4597
+ drafted: readonly DraftLintFinding[] = [],
4455
4598
  ): LintResult {
4456
4599
  const { byName } = expand(spec.bones);
4457
4600
  const parts = new Map(P.recs.map((p) => [p.name, p]));
4458
- const findings: LintFinding[] = [];
4601
+ // Issue #517: what the proposer left uncut and why, first: the finding is the draft's, not a check's over the spec.
4602
+ const findings: LintFinding[] = [...drafted];
4459
4603
  const unknownMeshes: string[] = [];
4460
4604
  // Issue #86: which check read which bone, recorded where each check reads it.
4461
4605
  const read = new Map<string, string[]>([...byName.keys()].map((n) => [n, []]));
@@ -4463,6 +4607,7 @@ export function lint(
4463
4607
  const list = read.get(n);
4464
4608
  if (list !== undefined && !list.includes(check)) list.push(check);
4465
4609
  };
4610
+ for (const f of drafted) if (f.kind === 'limb-joint-off-art') readBy(f.link, `limb-joint-off-art on ${f.limb}`);
4466
4611
  for (const [mname, m] of Object.entries(spec.meshes)) {
4467
4612
  const part = parts.get(mname);
4468
4613
  if (part === undefined) {
@@ -4900,6 +5045,10 @@ function findingBones(f: LintFinding, bones: readonly BoneEntry[]): string[] {
4900
5045
  case 'off-art':
4901
5046
  case 'off-lock':
4902
5047
  return [f.bone];
5048
+ case 'limb-joint-off-art':
5049
+ return [f.link];
5050
+ case 'influence-radius':
5051
+ return [];
4903
5052
  case 'hip-not-below-chest':
4904
5053
  case 'hip-not-past-chest':
4905
5054
  return ['hip', 'chest'];
@@ -5073,6 +5222,16 @@ export function basisLines(b: LintBasis): string[] {
5073
5222
  */
5074
5223
  export function lintLine(f: LintFinding): string {
5075
5224
  switch (f.kind) {
5225
+ case 'influence-radius':
5226
+ return (
5227
+ `LINT ${f.part} on mesh ${pyRepr(f.part)}: influence radius ${f.radius} = farthest ${f.farthest} + ${f.cells} × cell ${f.cell} — drafted by config.cloth.${JSON.stringify(f.tag)}.influence, ` +
5228
+ `the farthest lattice vertex from its nearest link (the figure RIG_INFLUENCE_REACH holds the radius above) plus ${f.cells} cells; a radius at the floor folds more than the lattice and a larger one is not safer (AUTHORING, influence.radius) — state influence.radius in the recipe to keep your own`
5229
+ );
5230
+ case 'limb-joint-off-art':
5231
+ return (
5232
+ `LINT ${f.part} at ${pyIntList(f.at)}, the ${f.keypoint} joint and ${f.link}'s tip, lies on none of ${f.limb}'s art within 1 px along its joint line (${offLineFigure(f.nearest)}), ` +
5233
+ `so assemble could not size the ankle's cap (ASSEMBLE_LIMB_JOINT_ON_ART): ${f.limb} is drafted without its ankle cut and ${f.from} stays one part — move the ${f.keypoint} keypoint onto the art of the leg or of ${f.from}, then re-run propose`
5234
+ );
5076
5235
  case 'off-art':
5077
5236
  return `LINT ${f.bone} at ${pyIntList(f.at)} is off the art of mesh ${pyRepr(f.mesh)}`;
5078
5237
  case 'off-lock':
package/src/rig.ts CHANGED
@@ -757,6 +757,30 @@ export function influenceReach(points: ReadonlyArray<readonly [number, number]>,
757
757
  return best;
758
758
  }
759
759
 
760
+ /**
761
+ * Issue #518: the figure {@link influenceReach} holds an influence mesh's radius above, measured as the rig stage
762
+ * measures it — rig-c's segments lattice at `cell` over the part padded by {@link PAD} (alpha above
763
+ * {@link INFLUENCE_THRESHOLD}), and each vertex's distance to its nearest of `segs` (rig px, as the bones place them)
764
+ * — for `propose` to draft a radius from before any rig is built. Null when rig-c's lattice refuses the part, which
765
+ * the rig stage then names (`RIG_INFLUENCE_LATTICE`).
766
+ */
767
+ export function influenceFarthest(img: Raster, x: number, y: number, segs: readonly Segment[], cell: number): number | null {
768
+ const padded = pad(img, PAD, PAD, PAD, PAD, [0, 0, 0, 0]);
769
+ const alpha = new Uint8Array(padded.width * padded.height);
770
+ for (let i = 0; i < alpha.length; i++) alpha[i] = padded.data[i * 4 + 3];
771
+ let lattice: SegmentsLattice;
772
+ try {
773
+ lattice = buildSegmentsLattice({ mask: { width: padded.width, height: padded.height, alpha }, threshold: INFLUENCE_THRESHOLD, cell });
774
+ } catch {
775
+ return null;
776
+ }
777
+ const ox = x - PAD;
778
+ const oy = y - PAD;
779
+ const names = [...new Set(segs.map((s) => s.bone))];
780
+ const local: EntrySegment[] = segs.map((s) => ({ bone: names.indexOf(s.bone), entry: 0, a: [s.a[0] - ox, s.a[1] - oy], b: [s.b[0] - ox, s.b[1] - oy] }));
781
+ return influenceReach(lattice.points, local, names).distance;
782
+ }
783
+
760
784
  /**
761
785
  * Whether a declared radius reaches a vertex `distance` px from its nearest link: a link pulls only when it is NEARER
762
786
  * than radius (rig-c's `d < radius`; the pull is 0 at d = radius), so a radius equal to the distance does not.