rig-parts 2.63.0 → 2.63.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/AUTHORING.md +40 -40
- package/package.json +1 -1
- package/src/check.ts +123 -3
- package/src/localweights.ts +51 -5
package/docs/AUTHORING.md
CHANGED
|
@@ -7008,7 +7008,7 @@ outside the consumed inputs.
|
|
|
7008
7008
|
| Below-floor cloth travel (unmeasured) | a link's larger unrounded carrier-frame root/tip travel is below the unchanged 0.5 rig px floor, after the zero guard. The diagnostic gives actual root and tip travel in rig px, the 0.5 rig px floor, and `measured_driver`: the nearest world-moving bone (including the carrier), `"none"` when measured still, or `"unavailable"` for missing or unusable geometry. This observes movement, not causal key attribution. The reading stays UNMEASURED under the existing SKIP policy; a separately declared requirement for measurable movement is not satisfied | drive the carrier so the cloth has measurable motion, or remove the requirement for this cloth to move on idle if that motion is not required |
|
|
7009
7009
|
| <a id="CHECK_TIP_OVER_ROOT"></a>`CHECK_TIP_OVER_ROOT` | a `handwear`/`bottomwear` part's art in the lower half of its box travels less than 1.4725 times as far as in the upper half, measured from the idle's posed geometry against the bone the part hangs from (issue #987; rig px quoted, the world reading beside it) | the chain track's `amps` (grow toward the tip), or the mesh's `segments` (the chain must be among them), or its mode: on `scarf`'s short skirt the proposal's lattice read 1.207 and the same part in `contour` mode 1.738 with the same segments and idle (issue #118) — both carried the `chest` segment #262 removed, after which the lattice reads 3.487. When the detail says `the root travels with the breath (x px of y px): it is carried by \`<bone>\`` (issue #262) the chain is not the cause: a bone an idle `translate` track moves (the breath) moves the root more than the tip, and with that translate held still (the part posed again without it, in proportion to each vertex's weight on the bone and those under it) the ratio passes — the row adds `carried_by`, `breath_rig_px`, `root_without_breath_rig_px` and `tip_without_breath_rig_px`; take that bone's segment off the mesh, or bind the root to the bone the part hangs from, which the detail names. Since issue #987 only a breath keyed under that bone is read: one at or above it is in the frame the halves are read in and carries nothing. When the bone named is a link of the chain the part hangs on, its segment stays, and the detail says to key the translate on the bone the part hangs from or above it. `nothing in it moves against \`<bone>\`` is a part that rides the bone it hangs from whole — a rigid sleeve, whose world ratio is 1. Since issue #995 a lone swing counts as a link too — a rotate-keyed bone with no child bone, or whose only child is its control twin (a one-link chain's control) — so a skirt bound to the one bone that swings it is read against the bone above, where its swing shows. A rotate-keyed body segment other bones hang under (a pelvis carrying the legs) is not one: a part bound whole to it reads `nothing in it moves against` that bone and fails, its world ratio passing only through the lever arm. Hang swinging cloth on its own bone under the body segment; a fitted garment the rig holds rigid on purpose (shorts on the pelvis) is declared in the scene file's `not_swinging` (§7), and the line then reads it SKIP with the reason. A part the scene file declares `rests` (issue #245) is held the other way, its tip half's travel at most its root half's (ratio ≤ 1); the detail then reads `the scene file's rests declares its tip at rest, so a ratio <= 1 is required`, and for it the fix is the chain's `amps` (shrinking toward the tip) or the mesh's tip weighted to a bone the idle does not swing |
|
|
7010
7010
|
| <a id="CHECK_STILL_REGIONS_DARK"></a>`CHECK_STILL_REGIONS_DARK` | a slot of the face's still set (the `face` slots and every slot drawn over the face that the head bone alone carries) moves relative to the bone the face's slot rides, or a `footwear` slot moves on the screen, by more than the arithmetic's own rounding — measured from the idle's posed geometry (the slot, its largest displacement in rig px, the idle frame and the tolerance quoted) | on the face: a face mesh with a weight on a bone other than the head (`segments`), or one deformed by another bone; on the feet: a mesh weighted to a swinging bone, or a region on the wrong bone. A bang swinging over the face is not this line's failure: its depth is reported (`crossing`), with no bar |
|
|
7011
|
-
| <a id="CHECK_TEXTURE_STRETCH"></a>`CHECK_TEXTURE_STRETCH` | a mesh triangle's edge, in some idle frame, is more than 1.926544 times its rest length or less than 1/1.926544 of it (the mesh, triangle, its three vertices, the edge and the frame are named, and — issue #314 — the bones the edge's two vertices hang on: each vertex's two largest weights from `rig.json`, `vertex <i> is weighted to "<bone>" <w>, …`, then `on the idle's chains, the chain from "<first link>" carries "<bone>", …` — each chain `CHAIN_LAG` reads named once, by its first link — with a bone on no chain said, or `none of these bones hangs on a chain of the idle`); or a rest edge has length 0 A differing bone set on the failing edge or triangle names the bone and both shares. Cut attribution requires a matching config replay; otherwise the influence-cut remedy is conditional ("The weight cut"). | the chain tracks' `amps` on the bones that mesh is weighted to (the stretch grows with them), or the mesh's `segments` — a vertex blending two bones that swing against each other. Two chains named, with opposed amplitudes: give both one sign, or drop one — `propose --from-config` measures the pair before a build (§3, *Two chains on one lattice*). An edge whose two ends disagree on whether a bone's small share survives the 0.03 cut (one vertex keeps the bone at a few hundredths, the next drops it — read the two vertices' weights the line quotes): declare `influences: {floor: "continuous"}` on that mesh first, `rule: "heat"` second; the weight `exponent` moves the figure without removing the cut (issue #115, `reference-demo` `hair_back` as contour at tolerance 1, rig-c 2.47.1: 2.535 as drafted; continuous floor 1.422, heat 1.816, both PASS; exponent 1.5 / 3 / 4 / 6 read 2.564 / 1.902 / 2.119 / 4.816, the one pass on the same cut at another edge) |
|
|
7011
|
+
| <a id="CHECK_TEXTURE_STRETCH"></a>`CHECK_TEXTURE_STRETCH` | a mesh triangle's edge, in some idle frame, is more than 1.926544 times its rest length or less than 1/1.926544 of it (the mesh, triangle, its three vertices, the edge and the frame are named, and — issue #314 — the bones the edge's two vertices hang on: each vertex's two largest weights from `rig.json`, `vertex <i> is weighted to "<bone>" <w>, …`, then `on the idle's chains, the chain from "<first link>" carries "<bone>", …` — each chain `CHAIN_LAG` reads named once, by its first link — with a bone on no chain said, or `none of these bones hangs on a chain of the idle`); or a rest edge has length 0 A differing bone set on the failing edge or triangle names the bone and both shares. Cut attribution requires a matching config replay; otherwise the influence-cut remedy is conditional ("The weight cut"). When a vertex of the failing edge lies inside a declared contour band or at its cutoff, the detail also names the governing contour band — its region, its target bone, its declared width (`band`), and each vertex's band position and share — and says that the band's falloff governs the edge (issue #1598). The clause needs the config: on `build`, the one it ran with; on a standalone `check --rig`, the one `<rig>/run.json` (`rig-run/1`, from `rig`) names, used only when the stamp's `rig.json` and config SHA-256 both match the files on disk. Without a verified config, or when an edge vertex does not rebuild onto the contour grid, the clause is left out and the rest of the line is unchanged. | the chain tracks' `amps` on the bones that mesh is weighted to (the stretch grows with them), or the mesh's `segments` — a vertex blending two bones that swing against each other. Two chains named, with opposed amplitudes: give both one sign, or drop one — `propose --from-config` measures the pair before a build (§3, *Two chains on one lattice*). An edge whose two ends disagree on whether a bone's small share survives the 0.03 cut (one vertex keeps the bone at a few hundredths, the next drops it — read the two vertices' weights the line quotes): declare `influences: {floor: "continuous"}` on that mesh first, `rule: "heat"` second; the weight `exponent` moves the figure without removing the cut (issue #115, `reference-demo` `hair_back` as contour at tolerance 1, rig-c 2.47.1: 2.535 as drafted; continuous floor 1.422, heat 1.816, both PASS; exponent 1.5 / 3 / 4 / 6 read 2.564 / 1.902 / 2.119 / 4.816, the one pass on the same cut at another edge). When the detail names a governing contour band (an edge with a vertex inside a declared contour band or at its cutoff), go to that band's width (`meshes.<part>.contour.regions[].band`, or `meshes.<part>.contour.bust` for a derived bust band), not `meshes.<part>.influences` or mesh density: the reach is not monotonic in the band's width, so sweep it on your own rig and read both yaw directions |
|
|
7012
7012
|
| <a id="CHECK_ANIMATIONS_DO_NOT_FOLD"></a>`CHECK_ANIMATIONS_DO_NOT_FOLD` | an animation, the idle included, turns a mesh triangle over against the setup pose on some frame, read by `rigc render --folds` over the build with its physics on — and with its physics constraints left out beside it when the rig declares any, so each row reports `physics_on` and `physics_off` side by side (issues #320, #333, #363); the object names the animation and the mesh, the detail quotes rigc's line — the frames, the worst frame, which triangles, their world box and setup-pose area — and when the fold appears only with physics on, names the physics constraint(s) on the mesh's bones and the worst frame. After rigc's line it names what the worst frame's folded triangles hang on (issue #567), in `TEXTURE_STRETCH`'s words: each vertex's dominant bone is its largest weight in `rig.json`, the triangles whose vertices share one set of dominant bones are one group (the set in `rig.json`'s bone order), and each group lists its first 6 triangles (`triangles 63, 78, 79 dominated by "knee_r", "knee_l"`, past 6 `… and N more`) and spells out its first triangle's vertices — the largest two weights of each, and the idle chains those bones hang on; 3 groups are written and the rest counted (`; … and N more group(s), M triangle(s)`). An attachment the skin does not hold, or a triangle its table does not reach, is said, not guessed. Or a `may_fold` entry of the `--requirements` file names a slot and animation that does not fold: an exception that excepts nothing A differing bone set on the failing edge or triangle names the bone and both shares. Cut attribution requires a matching config replay; otherwise the influence-cut remedy is conditional ("The weight cut"). | the physics constraint(s) the line names (lower `inertia`, raise `strength`, or lower `damping`), the clip's keys on the bones the line names (a bend past what the weights carry, two bones turned toward each other until the rows between them pass, a translate that carries one row of vertices past the next), or the mesh's `segments`; to look, `rigc inspect --candidate <out>/check/build --show art,folds,mesh --animation <name> --at <the worst frame's time> --zoom folds`. A fold the art means (a sleeve behind the body) is declared, `"may_fold": [{ "slot": …, "animation": …, "why": … }]` (§7, *Declared requirements*); a stale entry is taken out |
|
|
7013
7013
|
| <a id="CHECK_FEET_STAY_LEVEL"></a>`CHECK_FEET_STAY_LEVEL` | a `footwear` part riding a bone that hangs from another turns more than ±10 degrees from its setup pose on a frame where a bone above that bone is turned (issue #348) — the bar is HQ's line (rig-c/parts#347 ruling 4), not a figure measured here; the object names the part, its bone and the bone it hangs from, the detail the animation, frame and time, the turned bone and its turn, the drawing's turn, and every bone the turn came through with its `inherit` | config.bones' `inherit` on the foot's bone (§3, `bones`): a mode that does not take the parent's rotation (`noRotationOrReflection`, `onlyTranslation`) keeps the drawing at its setup angle; which mode is the author's. Or the clip's keys on the foot's own bone, which turn the shoe whatever its mode |
|
|
7014
7014
|
| <a id="CHECK_STRESS_OFF_CHAIN"></a>`CHECK_STRESS_OFF_CHAIN` | a mesh from a See-through `handwear` layer that rides one chain of the idle does not turn rigidly with it: with the chain's first link turned 90°, −90° or 180° on a throwaway copy (physics left out, posed by rigc, issue #347), its worst edge reads above 1.0000 as max(ratio, 1/ratio) against the setup pose. The object names the mesh, the link and the turn; the detail quotes the edge and names each bone the mesh is weighted to off the chain, with how many vertices carry it and the largest weight. Or the turned render shows no mesh on the slot: not read is not a pass | the mesh's `segments`: drop the segment on the bone the line names (a 16 px `chest` stub at the shoulder, as `propose` drafted until issue #347), so the sleeve rides its chain alone. Measured (rigc 2.47.1): `demo`'s sleeves read 2.46 to 254.7 with the stub and 1.0000 without it, and the setup-pose seam does not move (mean 0.147, 0 px over 40, both ways) |
|
|
@@ -10757,8 +10757,8 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
|
|
|
10757
10757
|
<!-- check-row-table:begin -->
|
|
10758
10758
|
| Row family | Registered JSON paths | row_scope | row_kind | row_subjects (producer expression) | Producer |
|
|
10759
10759
|
| --- | --- | --- | --- | --- | --- |
|
|
10760
|
-
| `ANIMATIONS_DO_NOT_FOLD.declared_not_folding` | `ANIMATIONS_DO_NOT_FOLD.declared_not_folding` | part when the supplied mapping resolves a piece; otherwise rig | finding | resolved piece for e.slot; otherwise [] | [check.ts:
|
|
10761
|
-
| `ANIMATIONS_DO_NOT_FOLD.folding` | `ANIMATIONS_DO_NOT_FOLD.folding` | part when the supplied mapping resolves a piece; otherwise rig | finding when entry === undefined; otherwise evidence | resolved piece for slot; otherwise [] | [check.ts:
|
|
10760
|
+
| `ANIMATIONS_DO_NOT_FOLD.declared_not_folding` | `ANIMATIONS_DO_NOT_FOLD.declared_not_folding` | part when the supplied mapping resolves a piece; otherwise rig | finding | resolved piece for e.slot; otherwise [] | [check.ts:3876](../src/check.ts#L3876) |
|
|
10761
|
+
| `ANIMATIONS_DO_NOT_FOLD.folding` | `ANIMATIONS_DO_NOT_FOLD.folding` | part when the supplied mapping resolves a piece; otherwise rig | finding when entry === undefined; otherwise evidence | resolved piece for slot; otherwise [] | [check.ts:3836](../src/check.ts#L3836) |
|
|
10762
10762
|
| `ART_JOINT_DISTANCE.joints` | `ART_JOINT_DISTANCE.joints` | 'rig' | finding when status === 'FAIL'; otherwise evidence | [] | [artjoints.ts:86](../src/artjoints.ts#L86) |
|
|
10763
10763
|
| `BEHIND_PART_SEAMS.contributors` | `BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.samples[].contributors`; `BEHIND_PART_SEAMS.turn.pairs[].frames[].motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].setup.motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].setup.standing.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].frames[].motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.samples[].contributors` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:664](../src/behindseams.ts#L664) |
|
|
10764
10764
|
| `BEHIND_PART_SEAMS.hits` | `BEHIND_PART_SEAMS.pairs[].motion_opened.frames`; `BEHIND_PART_SEAMS.pairs[].standing.frames`; `BEHIND_PART_SEAMS.pairs[].motion_opened.worst`; `BEHIND_PART_SEAMS.pairs[].standing.worst` | 'pair' | finding when r.px > allowance; otherwise evidence | parts | [behindseams.ts:750](../src/behindseams.ts#L750) |
|
|
@@ -10774,53 +10774,53 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
|
|
|
10774
10774
|
| `BEHIND_PART_SEAMS.unread_corridors` | `BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.unread_corridors`; `BEHIND_PART_SEAMS.pairs[].setup.standing.unread_corridors`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.unread_corridors` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:585](../src/behindseams.ts#L585) |
|
|
10775
10775
|
| `BOUNDARY_COLOUR_STEP.over` | `BOUNDARY_COLOUR_STEP.over` | 'pair' | finding | r.parts | [boundarycolour.ts:221](../src/boundarycolour.ts#L221) |
|
|
10776
10776
|
| `BOUNDARY_COLOUR_STEP.unmeasured` | `BOUNDARY_COLOUR_STEP.unmeasured` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for r.slot; otherwise [] | [boundarycolour.ts:222](../src/boundarycolour.ts#L222) |
|
|
10777
|
-
| `CLOTH_SETTLES.rows` | `CLOTH_SETTLES.rows` | 'rig' | finding when speeds.length > 0 && s < speeds.length; otherwise evidence | [] | [check.ts:
|
|
10777
|
+
| `CLOTH_SETTLES.rows` | `CLOTH_SETTLES.rows` | 'rig' | finding when speeds.length > 0 && s < speeds.length; otherwise evidence | [] | [check.ts:6329](../src/check.ts#L6329) |
|
|
10778
10778
|
| `CUT_JOINT_MATERIAL.rows` | `CUT_JOINT_MATERIAL.rows` | 'part' | finding when r.status === 'FAIL'; otherwise evidence | [r.part] | [cutmaterial.ts:280](../src/cutmaterial.ts#L280) |
|
|
10779
|
-
| `FEET_STAY_LEVEL.feet` | `FEET_STAY_LEVEL.feet` | 'part' | finding when row.status === 'FAIL'; otherwise evidence | [row.part] | [check.ts:
|
|
10780
|
-
| `FEET_STAY_LEVEL.feet[].worst.through` | `FEET_STAY_LEVEL.feet[].worst.through` | 'rig' | evidence | [] | [check.ts:
|
|
10781
|
-
| `LIMB_ONE_BONE.parts` | `LIMB_ONE_BONE.parts` | 'part' | finding when fail; otherwise evidence | [p.name] | [check.ts:
|
|
10779
|
+
| `FEET_STAY_LEVEL.feet` | `FEET_STAY_LEVEL.feet` | 'part' | finding when row.status === 'FAIL'; otherwise evidence | [row.part] | [check.ts:4078](../src/check.ts#L4078) |
|
|
10780
|
+
| `FEET_STAY_LEVEL.feet[].worst.through` | `FEET_STAY_LEVEL.feet[].worst.through` | 'rig' | evidence | [] | [check.ts:4053](../src/check.ts#L4053) |
|
|
10781
|
+
| `LIMB_ONE_BONE.parts` | `LIMB_ONE_BONE.parts` | 'part' | finding when fail; otherwise evidence | [p.name] | [check.ts:4371](../src/check.ts#L4371) |
|
|
10782
10782
|
| `PART_SUPPORT_REPORT.pairs` | `PART_SUPPORT_REPORT.pairs` | 'pair' | evidence; finding when length > 0; otherwise evidence | [F.name, B.name] | [coincide.ts:114](../src/coincide.ts#L114), [coincide.ts:130](../src/coincide.ts#L130) |
|
|
10783
10783
|
| `PART_SUPPORT_REPORT.raw_pairs` | `PART_SUPPORT_REPORT.raw_pairs` | 'pair' | evidence | [F.name, B.name] | [coincide.ts:110](../src/coincide.ts#L110) |
|
|
10784
10784
|
| `PART_SUPPORT_REPORT.unowned.regions` | `PART_SUPPORT_REPORT.unowned.regions` | 'rig' | finding | [] | [coincide.ts:145](../src/coincide.ts#L145) |
|
|
10785
10785
|
| `PHYSICS_CONTRIBUTES.rows` | `PHYSICS_CONTRIBUTES.rows` | 'part' | evidence; finding when !moves; otherwise evidence | [part] | [physicscontrib.ts:217](../src/physicscontrib.ts#L217), [physicscontrib.ts:220](../src/physicscontrib.ts#L220) |
|
|
10786
|
-
| `SEAM_OVER_MOTION.pairs` | `SEAM_OVER_MOTION.pairs` | 'pair' | evidence | [p.a, p.b] | [check.ts:
|
|
10787
|
-
| `SEAM_OVER_MOTION.required.pairs` | `SEAM_OVER_MOTION.required.pairs` | 'pair' | finding when open > 0; otherwise evidence | [p.a, p.b] | [check.ts:
|
|
10788
|
-
| `SEAM_OVER_MOTION.required.pairs[].open_frames` | `SEAM_OVER_MOTION.required.pairs[].open_frames` | 'pair' | evidence | [p.a, p.b] | [check.ts:
|
|
10789
|
-
| `SEAM_OVER_MOTION.roots.unmeasured` | `SEAM_OVER_MOTION.roots.unmeasured` | 'part' | evidence | [root.part] | [check.ts:
|
|
10790
|
-
| `SEAM_OVER_MOTION.rows` | `SEAM_OVER_MOTION.rows` | 'pair'; unique ? 'pair' : 'rig' | finding when motionSeamFinding(want.root !== undefined, p.status, p.banded, opens.length); otherwise evidence; finding when motionSeamFinding(rootNames.has(r.pair), r.status, r.banded, r.opens.length); otherwise evidence | [want.a, want.b]; unique ? [pair.a, pair.b] : [] | [check.ts:
|
|
10791
|
-
| `SEAM_OVER_MOTION.rows[].cells` | `SEAM_OVER_MOTION.rows[].cells` | 'pair' | evidence | [want.a, want.b] | [check.ts:
|
|
10792
|
-
| `SEAM_OVER_MOTION.rows[].joint_contact.reasons` | `SEAM_OVER_MOTION.rows[].joint_contact.reasons` | 'pair' | evidence | [want.a, want.b] | [check.ts:
|
|
10786
|
+
| `SEAM_OVER_MOTION.pairs` | `SEAM_OVER_MOTION.pairs` | 'pair' | evidence | [p.a, p.b] | [check.ts:5726](../src/check.ts#L5726) |
|
|
10787
|
+
| `SEAM_OVER_MOTION.required.pairs` | `SEAM_OVER_MOTION.required.pairs` | 'pair' | finding when open > 0; otherwise evidence | [p.a, p.b] | [check.ts:5041](../src/check.ts#L5041) |
|
|
10788
|
+
| `SEAM_OVER_MOTION.required.pairs[].open_frames` | `SEAM_OVER_MOTION.required.pairs[].open_frames` | 'pair' | evidence | [p.a, p.b] | [check.ts:5033](../src/check.ts#L5033) |
|
|
10789
|
+
| `SEAM_OVER_MOTION.roots.unmeasured` | `SEAM_OVER_MOTION.roots.unmeasured` | 'part' | evidence | [root.part] | [check.ts:5699](../src/check.ts#L5699) |
|
|
10790
|
+
| `SEAM_OVER_MOTION.rows` | `SEAM_OVER_MOTION.rows` | 'pair'; unique ? 'pair' : 'rig' | finding when motionSeamFinding(want.root !== undefined, p.status, p.banded, opens.length); otherwise evidence; finding when motionSeamFinding(rootNames.has(r.pair), r.status, r.banded, r.opens.length); otherwise evidence | [want.a, want.b]; unique ? [pair.a, pair.b] : [] | [check.ts:5656](../src/check.ts#L5656), [check.ts:5732](../src/check.ts#L5732) |
|
|
10791
|
+
| `SEAM_OVER_MOTION.rows[].cells` | `SEAM_OVER_MOTION.rows[].cells` | 'pair' | evidence | [want.a, want.b] | [check.ts:5669](../src/check.ts#L5669) |
|
|
10792
|
+
| `SEAM_OVER_MOTION.rows[].joint_contact.reasons` | `SEAM_OVER_MOTION.rows[].joint_contact.reasons` | 'pair' | evidence | [want.a, want.b] | [check.ts:5659](../src/check.ts#L5659) |
|
|
10793
10793
|
| `SEAM_OVER_MOTION.rows[].pose_at_worst.joints` | `SEAM_OVER_MOTION.rows[].pose_at_worst.joints` | 'rig' | evidence | [] | [motionseampose.ts:53](../src/motionseampose.ts#L53) |
|
|
10794
|
-
| `SEAM_OVER_MOTION.worlds.*.rows` | `SEAM_OVER_MOTION.worlds.*.rows` | 'pair' | evidence | [want.a, want.b] | [check.ts:
|
|
10795
|
-
| `SEAM_OVER_RANGE.joints` | `SEAM_OVER_RANGE.joints` | 'part' | evidence; finding when poses.some(p => p.status === 'FAIL'); otherwise evidence | [j.part] | [check.ts:
|
|
10796
|
-
| `SEAM_OVER_RANGE.joints[].poses` | `SEAM_OVER_RANGE.joints[].poses` | 'part' | finding when fail; otherwise evidence | [j.part] | [check.ts:
|
|
10794
|
+
| `SEAM_OVER_MOTION.worlds.*.rows` | `SEAM_OVER_MOTION.worlds.*.rows` | 'pair' | evidence | [want.a, want.b] | [check.ts:5653](../src/check.ts#L5653) |
|
|
10795
|
+
| `SEAM_OVER_RANGE.joints` | `SEAM_OVER_RANGE.joints` | 'part' | evidence; finding when poses.some(p => p.status === 'FAIL'); otherwise evidence | [j.part] | [check.ts:4695](../src/check.ts#L4695), [check.ts:4741](../src/check.ts#L4741) |
|
|
10796
|
+
| `SEAM_OVER_RANGE.joints[].poses` | `SEAM_OVER_RANGE.joints[].poses` | 'part' | finding when fail; otherwise evidence | [j.part] | [check.ts:4739](../src/check.ts#L4739) |
|
|
10797
10797
|
| `SETUP_MATCHES_PAINTING.regions` | `SETUP_MATCHES_PAINTING.regions` | 'rig' | finding when status === 'FAIL'; otherwise evidence | [] | [setuppainting.ts:175](../src/setuppainting.ts#L175) |
|
|
10798
10798
|
| `SETUP_MATCHES_PAINTING.regions[].slots` | `SETUP_MATCHES_PAINTING.regions[].slots` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for slot; otherwise [] | [setuppainting.ts:176](../src/setuppainting.ts#L176) |
|
|
10799
10799
|
| `SOURCE_EXPOSURE.rows` | `SOURCE_EXPOSURE.rows` | 'part' | finding when declared !== undefined && r.px > declared.max_px; otherwise evidence | [r.part] | [sourceexposure.ts:292](../src/sourceexposure.ts#L292) |
|
|
10800
10800
|
| `SOURCE_EXPOSURE.unmeasured` | `SOURCE_EXPOSURE.unmeasured` | part when the supplied mapping resolves a piece; otherwise rig | finding when declared !== undefined; otherwise evidence | resolved piece for u.slot; otherwise [] | [sourceexposure.ts:293](../src/sourceexposure.ts#L293) |
|
|
10801
|
-
| `STILL_REGIONS_DARK.*.crossing` | `STILL_REGIONS_DARK.*.crossing` | part when the supplied mapping resolves a piece; otherwise rig | finding | resolved piece for sl.name; otherwise [] | [check.ts:
|
|
10802
|
-
| `STILL_REGIONS_DARK.*.still_slots` | `STILL_REGIONS_DARK.*.still_slots` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when r.max > tolerance; otherwise evidence | resolved piece for slot; otherwise [] | [check.ts:
|
|
10803
|
-
| `STRESS_OFF_CHAIN.not_read` | `STRESS_OFF_CHAIN.not_read` | 'part' | evidence | [r.part] | [check.ts:
|
|
10804
|
-
| `STRESS_OFF_CHAIN.per_part` | `STRESS_OFF_CHAIN.per_part` | 'part' | finding when poses.some(p => typeof p.reading === 'number' && p.reading > STRESS_RIGID); otherwise evidence | [r.part] | [check.ts:
|
|
10805
|
-
| `STRESS_OFF_CHAIN.per_part[].off_chain` | `STRESS_OFF_CHAIN.per_part[].off_chain` | 'part' | evidence | [r.part] | [check.ts:
|
|
10806
|
-
| `STRESS_OFF_CHAIN.per_part[].poses` | `STRESS_OFF_CHAIN.per_part[].poses` | 'part' | evidence; finding when shown > STRESS_RIGID; otherwise evidence | [r.part] | [check.ts:
|
|
10807
|
-
| `TEXTURE_STRETCH.per_mesh` | `TEXTURE_STRETCH.per_mesh` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when severity > TEXTURE_STRETCH_CEILING; otherwise evidence | resolved piece for m.slot; otherwise [] | [check.ts:
|
|
10808
|
-
| `TIP_OVER_ROOT.parts` | `TIP_OVER_ROOT.parts` | 'part' | evidence; finding when !ok && !(!rigid && hanging.onLink && Math.max(c.root, c.tip) < TIP_TRAVEL_FLOOR); otherwise evidence | [p.name] | [check.ts:
|
|
10809
|
-
| `WIND_BAND.pairs` | `WIND_BAND.pairs` | 'pair' | finding when !holdsAll; otherwise evidence | [p.a, p.b] | [check.ts:
|
|
10810
|
-
| `WIND_BAND.pairs[].steps` | `WIND_BAND.pairs[].steps` | 'pair' | finding when !s.holds; otherwise evidence | [p.a, p.b] | [check.ts:
|
|
10811
|
-
| `figure_openings.openings` | `figure_openings.openings` | 'pair' | finding | [ps.under, ps.above] | [check.ts:
|
|
10812
|
-
| `loop_physics` | `loop_physics` | 'rig' | evidence | [] | [check.ts:
|
|
10813
|
-
| `requirements.lines.* (bone)` | `requirements.lines.*` | 'rig' | finding when line.status === 'FAIL'; otherwise evidence | [] | [check.ts:
|
|
10814
|
-
| `requirements.lines.* (seam)` | `requirements.lines.*` | 'pair' | finding when line.status === 'FAIL'; otherwise evidence | [r.part, r.neighbour] | [check.ts:
|
|
10815
|
-
| `requirements.lines.* (stretch)` | `requirements.lines.*` | part when the supplied mapping resolves a piece; otherwise rig | finding when line.status === 'FAIL'; otherwise evidence | resolved piece for r.slot; otherwise [] | [check.ts:
|
|
10816
|
-
| `seam_cells.frames` | `frames` | 'pair' | evidence | [p.a, p.b] | [check.ts:
|
|
10817
|
-
| `seam_cells.frames[].cells` | `frames[].cells` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for cell.setupTop ?? ''; otherwise [] | [check.ts:
|
|
10818
|
-
| `seam_pairs` | `seam_pairs`; `seam_scope.whole_pairs`; `sets.*.seam_pairs`; `sets.*.seam_scope.whole_pairs` | subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair' | evidence | subjects | [check.ts:
|
|
10819
|
-
| `seam_scope.changes` | `seam_scope.changes`; `sets.*.seam_scope.changes` | 'rig' | evidence | [] | [check.ts:
|
|
10820
|
-
| `seam_scope.domain.states` | `seam_scope.domain.states`; `sets.*.seam_scope.domain.states` | 'rig' | evidence | [] | [check.ts:
|
|
10821
|
-
| `seam_scope.pairs` | `seam_scope.pairs`; `sets.*.seam_scope.pairs` | subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair' | evidence | subjects | [check.ts:
|
|
10822
|
-
| `seam_scope.population.pairs` | `seam_scope.population.pairs`; `sets.*.seam_scope.population.pairs` | 'pair' | evidence | row.parts | [check.ts:
|
|
10823
|
-
| `seam_scope.population.single_art` | `seam_scope.population.single_art`; `sets.*.seam_scope.population.single_art` | 'part' | evidence | [row.part] | [check.ts:
|
|
10801
|
+
| `STILL_REGIONS_DARK.*.crossing` | `STILL_REGIONS_DARK.*.crossing` | part when the supplied mapping resolves a piece; otherwise rig | finding | resolved piece for sl.name; otherwise [] | [check.ts:9523](../src/check.ts#L9523) |
|
|
10802
|
+
| `STILL_REGIONS_DARK.*.still_slots` | `STILL_REGIONS_DARK.*.still_slots` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when r.max > tolerance; otherwise evidence | resolved piece for slot; otherwise [] | [check.ts:9509](../src/check.ts#L9509), [check.ts:9514](../src/check.ts#L9514) |
|
|
10803
|
+
| `STRESS_OFF_CHAIN.not_read` | `STRESS_OFF_CHAIN.not_read` | 'part' | evidence | [r.part] | [check.ts:4299](../src/check.ts#L4299) |
|
|
10804
|
+
| `STRESS_OFF_CHAIN.per_part` | `STRESS_OFF_CHAIN.per_part` | 'part' | finding when poses.some(p => typeof p.reading === 'number' && p.reading > STRESS_RIGID); otherwise evidence | [r.part] | [check.ts:4287](../src/check.ts#L4287) |
|
|
10805
|
+
| `STRESS_OFF_CHAIN.per_part[].off_chain` | `STRESS_OFF_CHAIN.per_part[].off_chain` | 'part' | evidence | [r.part] | [check.ts:4287](../src/check.ts#L4287) |
|
|
10806
|
+
| `STRESS_OFF_CHAIN.per_part[].poses` | `STRESS_OFF_CHAIN.per_part[].poses` | 'part' | evidence; finding when shown > STRESS_RIGID; otherwise evidence | [r.part] | [check.ts:4255](../src/check.ts#L4255), [check.ts:4273](../src/check.ts#L4273) |
|
|
10807
|
+
| `TEXTURE_STRETCH.per_mesh` | `TEXTURE_STRETCH.per_mesh` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when severity > TEXTURE_STRETCH_CEILING; otherwise evidence | resolved piece for m.slot; otherwise [] | [check.ts:10290](../src/check.ts#L10290), [check.ts:10300](../src/check.ts#L10300) |
|
|
10808
|
+
| `TIP_OVER_ROOT.parts` | `TIP_OVER_ROOT.parts` | 'part' | evidence; finding when !ok && !(!rigid && hanging.onLink && Math.max(c.root, c.tip) < TIP_TRAVEL_FLOOR); otherwise evidence | [p.name] | [check.ts:8898](../src/check.ts#L8898), [check.ts:8903](../src/check.ts#L8903), [check.ts:8924](../src/check.ts#L8924), [check.ts:8935](../src/check.ts#L8935) |
|
|
10809
|
+
| `WIND_BAND.pairs` | `WIND_BAND.pairs` | 'pair' | finding when !holdsAll; otherwise evidence | [p.a, p.b] | [check.ts:6833](../src/check.ts#L6833) |
|
|
10810
|
+
| `WIND_BAND.pairs[].steps` | `WIND_BAND.pairs[].steps` | 'pair' | finding when !s.holds; otherwise evidence | [p.a, p.b] | [check.ts:6844](../src/check.ts#L6844) |
|
|
10811
|
+
| `figure_openings.openings` | `figure_openings.openings` | 'pair' | finding | [ps.under, ps.above] | [check.ts:6150](../src/check.ts#L6150) |
|
|
10812
|
+
| `loop_physics` | `loop_physics` | 'rig' | evidence | [] | [check.ts:7935](../src/check.ts#L7935) |
|
|
10813
|
+
| `requirements.lines.* (bone)` | `requirements.lines.*` | 'rig' | finding when line.status === 'FAIL'; otherwise evidence | [] | [check.ts:8266](../src/check.ts#L8266) |
|
|
10814
|
+
| `requirements.lines.* (seam)` | `requirements.lines.*` | 'pair' | finding when line.status === 'FAIL'; otherwise evidence | [r.part, r.neighbour] | [check.ts:8266](../src/check.ts#L8266) |
|
|
10815
|
+
| `requirements.lines.* (stretch)` | `requirements.lines.*` | part when the supplied mapping resolves a piece; otherwise rig | finding when line.status === 'FAIL'; otherwise evidence | resolved piece for r.slot; otherwise [] | [check.ts:8266](../src/check.ts#L8266) |
|
|
10816
|
+
| `seam_cells.frames` | `frames` | 'pair' | evidence | [p.a, p.b] | [check.ts:5030](../src/check.ts#L5030) |
|
|
10817
|
+
| `seam_cells.frames[].cells` | `frames[].cells` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for cell.setupTop ?? ''; otherwise [] | [check.ts:4990](../src/check.ts#L4990) |
|
|
10818
|
+
| `seam_pairs` | `seam_pairs`; `seam_scope.whole_pairs`; `sets.*.seam_pairs`; `sets.*.seam_scope.whole_pairs` | subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair' | evidence | subjects | [check.ts:2708](../src/check.ts#L2708) |
|
|
10819
|
+
| `seam_scope.changes` | `seam_scope.changes`; `sets.*.seam_scope.changes` | 'rig' | evidence | [] | [check.ts:2186](../src/check.ts#L2186) |
|
|
10820
|
+
| `seam_scope.domain.states` | `seam_scope.domain.states`; `sets.*.seam_scope.domain.states` | 'rig' | evidence | [] | [check.ts:2271](../src/check.ts#L2271) |
|
|
10821
|
+
| `seam_scope.pairs` | `seam_scope.pairs`; `sets.*.seam_scope.pairs` | subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair' | evidence | subjects | [check.ts:7785](../src/check.ts#L7785) |
|
|
10822
|
+
| `seam_scope.population.pairs` | `seam_scope.population.pairs`; `sets.*.seam_scope.population.pairs` | 'pair' | evidence | row.parts | [check.ts:2642](../src/check.ts#L2642) |
|
|
10823
|
+
| `seam_scope.population.single_art` | `seam_scope.population.single_art`; `sets.*.seam_scope.population.single_art` | 'part' | evidence | [row.part] | [check.ts:2643](../src/check.ts#L2643) |
|
|
10824
10824
|
|
|
10825
10825
|
| Serialized type path | Reason for schema exclusion |
|
|
10826
10826
|
| --- | --- |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rig-parts",
|
|
3
|
-
"version": "2.63.
|
|
3
|
+
"version": "2.63.1",
|
|
4
4
|
"description": "AI-authored 2D character parts from one anime painting and its See-through layer decomposition: measured parts, weighted-mesh rig specs, verified through rig-c before anything is written. A CLI for agents that cannot see the image.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
package/src/check.ts
CHANGED
|
@@ -98,7 +98,7 @@ import { createHash } from 'node:crypto';
|
|
|
98
98
|
import { createRequire } from 'node:module';
|
|
99
99
|
import type { Candidate, Piece, Viewport as RootCoverageViewport } from '@rig-c/core/render-shared';
|
|
100
100
|
import { fillHoles } from './raster/morph.ts';
|
|
101
|
-
import { closeSync, copyFileSync, cpSync, existsSync, mkdirSync, openSync, readdirSync, readFileSync, readSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from 'node:fs';
|
|
101
|
+
import { closeSync, copyFileSync, cpSync, existsSync, mkdirSync, openSync, readdirSync, readFileSync, readSync, realpathSync, renameSync, rmSync, statSync, writeFileSync, writeSync } from 'node:fs';
|
|
102
102
|
import { argvPathFromOut, diagnosticSegment, diagnosticSiblings, unsafeSegmentReason } from './outputpaths.ts';
|
|
103
103
|
import { basename, delimiter, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
104
104
|
import { measureRecomposite, type RecompositeFigures, recompositeRecord, scenePhrase, sourceInRig, figureSilhouette } from './assemble.ts';
|
|
@@ -153,7 +153,9 @@ import {
|
|
|
153
153
|
import { type AlternatePartsRecord, FRONT_SUFFIX, type LimbRecord, partImageReference, type PartRecord, type PartsFile, readParts } from './parts.ts';
|
|
154
154
|
import { ARM_SPLIT_MIGRATION, poseRigBonesForDrawn, type RigBone, SETS_FILE, writtenShares } from './rig.ts';
|
|
155
155
|
import { TURN_BONE, turnConstraintName, turnTwin } from './turn.ts';
|
|
156
|
-
import { ROOT_BONE, loadConfigWithBytes, type Point } from './config.ts';
|
|
156
|
+
import { type CharacterConfig, contourRegionsOf, ROOT_BONE, loadConfigWithBytes, type Point } from './config.ts';
|
|
157
|
+
import { GRID } from './contour.ts';
|
|
158
|
+
import { regionBandSite, regionWeight, type RegionBandSite } from './localweights.ts';
|
|
157
159
|
import { influences, meshLimits, type Segment, type Influence, type InfluenceLimits } from './weights.ts';
|
|
158
160
|
import {
|
|
159
161
|
requirementAnimations,
|
|
@@ -9970,10 +9972,127 @@ function stretchAtText(s: { triangle: number; vertices: readonly number[]; edge:
|
|
|
9970
9972
|
export interface WeightStepContext {
|
|
9971
9973
|
config?: InputFileRecord;
|
|
9972
9974
|
stage?: StageBox;
|
|
9975
|
+
rigDir?: string;
|
|
9973
9976
|
}
|
|
9974
9977
|
|
|
9975
9978
|
type StepBinding = { bone: string; x: number; y: number; weight: number };
|
|
9976
9979
|
|
|
9980
|
+
const RIG_RUN_STAMP_FILE = 'run.json';
|
|
9981
|
+
const RIG_RUN_STAMP_SPEC = 'rig-run/1';
|
|
9982
|
+
const CONTOUR_GRID_TOLERANCE = 1e-2;
|
|
9983
|
+
|
|
9984
|
+
/** Load a hash-verified config from an explicit record (`build`) or the rig directory's `rig-run/1` stamp (`check`). */
|
|
9985
|
+
function loadVerifiedContourConfig(context?: WeightStepContext): CharacterConfig | null {
|
|
9986
|
+
if (context === undefined) return null;
|
|
9987
|
+
try {
|
|
9988
|
+
if (context.config !== undefined) {
|
|
9989
|
+
const loaded = loadConfigWithBytes(context.config.path);
|
|
9990
|
+
return inputFileRecord(loaded.bytes, context.config.path).sha256 === context.config.sha256 ? loaded.config : null;
|
|
9991
|
+
}
|
|
9992
|
+
if (context.rigDir !== undefined) {
|
|
9993
|
+
const stampPath = join(context.rigDir, RIG_RUN_STAMP_FILE);
|
|
9994
|
+
if (!existsSync(stampPath)) return null;
|
|
9995
|
+
const stamp: unknown = JSON.parse(readFileSync(stampPath, 'utf8'));
|
|
9996
|
+
if (!isRecord(stamp) || stamp.spec !== RIG_RUN_STAMP_SPEC || stamp.command !== 'rig' ||
|
|
9997
|
+
!isRecord(stamp.config) || typeof stamp.config.path !== 'string' || typeof stamp.config.sha256 !== 'string' ||
|
|
9998
|
+
!Array.isArray(stamp.outputs)) return null;
|
|
9999
|
+
const rigEntry = stamp.outputs.find((e): e is Record<string, unknown> => isRecord(e) && e.path === 'rig.json');
|
|
10000
|
+
const rigPath = join(context.rigDir, 'rig.json');
|
|
10001
|
+
if (rigEntry === undefined || typeof rigEntry.sha256 !== 'string' || !existsSync(rigPath)) return null;
|
|
10002
|
+
if (createHash('sha256').update(readFileSync(rigPath)).digest('hex') !== rigEntry.sha256) return null;
|
|
10003
|
+
const cfgPath = resolve(realpathSync(context.rigDir), stamp.config.path);
|
|
10004
|
+
const loaded = loadConfigWithBytes(cfgPath);
|
|
10005
|
+
return inputFileRecord(loaded.bytes, cfgPath).sha256 === stamp.config.sha256 ? loaded.config : null;
|
|
10006
|
+
}
|
|
10007
|
+
} catch {
|
|
10008
|
+
return null;
|
|
10009
|
+
}
|
|
10010
|
+
return null;
|
|
10011
|
+
}
|
|
10012
|
+
|
|
10013
|
+
function bandSiteLabel(site: RegionBandSite): string {
|
|
10014
|
+
if (site === 'band') return 'inside the band';
|
|
10015
|
+
if (site === 'cutoff') return 'at its cutoff';
|
|
10016
|
+
return site === 'region' ? 'inside the region' : 'outside the band';
|
|
10017
|
+
}
|
|
10018
|
+
|
|
10019
|
+
function bandTargetShare(part: string, targetBone: string, bindings: readonly StepBinding[]): number {
|
|
10020
|
+
const twin = turnTwin(part, targetBone);
|
|
10021
|
+
const stopped = `${targetBone}_d`;
|
|
10022
|
+
let share = 0;
|
|
10023
|
+
for (const b of bindings) {
|
|
10024
|
+
if (b.bone === targetBone || b.bone === twin || b.bone === stopped) share += b.weight;
|
|
10025
|
+
}
|
|
10026
|
+
return round6(share);
|
|
10027
|
+
}
|
|
10028
|
+
|
|
10029
|
+
/**
|
|
10030
|
+
* Issue #1598: when a vertex of a failing `TEXTURE_STRETCH` edge lies inside a declared contour band (`0 < d < band`)
|
|
10031
|
+
* or at its cutoff (`d === band`), name the governing contour band — its region, its target bone, its declared width
|
|
10032
|
+
* (`band`), and each vertex's band position and written share — from the verified config declaration and `rig.json`'s
|
|
10033
|
+
* weights alone. Empty for every other edge so unrelated failures keep their text byte for byte.
|
|
10034
|
+
*/
|
|
10035
|
+
export function contourBandText(
|
|
10036
|
+
rig: Record<string, unknown>,
|
|
10037
|
+
slot: string,
|
|
10038
|
+
attachment: string,
|
|
10039
|
+
edge: readonly number[],
|
|
10040
|
+
context?: WeightStepContext,
|
|
10041
|
+
slotParts?: ReadonlyMap<string, string>,
|
|
10042
|
+
): string {
|
|
10043
|
+
if (context?.stage === undefined || edge.length === 0) return '';
|
|
10044
|
+
const cfg = loadVerifiedContourConfig(context);
|
|
10045
|
+
if (cfg === null) return '';
|
|
10046
|
+
const part = slotParts?.get(slot) ?? slot;
|
|
10047
|
+
const meshPart = part in cfg.meshes ? part : slot in cfg.meshes ? slot : null;
|
|
10048
|
+
if (meshPart === null) return '';
|
|
10049
|
+
const mesh = cfg.meshes[meshPart];
|
|
10050
|
+
if (!('contour' in mesh)) return '';
|
|
10051
|
+
const regions = contourRegionsOf(mesh.contour);
|
|
10052
|
+
if (!regions.some((rg) => rg.band > 0)) return '';
|
|
10053
|
+
const skins = isRecord(rig.skins) ? rig.skins : {};
|
|
10054
|
+
const skin = isRecord(skins.default) ? skins.default : {};
|
|
10055
|
+
const onSlot = isRecord(skin[slot]) ? skin[slot] : {};
|
|
10056
|
+
const att = onSlot[attachment];
|
|
10057
|
+
if (!isRecord(att) || !Array.isArray(att.weights)) return '';
|
|
10058
|
+
const transforms = setupWorld(rig);
|
|
10059
|
+
const vertices: Array<{ index: number; point: Point; bindings: StepBinding[] }> = [];
|
|
10060
|
+
for (const v of edge) {
|
|
10061
|
+
const row = att.weights[v];
|
|
10062
|
+
if (!Array.isArray(row) || row.length === 0 || row.some((b) => !isRecord(b) || typeof b.bone !== 'string' ||
|
|
10063
|
+
typeof b.x !== 'number' || typeof b.y !== 'number' || typeof b.weight !== 'number')) return '';
|
|
10064
|
+
const bindings = (row as StepBinding[]).filter((b) => b.weight > 0);
|
|
10065
|
+
const first = bindings[0];
|
|
10066
|
+
if (first === undefined) return '';
|
|
10067
|
+
const transform = transforms.get(first.bone);
|
|
10068
|
+
if (transform === undefined) return '';
|
|
10069
|
+
const rx = transform.a * first.x + transform.b * first.y + transform.worldX - context.stage.x;
|
|
10070
|
+
const ry = cropToSpineY(transform.c * first.x + transform.d * first.y + transform.worldY - context.stage.y, context.stage.height);
|
|
10071
|
+
const ux = Math.round(rx * GRID);
|
|
10072
|
+
const uy = Math.round(ry * GRID);
|
|
10073
|
+
if (!Number.isFinite(ux) || !Number.isFinite(uy) ||
|
|
10074
|
+
Math.abs(rx * GRID - ux) > CONTOUR_GRID_TOLERANCE || Math.abs(ry * GRID - uy) > CONTOUR_GRID_TOLERANCE) return '';
|
|
10075
|
+
vertices.push({ index: v, point: [ux / GRID, uy / GRID], bindings });
|
|
10076
|
+
}
|
|
10077
|
+
const explicitCount = mesh.contour.regions?.length ?? 0;
|
|
10078
|
+
const clauses: string[] = [];
|
|
10079
|
+
for (const [k, reg] of regions.entries()) {
|
|
10080
|
+
if (reg.band <= 0) continue;
|
|
10081
|
+
const sites = vertices.map((v) => ({ ...v, site: regionBandSite(v.point, reg), share: bandTargetShare(meshPart, reg.bone, v.bindings) }));
|
|
10082
|
+
if (!sites.some((s) => s.site === 'band' || s.site === 'cutoff')) continue;
|
|
10083
|
+
if (sites.some((s) => {
|
|
10084
|
+
if (s.site !== 'band' && s.site !== 'region') return false;
|
|
10085
|
+
const g = regionWeight(s.point, reg);
|
|
10086
|
+
const effective = k < explicitCount && reg.falloff !== 'linear' && g < 0.5 ? 4 * g * g * (1 - g) : g;
|
|
10087
|
+
return effective >= 1e-4 && s.share <= 0;
|
|
10088
|
+
})) continue;
|
|
10089
|
+
const atField = k < explicitCount ? `meshes.${meshPart}.contour.regions[${k}].band` : `meshes.${meshPart}.contour.bust`;
|
|
10090
|
+
const perVertex = sites.map((s) => `vertex ${s.index} is ${bandSiteLabel(s.site)} (share ${s.share})`).join(' and ');
|
|
10091
|
+
clauses.push(`contour band region "${reg.name}" (target bone "${reg.bone}", width ${reg.band} px at ${atField}): ${perVertex}, so the band's falloff governs this edge`);
|
|
10092
|
+
}
|
|
10093
|
+
return clauses.join('; ');
|
|
10094
|
+
}
|
|
10095
|
+
|
|
9977
10096
|
/** Recover only a replay that reproduces every written share on the named vertices. */
|
|
9978
10097
|
function weightCutReplay(rig: Record<string, unknown>, part: string, rows: ReadonlyMap<number, StepBinding[]>, context?: WeightStepContext): { raw: Map<number, Influence[]>; limits: InfluenceLimits } | null {
|
|
9979
10098
|
if (context?.config === undefined || context.stage === undefined) return null;
|
|
@@ -10182,10 +10301,11 @@ export function stretchLine(geo: IdleGeometry | null, path: string, problems: Pr
|
|
|
10182
10301
|
if (severity > TEXTURE_STRETCH_CEILING) {
|
|
10183
10302
|
failed = true;
|
|
10184
10303
|
const step = bound === undefined ? '' : weightStepText(bound.rig, m.slot, m.attachment, at.edge, bound);
|
|
10304
|
+
const band = bound === undefined ? '' : contourBandText(bound.rig, m.slot, m.attachment, at.edge, bound, slotParts);
|
|
10185
10305
|
problems.push({
|
|
10186
10306
|
code: 'CHECK_TEXTURE_STRETCH',
|
|
10187
10307
|
object: `mesh "${m.slot}" ${stretchAtText(at)}`,
|
|
10188
|
-
detail: `the edge is ${round3(at.ratio)} times its rest length (max(ratio, 1/ratio) ${severity}); <= ${TEXTURE_STRETCH_CEILING} is required${bound === undefined ? '' : `; ${edgeBonesText(bound.rig, bound.motion, m.slot, m.attachment, at.edge)}${step === '' ? '' : `; ${step}`}`} — the texture on it is ${at.ratio >= 1 ? 'stretched' : 'squeezed'}: the bones this mesh is weighted to move apart (amplitudes too large down a chain), or a vertex blends bones that move against each other`,
|
|
10308
|
+
detail: `the edge is ${round3(at.ratio)} times its rest length (max(ratio, 1/ratio) ${severity}); <= ${TEXTURE_STRETCH_CEILING} is required${bound === undefined ? '' : `; ${edgeBonesText(bound.rig, bound.motion, m.slot, m.attachment, at.edge)}${step === '' ? '' : `; ${step}`}${band === '' ? '' : `; ${band}`}`} — the texture on it is ${at.ratio >= 1 ? 'stretched' : 'squeezed'}: the bones this mesh is weighted to move apart (amplitudes too large down a chain), or a vertex blends bones that move against each other`,
|
|
10189
10309
|
});
|
|
10190
10310
|
}
|
|
10191
10311
|
}
|
package/src/localweights.ts
CHANGED
|
@@ -97,8 +97,12 @@ function onSegment(px: number, py: number, ax: number, ay: number, bx: number, b
|
|
|
97
97
|
return px >= Math.min(ax, bx) && px <= Math.max(ax, bx) && py >= Math.min(ay, by) && py <= Math.max(ay, by);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
function compareBigInt(a: bigint, b: bigint): -1 | 0 | 1 {
|
|
101
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Compare the squared distance from p to segment a–b against `r2`: -1 below, 0 equal, 1 above. Exact on integer units. */
|
|
105
|
+
function compareSegmentDistance2(px: number, py: number, ax: number, ay: number, bx: number, by: number, r2: bigint): -1 | 0 | 1 {
|
|
102
106
|
const dx = bx - ax;
|
|
103
107
|
const dy = by - ay;
|
|
104
108
|
const vx = px - ax;
|
|
@@ -106,10 +110,15 @@ function atLeast(px: number, py: number, ax: number, ay: number, bx: number, by:
|
|
|
106
110
|
const along = BigInt(vx) * BigInt(dx) + BigInt(vy) * BigInt(dy);
|
|
107
111
|
const len2 = BigInt(dx) * BigInt(dx) + BigInt(dy) * BigInt(dy);
|
|
108
112
|
const sq = (x: number, y: number): bigint => BigInt(x) * BigInt(x) + BigInt(y) * BigInt(y);
|
|
109
|
-
if (along <= 0n) return sq(vx, vy)
|
|
110
|
-
if (along >= len2) return sq(px - bx, py - by)
|
|
113
|
+
if (along <= 0n) return compareBigInt(sq(vx, vy), r2);
|
|
114
|
+
if (along >= len2) return compareBigInt(sq(px - bx, py - by), r2);
|
|
111
115
|
const cross = BigInt(dx) * BigInt(vy) - BigInt(dy) * BigInt(vx);
|
|
112
|
-
return cross * cross
|
|
116
|
+
return compareBigInt(cross * cross, r2 * len2);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Is the squared distance from p to a–b at least `r2`? Exact, integer units, `BigInt` where a product could pass 2^53. */
|
|
120
|
+
function atLeast(px: number, py: number, ax: number, ay: number, bx: number, by: number, r2: bigint): boolean {
|
|
121
|
+
return compareSegmentDistance2(px, py, ax, ay, bx, by, r2) >= 0;
|
|
113
122
|
}
|
|
114
123
|
|
|
115
124
|
/** Strictly inside the ring by the crossing rule, on integer units (a point on an edge is asked separately). */
|
|
@@ -123,6 +132,43 @@ function insideRing(px: number, py: number, xs: readonly number[], ys: readonly
|
|
|
123
132
|
return inside;
|
|
124
133
|
}
|
|
125
134
|
|
|
135
|
+
/** Where a 1/256 px grid point sits relative to `reg` and its declared falloff band: exact on integer units. */
|
|
136
|
+
export type RegionBandSite = 'region' | 'band' | 'cutoff' | 'outside';
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Classify `p` against `reg` and its declared `band` (`0 < d < band` is `'band'`, `d === band` with `band > 0` is `'cutoff'`).
|
|
140
|
+
* `p` must lie on the 1/256 px grid, like every contour vertex {@link localInfluences} weights.
|
|
141
|
+
*/
|
|
142
|
+
export function regionBandSite(p: Point, reg: WeightRegion): RegionBandSite {
|
|
143
|
+
const px = units(p[0], 'point x');
|
|
144
|
+
const py = units(p[1], 'point y');
|
|
145
|
+
const B = units(reg.band, 'band');
|
|
146
|
+
if (reg.shape === 'circle') {
|
|
147
|
+
const dx = px - units(reg.cx, 'cx');
|
|
148
|
+
const dy = py - units(reg.cy, 'cy');
|
|
149
|
+
const R = units(reg.r, 'r');
|
|
150
|
+
const d2 = BigInt(dx) * BigInt(dx) + BigInt(dy) * BigInt(dy);
|
|
151
|
+
if (d2 <= BigInt(R) * BigInt(R)) return 'region';
|
|
152
|
+
if (B === 0) return 'outside';
|
|
153
|
+
const outer2 = BigInt(R + B) * BigInt(R + B);
|
|
154
|
+
return d2 < outer2 ? 'band' : d2 === outer2 ? 'cutoff' : 'outside';
|
|
155
|
+
}
|
|
156
|
+
const xs = reg.points.map((q) => units(q[0], 'polygon x'));
|
|
157
|
+
const ys = reg.points.map((q) => units(q[1], 'polygon y'));
|
|
158
|
+
const n = xs.length;
|
|
159
|
+
for (let i = 0; i < n; i++) if (onSegment(px, py, xs[i], ys[i], xs[(i + 1) % n], ys[(i + 1) % n])) return 'region';
|
|
160
|
+
if (insideRing(px, py, xs, ys)) return 'region';
|
|
161
|
+
if (B === 0) return 'outside';
|
|
162
|
+
const B2 = BigInt(B) * BigInt(B);
|
|
163
|
+
let atCutoff = false;
|
|
164
|
+
for (let i = 0; i < n; i++) {
|
|
165
|
+
const cmp = compareSegmentDistance2(px, py, xs[i], ys[i], xs[(i + 1) % n], ys[(i + 1) % n], B2);
|
|
166
|
+
if (cmp < 0) return 'band';
|
|
167
|
+
if (cmp === 0) atCutoff = true;
|
|
168
|
+
}
|
|
169
|
+
return atCutoff ? 'cutoff' : 'outside';
|
|
170
|
+
}
|
|
171
|
+
|
|
126
172
|
/**
|
|
127
173
|
* The nominal linear share at `p` (same frame as the region), used to decide
|
|
128
174
|
* support. `p` must be on the 1/256 px grid. See the module header for
|