rig-parts 1.71.0 → 1.72.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/README.md +13 -8
- package/docs/AUTHORING.md +47 -7
- package/package.json +1 -1
- package/src/assemble.ts +62 -8
- package/src/build.ts +1 -0
- package/src/config.ts +425 -32
- package/src/rig.ts +250 -40
- package/src/turn.ts +159 -8
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# rig-parts
|
|
1
|
+
# @rig-c/parts — CLI `rig-parts`
|
|
2
2
|
|
|
3
3
|
**AI-authored 2D character rigs from one anime painting, verified before they
|
|
4
4
|
are written.** rig-parts generates no images. The painting and See-through layers
|
|
@@ -157,7 +157,7 @@ atlas written by anything else would have no oracle behind it.
|
|
|
157
157
|
| stage | tool | what it owns |
|
|
158
158
|
| --- | --- | --- |
|
|
159
159
|
| painting + See-through layers → parts and specs | **rig-parts** (npm `@rig-c/parts`) | the merge of two runs, the measurements, the rig spec and motion spec |
|
|
160
|
-
| specs → Spine skeleton data | **[rig-c](https://github.com/rig-c/core)** (npm `rig-c`) | compile, the gate (rigc's own validator in an install; the round trip through `spine-core` where the runtime is beside it, as in this repository's CI), the named assertions, the packer, the renderer |
|
|
160
|
+
| specs → Spine skeleton data | **[@rig-c/core](https://github.com/rig-c/core)** (canonical npm `@rig-c/core`; this package's dependency is literally `rig-c`) | compile, the gate (rigc's own validator in an install; the round trip through `spine-core` where the runtime is beside it, as in this repository's CI), the named assertions, the packer, the renderer |
|
|
161
161
|
| skeleton data → a page | **[rig-play](https://github.com/rig-c/play)** (npm `@rig-c/play`; formerly spine-html), a sibling project | a DOM renderer; rigc's `rig-play` profile is its policy, and every build here is gated under that profile as well as under `spine` |
|
|
162
162
|
|
|
163
163
|
rig-parts never writes Spine data itself. Everything on disk under `check/build/`
|
|
@@ -512,11 +512,11 @@ as this port wrote it in issue #227).
|
|
|
512
512
|
[Bun](https://bun.sh) 1.2 or later. `npm i -D @rig-c/parts` installs the
|
|
513
513
|
`rig-parts` command (`npm install -g @rig-c/parts` puts it on `PATH`); it hands off
|
|
514
514
|
to Bun and says so in one sentence if Bun is not on `PATH`. **`@rig-c/parts` is the
|
|
515
|
-
package's name; versions 1.0.0-rc.1 to 1.5.3 were published as `rig-parts`, and
|
|
515
|
+
package's canonical name; versions 1.0.0-rc.1 to 1.5.3 were published as `rig-parts`, the convenience install name, and
|
|
516
516
|
versions up to 0.16.0
|
|
517
|
-
as `spine-parts`,
|
|
517
|
+
as `spine-parts`, the legacy install name**, and the install keeps a `spine-parts` command
|
|
518
518
|
beside `rig-parts` for the transition, the same launcher under both names. On npm
|
|
519
|
-
both
|
|
519
|
+
both compatibility names stay published beside `@rig-c/parts` at every version, as aliases
|
|
520
520
|
carrying the same files with only the `name` in `package.json` changed, so a
|
|
521
521
|
project that depends on either keeps receiving every release; a new
|
|
522
522
|
install names `@rig-c/parts` ([RELEASING.md](RELEASING.md), *The registry side*). rig-c
|
|
@@ -587,10 +587,15 @@ separate, and its agreement reading cannot certify an image's polarity.
|
|
|
587
587
|
|
|
588
588
|
Assembly emits registered part sheets and references; rig emits PAD4 sheets and
|
|
589
589
|
`depth_sheets.json`. Since 1.68.0 (#777), [config.turn.roles](docs/AUTHORING.md#3-configjson-field-by-field)
|
|
590
|
-
uses depth sheets for 2.5D head turns with grid surfaces and `yaw_dial`/`pitch_dial`
|
|
590
|
+
uses depth sheets for 2.5D head turns with grid or authored weighted surfaces and `yaw_dial`/`pitch_dial`
|
|
591
591
|
controls; see [`CONFIG_TURN_ROLE_UNKNOWN`](docs/AUTHORING.md#CONFIG_TURN_ROLE_UNKNOWN)
|
|
592
592
|
and [`CONFIG_TURN_SURFACE_REQUIRED`](docs/AUTHORING.md#CONFIG_TURN_SURFACE_REQUIRED).
|
|
593
|
-
|
|
594
|
-
|
|
593
|
+
`turn.body.roles` adds independent body yaw. A weighted mesh declared as
|
|
594
|
+
`"surface"` in either group and blending head and torso bones receives both
|
|
595
|
+
fields in proportion to its skin weights. Each sibling island takes only its
|
|
596
|
+
own group; parts without a blended attachment keep their existing role behavior
|
|
597
|
+
and output bytes. Unlisted meshes do not consume turn depth sheets. See the
|
|
598
|
+
[blended surface contract](docs/AUTHORING.md#per-layer-depth-sheets-773).
|
|
599
|
+
No-image builds keep the legacy output bytes. `comfy seethrough --config <file> --depth-run <full|head>`
|
|
595
600
|
uses the same opt-in; its default captures art only. Standalone authored part
|
|
596
601
|
references remain active declarations. See [the input contract and refusals](docs/AUTHORING.md#per-layer-depth-sheets-773).
|
package/docs/AUTHORING.md
CHANGED
|
@@ -41,7 +41,7 @@ with `flattenRig(built)`, not with the built file.
|
|
|
41
41
|
| what | why | how |
|
|
42
42
|
| --- | --- | --- |
|
|
43
43
|
| [Bun](https://bun.sh) 1.2 or later | rig-parts and rig-c are Bun programs | `npm install -g @rig-c/parts` installs the command; it says so if Bun is missing |
|
|
44
|
-
| [rig-c](https://www.npmjs.com/package
|
|
44
|
+
| [@rig-c/core](https://www.npmjs.com/package/@rig-c/core) | compiles, gates, packs and renders every rig; rig-parts writes no Spine data itself | installed with rig-parts as the literal dependency `rig-c` (`node_modules/.bin/rigc`); with no Spine runtime beside it, it gates with its own validator, and `rigc --version` says `entry: cli_core.ts` |
|
|
45
45
|
| [See-through](https://github.com/shitagaki-lab/see-through), somewhere | the layer decomposition is the input | any route in README *Getting See-through layers*; it runs twice per character, outside this tool |
|
|
46
46
|
| a GPU, wherever See-through runs | See-through is a diffusion model | nothing in rig-parts itself uses a GPU |
|
|
47
47
|
|
|
@@ -136,7 +136,7 @@ read by no CPU stage).
|
|
|
136
136
|
| `motion.animations_from` | rig; check (named; read for folds) | optional, never proposed (issue #183): a path, relative to the config file's directory, to a file in rig-c's motion-spec shape, `{"spec": "rigc-motion/1", "animations": {"<name>": {"duration": …, "tracks": [...]}, …}}` — an expression, a gesture, anything beside the idle. On every `rig` and `build` each of its animations is written into `rig/motion.json` after `idle`, as read: nothing added, re-keyed or judged here (except `derive` keys on `turn`/`tilt`, issue #436, and `{"t": …, "set": "<name>" \| null}` keys on slot `"attachment"` tracks, issue #473, which expand to `"v": "<set>_<slot>"` or `"v": null` when the set hides the slot, or `"v": "<slot>"` for `null`, refused with `CONFIG_SET_COVERS_SLOT` when the set is undeclared or does not cover the track's slot), and each is rigc's to accept or refuse at the rig stage's gate, in rigc's words. It may name what `motion.json` already holds — the bones `bones` declares, the easings `shut` and `open`, the groups `eyes` and `brows` when the blink writes them — and nothing else from the file reaches it. The loader refuses, every problem at once: no such file or one that cannot be read (`CONFIG_FILE_PRESENT`), text that is not JSON (`CONFIG_IS_JSON`), a file that is not an object, a `spec` other than `"rigc-motion/1"`, an `animations` that is not a table of objects (`CONFIG_FIELD_TYPE`), any other key — rig-c's `easings`, `groups`, `setup`, `physics`, `mix`, `archetype` and `cut` included, which would be read and not written (`CONFIG_KEY_KNOWN`), an animation named `idle` (`CONFIG_ANIMATION_NAME_FREE`), and a key written twice in one object of the file, which JSON would fold into its last value without a word (`CONFIG_KEY_UNIQUE`). `check` names the others on one line (`beside the idle: …`) and reads each for folds, with the idle — `ANIMATIONS_DO_NOT_FOLD` (§7, issues #320, #333); every other bar reads the idle. Absent, `motion.json` holds the idle alone, byte for byte as before, and `check` reads that idle for folds |
|
|
137
137
|
| `constraints` | rig (handed to rig-c as `rig.json`'s `constraints`); `compare` and the coverage lines (roles) | **authored**, optional; `propose` writes none, but with `--cloth` (issue #364), where it writes the recipe's physics and swing transforms (*Recipe: cloth and hair that answer the world*, below). A list of constraints in **rig-c's own rig-spec shape** (`RigConstraint`: `ik`, `transform`, `path`, `physics`, `slider` — rig-c's `src/rig.ts` documents every field), in the order rigc applies them. The loader checks only what this package owns: each entry is an object with a `type` rigc names (`CONFIG_CONSTRAINT_TYPE_KNOWN`) and a non-empty `name`, unique within its kind as rigc finds constraints (`CONFIG_CONSTRAINT_NAME_UNIQUE`; an ik and a transform may share one); every bone it names — `bones`, an ik's `target`, a transform's `source`, a physics or slider constraint's `bone` — is a bone `bones` declares, a chain link as `<chain><i>` (`CONFIG_NAME_RESOLVES`); the bone a constraint follows does not sit under a bone it drives (`CONFIG_CONSTRAINT_TARGET_DETACHED`). Every other field (`mix`, `softness`, `properties`, a path's `slot`, a slider's `animation`) and every value is rigc's to accept or refuse at the rig stage's gate, in rigc's words (`RIG_RIGC_GREEN`) — an ik's `bones` as a shape too: from rig-c 2.15.0 rigc refuses an ik over more than two bones, or over a pair whose second bone is not the first's child (issue #103; this loader refused both itself until then). A note and an `x-` record may ride on an entry; the rig stage leaves them out of what it hands rigc. Under the default `--idle-keys ctl` a two-bone ik whose child link the idle keys is split by that link's control, and rigc refuses the pair: run `rig --idle-keys direct` or `build --idle-keys direct` (the rig stage adds that sentence, naming the flag on the command that ran, to rigc's line; `build` forwards it to its rig stage, issue #95). Each bone a constraint follows is declared to rigc as `invariants.detached` from every bone it drives, which rigc's gate rule `A25` checks |
|
|
138
138
|
| `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 |
|
|
139
|
-
| `turn` | rig (adds the turn control or 2.5D head-turn producer) | **proposed** only with `propose --full`/`--head` (issue #251), then corrected, or **authored** for 2.5D depth-sampled head turns (issue #763): `{pivot?, depths?, deform?, band?, radius?, surface?: {radius?}, head?: {pivot?, radius?}, roles?, counter?, grid?, unitDepths?, body?}`. When `roles` is declared (`{<part>: "surface" \| "unit" \| "rear"}`, issue #763; `CONFIG_TURN_ROLE_UNKNOWN`, `CONFIG_TURN_SURFACE_REQUIRED`, `
|
|
139
|
+
| `turn` | rig (adds the turn control or 2.5D head-turn producer) | **proposed** only with `propose --full`/`--head` (issue #251), then corrected, or **authored** for 2.5D depth-sampled head turns (issue #763): `{pivot?, depths?, deform?, band?, radius?, surface?: {radius?}, head?: {pivot?, radius?}, roles?, counter?, grid?, unitDepths?, body?}`. When `roles` is declared (`{<part>: "surface" \| "unit" \| "rear"}`, issue #763; `CONFIG_TURN_ROLE_UNKNOWN`, `CONFIG_TURN_SURFACE_REQUIRED`, `RIG_TURN_SURFACE_MESH_BINDINGS`, `CONFIG_TURN_UNIT_MESH_BONES`), the rig stage runs the 2.5D depth-sampled head-turn producer: it edge-extends each turn-bound part's depth sheet across its transparent border and semi-transparent fringe from the nearest fully opaque (`alpha === 255`) texel before `PAD = 4` clamping (`padTurnDepthSheet`, `DEPTH_SILHOUETTE_SIZE_MISMATCH`), keeps authored `"surface"` meshes and their skinning (#795), sampling each vertex at its weighted setup position on its own extended sheet and emitting one inverse-setup-bone offset per influence (`D = -(pivot + z - zRef) * sin(angle)`, on x for yaw and y for pitch, with no narrowing or 2D spin); shared frames moved by another turn role are refused (`RIG_TURN_SURFACE_MESH_BINDINGS`), as are alternate drawings without their own depth sampling frame (`RIG_TURN_SURFACE_MESH_ATTACHMENT`). It promotes `"surface"` regions to `generator: {kind: "grid", cols, rows, depth}` (`grid`: `[cols, rows]` or `{<part>: [cols, rows]}`, default `[13, 16]`, bounded at `<= 2,400` triangles per slot and `<= 4,000` total, `RIG_TURN_GRID_BUDGET`, `RIG_TURN_SURFACE_DEPTH_REQUIRED`, `RIG_TURN_SHARED_DEPTH_SCALE`), emits `faceshift` and `rear_shift` under `head` (`CONFIG_TURN_HEAD_BONE`, `RIG_TURN_HEAD_BONE`), `<part>_surface` and `<part>_unit` under `faceshift`, and `yaw_dial` and `pitch_dial` under `root` (`CONFIG_TURN_BONE_FREE`, `RIG_TURN_NAME_FREE`), re-parents `"unit"` region bones and `"rear"` bones and mesh weights to `faceshift` and `rear_shift` (while `"unit"` mesh parts receive their own `<part>_unit` carrier under `faceshift`, rebind direct `"head"` weights to `<part>_unit`, reparent bound chain roots to `<part>_unit` while keeping chain skinning weights intact, and key `<part>_unit` in `turn_units`, #790), samples each `"unit"` bone's depth from the `"surface"` depth sheet at its rest position (or reads `unitDepths.<part>`, `RIG_TURN_UNIT_DEPTH_REQUIRED`), enforces ear occlusion (`ear_r`/`ear_l` drawn before the `face` surface in `assemble.plan`, `CONFIG_TURN_EAR_DRAW_ORDER`, and behind the cheek surface, `RIG_TURN_EAR_DEPTH_BEHIND_CHEEK`), and writes `turn` and `tilt` `derive` tracks (`pivot` default `55` rig px, `counter` default `0.1` in `[0, 1]`, `CONFIG_TURN_COUNTER_RANGE`). `depths` holds, per part, the See-through layer's `depth_median` the part came from (larger = further back), read from the run the part was assembled from; a `painting:` patch has none and is not carried. A rider (issue #271) — a part from an `eyewhite`, `irides`, `eyelash`, `eyebrow`, `nose` or `mouth` layer — is drafted at the `face` part's depth, 0.001 nearer when parts.json draws it after the face and 0.001 further when before: See-through makes no depth of its own for the eye group (it cuts them from one depth map of the combined eyes) and clamps nose and mouth to the face's median − 0.001, and the two runs' own medians for these layers disagreed by up to 0.47 and swapped their order against the face. Every other layer — ears, headwear and earwear included — keeps its own median, unless it rides another part's bone. With no `face` part, or more than one, the riders keep their own and a note says so. A rider by bone (issue #535) — a part every *ownable* bone of which (a chain link, or a bone no other bone hangs from; `head`, `chest` and any bone with a child are shared and never count on their own) is *hosted* by another carried part, the host of a bone being the carried part that binds it (its region's bone; a mesh's `segments`, `contour` and `auto` regions' bones) with the most `opaque_px`, the earlier in parts.json on a tie, and which hosts no bone itself — is drafted at its host's depth, 0.001 nearer when drawn after the host and 0.001 further when before, and a note names the host, the bones and its own median: a pin, clip or ornament on the back hair's links travels with the back hair, not with its own layer's depth. `propose` reads the proposal's own `bones`, `meshes` and `regions`; the face riders are read by their tag first and never by their bones. A part bound to two hosts' bones rides neither and a note says so. In the rig stage, an authored depth on a rider by bone whose fraction differs from its host's by more than 0.1 of the dial (`TURN_RIDER_APART`, a share of `pivot − nearest`) is refused (`CONFIG_TURN_RIDER_DEPTH`); the host is read off `parts.json`'s `opaque_px`, so the config loader cannot see it. One note lists each part's depth and where it came from; a carrier the other run places more than 10 % of `pivot − nearest` away gets a note naming both values and the run read — the two runs are not reconciled. `pivot` is the depth that stays put; `propose` drafts the mean of the parts' depths weighted by `opaque_px`, the one depth at which the painted pixels' centroid does not slide under the dial. The rig stage adds a bone `turn` under `root` at its origin that nothing keys — its local x is the dial, in rig px — and carries each part by `(pivot − depth) / (pivot − nearest depth)` of it: the nearest part all of it, a part behind the pivot the other way, a part at the pivot not at all. Each part rides leaf twins (`turn_<part>_<bone>`, an identity child of every bone its slot and weights bind) moved by one `transform` constraint (`turn_<part>`, after the config's own); the idle's keys, the `<bone>_ctl` controls and a physics constraint stay on the bones, and the dial moves none of them. Optional `deform` (`Partial<FaceDeformFractions>`, issue #436) overrides the Set B ×2.5 face surface deformation table (`FACE_DEFORM_FRACTIONS`, checked against `FACE_DEFORM_RANGES` by `CONFIG_TURN_DEFORM_RANGE`); when `applyFaceSurfaceDeform` runs on a rig whose `motion` carries `tilt` or `turn` slider `derive` keys, it requires `config.turn` (`CONFIG_TURN_REQUIRED`, issue #478; `propose --full`/`--head` drafts it), promotes `face` on `head` (or `turn_face_head` when `turn` is declared) to the uneven 5×5 grid mesh, keys `face`, `hair_front` and `hair_back` deform timelines and ear/topknot tracks from `evalPitchFaceSurface` and `evalYawFaceSurface`, and samples the same deform field across each `features` member's rest span (`featRx = (24 / 106) · W`, `featRy = (12 / 128) · H`) with its depth fraction `z / zRef` as the field's angle input and chord foreshortening (`scalex` narrowing on the leading side and widening on the trailing side, `scaley` on pitch) so every feature's bounding box stays inside the deformed face plate across the rated band (issue #468). On yaw (`issue #479`), `evalYawFaceSurface` evaluates a **cylinder projection** (`cylinderYawDx`: `Δx(x, θ, R) = R · (sin(clamp(arcsin(clamp(x / R, −1, 1)) − θ, −π/2, π/2)) − clamp(x / R, −1, 1))`) of radius `R` (`turnSurfaceRadius`: `turn.surface.radius ?? turn.radius ?? turn.head.radius`, positive rig px checked by `CONFIG_FIELD_TYPE`, defaulting to half the face plate's opaque width `W / 2`) tapered by a cubic Hermite outline weight (`wOutline = 1` for `\|ux\| <= 0.7`, reaching `0` at `\|ux\| = 1.0`) so features slide across a fixed outline (`iris` shift within `±2%` of `cylinderYawDx`), the trailing cheek strip widens (`>= 1.54×` at `±15°`), and the leading jaw edge holds fixed (`0 px` shift) unless explicit horizontal `turn.deform` overrides (`turn_mid_x`, `turn_lead_compress_x`, `turn_trail_shift_x`) request the flat yaw table. On yaw (`issue #478`), `applyFaceSurfaceDeform` also derives a **head-only pivot** (`headTurnPivot`: `turn.head.pivot` when authored, otherwise the `opaque_px`-weighted mean of `depths[part]` across the head parts `DEFAULT_HEAD_TURN_PARTS` — `face`, `hair_front`, `hair_back`, `ear_r`, `ear_l`, `hairpin` — from `parts.json`, falling back to `turn.pivot`) so a forward torso or arm in `turn.depths` does not pull the head's rotation axis in front of `face`: `hair_back` (`depth_median > headPivot`, negative `headTurnFraction`) and `hairpin` behind `headPivot` translate opposite to the face's turn (`dx = s · turn_face_center_x · W · (headPivot − depth) / (headPivot − nearestHeadDepth)`), emerging on the trailing side to compensate for the leading-cheek foreshortening and keeping the combined head silhouette width near-constant across `±15°` without any same-sign `turn_hair_back_cheek_x` term. Optional `band` (`number` or `{yaw?, pitch?}`, positive degrees, issue #472) declares the rig's rated face turn band (default `FACE_RATED_BAND`: `yaw <= 15°`, `pitch <= 12°`); declaring a `turn.band` or a `motion.animations_from` `turn`/`tilt` `derive.degrees` above `±15°` yaw or `±12°` pitch without an `assemble.alternates` entry that replaces `face` is refused (`CONFIG_FACE_BAND_EXCEEDED`), and on a single-plate rig `applyFaceSurfaceDeform` adds self-targeting transform constraints `yaw_clamp` (`[-15, 15]`) and `pitch_clamp` (`[-12, 12]`) ahead of the slider constraints so driving `yaw` or `pitch` beyond the rated band clamps at the boundary. At rest: with `turn` declared, no pixel differs by more than 1 level at dial 0 (not byte-identical; the cause is float noise in the identity child bones, and the constraints add nothing); without `turn`, byte-identical. Neither `pivot` nor `depths` has a default (`CONFIG_FIELD_PRESENT`); `pivot` and `head.pivot` must lie behind the nearest part (`CONFIG_TURN_PIVOT_BEHIND_NEAREST`). Absent, no control is added and no byte of any output moves |
|
|
140
140
|
| `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 |
|
|
141
141
|
| `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. The config written: `propose --cloth <config.json> --write-config <out.json>` (issue #537) writes this config's own text back with the sections the recipe drafts spliced in — `meshes.<part>` and `regions.<part>`, and `bones`, `constraints` and `motion.tracks` entry by entry by name (issue #552) — and every other byte as read; `--from <previous config>` (issue #571) takes an entry equal to the previous recipe's draft as the recipe's (*The config written*, under the recipe below) |
|
|
142
142
|
| `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 |
|
|
@@ -4513,10 +4513,13 @@ and stay absent).
|
|
|
4513
4513
|
| <a id="CONFIG_TURN_COUNTER_RANGE"></a>`CONFIG_TURN_COUNTER_RANGE` | `config.turn.counter` (or `config.turn.body.counter`) is outside `[0, 1]` | supply a non-negative rear counter-translation fraction in `[0, 1]` |
|
|
4514
4514
|
| <a id="CONFIG_TURN_ROLE_UNKNOWN"></a>`CONFIG_TURN_ROLE_UNKNOWN` | `config.turn.roles.<part>` (or `config.turn.body.roles.<part>`) is not `"surface"`, `"unit"` or `"rear"` | declare `"surface"`, `"unit"` or `"rear"` |
|
|
4515
4515
|
| <a id="CONFIG_TURN_SURFACE_REQUIRED"></a>`CONFIG_TURN_SURFACE_REQUIRED` | `config.turn.roles` (or `config.turn.body.roles`) declares no `"surface"` part | declare at least one part as `"surface"` |
|
|
4516
|
-
| <a id="
|
|
4517
|
-
| <a id="CONFIG_TURN_EAR_DRAW_ORDER"></a>`CONFIG_TURN_EAR_DRAW_ORDER` | an ear part in `config.turn.roles` is drawn after
|
|
4516
|
+
| <a id="CONFIG_TURN_UNIT_MESH_BONES"></a>`CONFIG_TURN_UNIT_MESH_BONES` | `config.turn.roles.<part>` (or `config.turn.body.roles.<part>`) declares `"unit"` for a mesh part in `config.meshes` that binds a bone outside the `"head"` subtree (or outside the torso carrier subtree for `turn.body`), or shares a bound bone or chain with another `"unit"` mesh part, so its bones cannot be moved under `<part>_unit` (#790) | bind each `"unit"` mesh only to `"head"` and its own child bones or chains under `"head"` (or to the torso root bone and its own non-head descendants for `turn.body`), or give the part role `"rear"` |
|
|
4517
|
+
| <a id="CONFIG_TURN_EAR_DRAW_ORDER"></a>`CONFIG_TURN_EAR_DRAW_ORDER` | an ear part in `config.turn.roles` is drawn after `face` with role `"surface"` in `assemble.plan` | place `ear_r` and `ear_l` before `face` in `assemble.plan` so the turning cheek occludes the far ear |
|
|
4518
4518
|
| <a id="CONFIG_TURN_HEAD_BONE"></a>`CONFIG_TURN_HEAD_BONE` | `config.turn.roles` is declared without a single bone `"head"` in `config.bones`, or `config.turn.body` without a single bone `"chest"` / `"hip"` (or its declared `bone`) | declare `"head"` (or the body turn root bone) as a single bone in `config.bones` |
|
|
4519
4519
|
| <a id="CONFIG_TURN_SLIDER_NAME_FREE"></a>`CONFIG_TURN_SLIDER_NAME_FREE` | `config.turn.body.slider` (or the default `"body_yaw_dial"`) collides with a head turn dial (`"yaw"`, `"pitch"`, `"yaw_dial"`, `"pitch_dial"`) or an existing slider constraint in `config.constraints` (#787) | choose a distinct slider name in `config.turn.body.slider` |
|
|
4520
|
+
| <a id="RIG_TURN_SURFACE_MESH_GROUPS"></a>`RIG_TURN_SURFACE_MESH_GROUPS` | a surface part contains a blended attachment but lacks one 2.5D group, includes an ungrouped positive influence in any attachment, or also declares a unit/rear role | declare both `turn.roles` and `turn.body`, a body root outside head, surface in one or both groups, and bindings wholly inside those two subtrees |
|
|
4521
|
+
| <a id="RIG_TURN_SURFACE_MESH_BINDINGS"></a>`RIG_TURN_SURFACE_MESH_BINDINGS` | an authored surface mesh has unresolved/nonclosing weights or shares a frame moved by a unit/rear turn carrier | provide weighted bindings closing at 1 in the authored frame; use independent chains for parts with different roles |
|
|
4522
|
+
| <a id="RIG_TURN_SURFACE_MESH_ATTACHMENT"></a>`RIG_TURN_SURFACE_MESH_ATTACHMENT` | a surface mesh has an alternate drawing without its own registered depth sampling frame | use the base attachment; explicit islands retain their own slot, attachment and bindings |
|
|
4520
4523
|
| <a id="RIG_TURN_SURFACE_DEPTH_REQUIRED"></a>`RIG_TURN_SURFACE_DEPTH_REQUIRED` | a part with role `"surface"` in `config.turn.roles` or `config.turn.body.roles` carries no depth sheet in `parts.json` | run `assemble` with `config.depth` or provide `<part>_depth.png` in `parts.json` |
|
|
4521
4524
|
| <a id="RIG_TURN_GRID_BUDGET"></a>`RIG_TURN_GRID_BUDGET` | a `"surface"` grid exceeds 2,400 triangles on one slot or 4,000 triangles across all `"surface"` slots | lower `config.turn.grid` / `config.turn.body.grid` `[cols, rows]` within the per-slot and total budgets |
|
|
4522
4525
|
| <a id="RIG_TURN_HEAD_BONE"></a>`RIG_TURN_HEAD_BONE` | `buildRig` found no `"head"` (or body turn root) bone when emitting 2.5D turn carriers | declare `"head"` (or the body turn root bone) in `config.bones` |
|
|
@@ -5564,14 +5567,51 @@ still split has separate lower/upper scalar slices at the same row as the art;
|
|
|
5564
5567
|
both keep original source provenance. Its references describe inputs for Core's
|
|
5565
5568
|
`generator.depth = {image, near, zScale}`; sources are provenance, not Core
|
|
5566
5569
|
fields. Since 1.68.0 (#777), [config.turn.roles](#3-configjson-field-by-field) consumes
|
|
5567
|
-
depth sheets for 2.5D head turns with grid surfaces and `yaw_dial`/`pitch_dial`
|
|
5570
|
+
depth sheets for 2.5D head turns with grid surfaces or authored weighted surface meshes (#795) and `yaw_dial`/`pitch_dial`
|
|
5568
5571
|
controls, and `config.turn.body` (#787) extends the same 2.5D turn pipeline to
|
|
5569
5572
|
torso/body parts under an independent `body_yaw_dial` (or `turn.body.slider`)
|
|
5570
5573
|
dial; see [`CONFIG_TURN_ROLE_UNKNOWN`](#CONFIG_TURN_ROLE_UNKNOWN),
|
|
5571
5574
|
[`CONFIG_TURN_SURFACE_REQUIRED`](#CONFIG_TURN_SURFACE_REQUIRED),
|
|
5572
|
-
[`
|
|
5575
|
+
[`RIG_TURN_SURFACE_MESH_BINDINGS`](#RIG_TURN_SURFACE_MESH_BINDINGS),
|
|
5576
|
+
[`CONFIG_TURN_UNIT_MESH_BONES`](#CONFIG_TURN_UNIT_MESH_BONES) and
|
|
5573
5577
|
[`CONFIG_TURN_SLIDER_NAME_FREE`](#CONFIG_TURN_SLIDER_NAME_FREE).
|
|
5574
|
-
|
|
5578
|
+
A weighted surface spanning the head and body subtrees (#796) takes both
|
|
5579
|
+
fields. Declare it as `"surface"` in `turn.roles` or `turn.body.roles` (both is
|
|
5580
|
+
also accepted), with both 2.5D groups present. Head descendants belong to the
|
|
5581
|
+
head group; the body root (`turn.body.bone`, otherwise `chest`, otherwise `hip`)
|
|
5582
|
+
and its descendants outside head belong to the body group. Each vertex's
|
|
5583
|
+
setup position samples that part's own extended sheet; each group's pivot and
|
|
5584
|
+
reference-depth rule produce its offset. A vertex with 0.7 torso and 0.3 head
|
|
5585
|
+
weights receives `0.7 * bodyOffset + 0.3 * headOffset`. Each influence stores
|
|
5586
|
+
only its group's inverse-frame offset; Spine applies its weight once. Head yaw
|
|
5587
|
+
and pitch and body yaw remain independent and additive. No bone is rebound,
|
|
5588
|
+
no topology is regenerated, and the neutral keys are empty. The split is
|
|
5589
|
+
enabled only when a part contains an attachment with positive bindings to
|
|
5590
|
+
both groups. Every attachment of that part then carries its own
|
|
5591
|
+
group mask: a head-only sibling island receives head yaw/pitch only; a
|
|
5592
|
+
body-only sibling receives body yaw only. An inactive group's timeline is
|
|
5593
|
+
omitted, so a zero timeline cannot overwrite the active slider's deform.
|
|
5594
|
+
Their authored topology and binding order remain unchanged. A part with no blended attachment keeps its explicit
|
|
5595
|
+
role behavior and output bytes, even if separate single-group islands bind
|
|
5596
|
+
different subtrees. Generated meshes and explicit mixed attachments use the
|
|
5597
|
+
same split.
|
|
5598
|
+
|
|
5599
|
+
An unlisted mesh does not opt in merely by spanning the subtrees. A blended
|
|
5600
|
+
surface requires its own depth sheet (`RIG_TURN_SURFACE_DEPTH_REQUIRED`) and
|
|
5601
|
+
both groups, with every positive influence in one of their subtrees, including
|
|
5602
|
+
on sibling attachments (`RIG_TURN_SURFACE_MESH_GROUPS`). Zero weights do not
|
|
5603
|
+
make an attachment blended or require the other group; on the split path
|
|
5604
|
+
their deform pairs are zero and retain their place in the binding stream.
|
|
5605
|
+
Every binding name must still resolve and weights must still close at one,
|
|
5606
|
+
even for an inactive sibling. Do not use `"unit"` to opt in: its existing
|
|
5607
|
+
`CONFIG_TURN_UNIT_MESH_BONES` rule still requires one carrier subtree.
|
|
5608
|
+
Shared unit/rear carriers that move a surface's binding frame remain refused
|
|
5609
|
+
by `RIG_TURN_SURFACE_MESH_BINDINGS`; a blended surface does not add a second
|
|
5610
|
+
carrier translation to compensate. Alternate drawings still need their own
|
|
5611
|
+
registered sampling frame (`RIG_TURN_SURFACE_MESH_ATTACHMENT`).
|
|
5612
|
+
|
|
5613
|
+
Authored weighted body meshes absent from both surface-role tables are unchanged
|
|
5614
|
+
and do not consume depth sheets. Measurement sheets are not packed
|
|
5575
5615
|
art. An authored `parts.json` depth reference remains an active standalone
|
|
5576
5616
|
`rig` declaration even without config opt-in: its file/size/color/opacity
|
|
5577
5617
|
guards still apply. With binding inactive there is no added reference, file or
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rig-parts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.72.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
|
@@ -101,7 +101,7 @@ import { bindDepthRun, copyDepthMaterial, registerDepthRun, transportPartDepth,
|
|
|
101
101
|
* Pure: no clock, no randomness, no file access. The CLI reads and writes.
|
|
102
102
|
*/
|
|
103
103
|
import { sourceLimbTarget, nearestTargetPart } from './limbownership.ts';
|
|
104
|
-
import { type ArmSplit, type BoneEntry, type CharacterConfig, type ControlSkeleton, controlSkeletonOf, type Cut, type EarlyConfig, type Extend, type Limb, type Patch, type PlanEntry, type Run, type SeeThrough } from './config.ts';
|
|
104
|
+
import { type ArmSplit, type BoneEntry, type CharacterConfig, type ConfigConstraint, type ControlSkeleton, controlSkeletonOf, type Cut, type EarlyConfig, type Extend, type Limb, type MeshSpec, type Patch, type PlanEntry, type RegionSpec, type Run, type SeeThrough, turnMovingPartPair, type TurnSpec } from './config.ts';
|
|
105
105
|
import { PartsError, type Problem, refuseIfAny } from './errors.ts';
|
|
106
106
|
import { CORE_ALPHA, figuresPhrase, implausibleRules, type Layer, type LayerFigures, layerFigures, type LayerSet, NEAR_WHITE_MIN, OPAQUE_ALPHA_ABOVE, ruleSummary } from './layers.ts';
|
|
107
107
|
import { padToSquare, squarePad } from './inputs.ts';
|
|
@@ -398,6 +398,8 @@ export interface AssembleInput {
|
|
|
398
398
|
limbUnderCover?: boolean;
|
|
399
399
|
/** Issue #637: `source` is the pre-fix test mutant that skips source-transparent cap ownership; stages use target. */
|
|
400
400
|
capOwnership?: 'target' | 'source';
|
|
401
|
+
/** Issue #791: pairs of parts a turn moves relative to each other, whose fringe and seam colour stay untouched. */
|
|
402
|
+
turnMovingPair?: ((a: string, b: string) => boolean) | null;
|
|
401
403
|
}
|
|
402
404
|
|
|
403
405
|
/**
|
|
@@ -2791,7 +2793,15 @@ function keepArtWhole(part: PlacedPart, cleared: Cleared[], holderAt: (q: number
|
|
|
2791
2793
|
* hold the pixel after it); and every pixel at alpha >= `CORE_ALPHA`, which
|
|
2792
2794
|
* is the seam override's.
|
|
2793
2795
|
*/
|
|
2794
|
-
export function pushBackFringe(
|
|
2796
|
+
export function pushBackFringe(
|
|
2797
|
+
parts: PlacedPart[],
|
|
2798
|
+
srcr: Raster,
|
|
2799
|
+
rule: SeamRule,
|
|
2800
|
+
silhouette: Mask | null,
|
|
2801
|
+
feathered: ReadonlyArray<Mask | null> | null = null,
|
|
2802
|
+
keep: ReadonlyArray<Mask | null> | null = null,
|
|
2803
|
+
turnMovingPair: ((a: string, b: string) => boolean) | null = null,
|
|
2804
|
+
): FringePushed[][] {
|
|
2795
2805
|
const { width: W } = srcr;
|
|
2796
2806
|
const { holder, cand } = seamCandidates(parts, srcr, rule, silhouette);
|
|
2797
2807
|
const at = (i: number, d: number): number => {
|
|
@@ -2810,6 +2820,7 @@ export function pushBackFringe(parts: PlacedPart[], srcr: Raster, rule: SeamRule
|
|
|
2810
2820
|
if (cand[d] === 0 || !shows(d)) continue;
|
|
2811
2821
|
for (let i = holder[d] + 1; i < parts.length; i++) {
|
|
2812
2822
|
if (feathered?.[i]?.data[d] === 1 || keep?.[i]?.data[d] === 1) continue;
|
|
2823
|
+
if (turnMovingPair !== null && turnMovingPair(parts[i].record.name, parts[holder[d]].record.name)) continue;
|
|
2813
2824
|
const s = at(i, d);
|
|
2814
2825
|
if (s < 0) continue;
|
|
2815
2826
|
const img = parts[i].image.data;
|
|
@@ -2820,7 +2831,8 @@ export function pushBackFringe(parts: PlacedPart[], srcr: Raster, rule: SeamRule
|
|
|
2820
2831
|
}
|
|
2821
2832
|
parts.forEach((part, i) => keepArtWhole(part, cleared[i], (q) => {
|
|
2822
2833
|
const d = (part.record.y + Math.floor(q / part.record.w)) * W + part.record.x + (q % part.record.w);
|
|
2823
|
-
|
|
2834
|
+
const h = holder[d];
|
|
2835
|
+
return h >= 0 && turnMovingPair !== null && turnMovingPair(part.record.name, parts[h].record.name) ? -1 : h;
|
|
2824
2836
|
}));
|
|
2825
2837
|
const counts: Array<Map<number, number>> = parts.map(() => new Map());
|
|
2826
2838
|
cleared.forEach((list, i) => {
|
|
@@ -2855,16 +2867,48 @@ export function pushBackFringe(parts: PlacedPart[], srcr: Raster, rule: SeamRule
|
|
|
2855
2867
|
* under a subset set's actual cover instead of recolouring it to the painting.
|
|
2856
2868
|
* (`assemble_parts.py` `main`, "5. seam override".)
|
|
2857
2869
|
*/
|
|
2858
|
-
export function seamOverride(
|
|
2870
|
+
export function seamOverride(
|
|
2871
|
+
parts: PlacedPart[],
|
|
2872
|
+
srcr: Raster,
|
|
2873
|
+
rule: SeamRule,
|
|
2874
|
+
silhouette: Mask | null,
|
|
2875
|
+
keep: ReadonlyArray<Mask | null> | null = null,
|
|
2876
|
+
turnMovingPair: ((a: string, b: string) => boolean) | null = null,
|
|
2877
|
+
): void {
|
|
2859
2878
|
const { width: W } = srcr;
|
|
2860
2879
|
const { top, cand } = seamCandidates(parts, srcr, rule, silhouette);
|
|
2880
|
+
const r = (CORE_KERNEL - 1) >> 1;
|
|
2861
2881
|
parts.forEach(({ record: p, image }, i) => {
|
|
2882
|
+
const movingPeers =
|
|
2883
|
+
turnMovingPair === null
|
|
2884
|
+
? []
|
|
2885
|
+
: parts.map((_, j) => j).filter((j) => j !== i && turnMovingPair(p.name, parts[j].record.name));
|
|
2862
2886
|
let n = 0;
|
|
2863
2887
|
for (let y = 0; y < p.h; y++) {
|
|
2864
2888
|
for (let x = 0; x < p.w; x++) {
|
|
2865
|
-
const
|
|
2889
|
+
const rx = p.x + x;
|
|
2890
|
+
const ry = p.y + y;
|
|
2891
|
+
const d = ry * W + rx;
|
|
2866
2892
|
const s = (y * p.w + x) * 4;
|
|
2867
2893
|
if (keep?.[i]?.data[d] === 1 || cand[d] === 0 || top[d] !== i || image.data[s + 3] < CORE_ALPHA) continue;
|
|
2894
|
+
if (
|
|
2895
|
+
movingPeers.some((j) => {
|
|
2896
|
+
const pj = parts[j].record;
|
|
2897
|
+
const imgJ = parts[j].image.data;
|
|
2898
|
+
const x0 = Math.max(pj.x, rx - r);
|
|
2899
|
+
const x1 = Math.min(pj.x + pj.w - 1, rx + r);
|
|
2900
|
+
const y0 = Math.max(pj.y, ry - r);
|
|
2901
|
+
const y1 = Math.min(pj.y + pj.h - 1, ry + r);
|
|
2902
|
+
for (let ny = y0; ny <= y1; ny++) {
|
|
2903
|
+
for (let nx = x0; nx <= x1; nx++) {
|
|
2904
|
+
if (imgJ[((ny - pj.y) * pj.w + (nx - pj.x)) * 4 + 3] > 0) return true;
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
return false;
|
|
2908
|
+
})
|
|
2909
|
+
) {
|
|
2910
|
+
continue;
|
|
2911
|
+
}
|
|
2868
2912
|
image.data[s] = srcr.data[d * 4];
|
|
2869
2913
|
image.data[s + 1] = srcr.data[d * 4 + 1];
|
|
2870
2914
|
image.data[s + 2] = srcr.data[d * 4 + 2];
|
|
@@ -4999,7 +5043,7 @@ export function assemble(input: AssembleInput): AssembleResult {
|
|
|
4999
5043
|
});
|
|
5000
5044
|
const featheredInOrder: Array<Mask | null> = order.map((d) => ('patch' in d ? null : (pieceAt(d).b.feathered ?? null)));
|
|
5001
5045
|
const keepInOrder = order.map((d) => ('limb' in d ? limbKeep[d.limb] : null));
|
|
5002
|
-
const pushedBy = pushBackFringe(stack, srcr, seamRule, seamRule === 'silhouette' ? silhouette : null, featheredInOrder, keepInOrder);
|
|
5046
|
+
const pushedBy = pushBackFringe(stack, srcr, seamRule, seamRule === 'silhouette' ? silhouette : null, featheredInOrder, keepInOrder, input.turnMovingPair ?? null);
|
|
5003
5047
|
// Issue #255: a part's drift refusals in a body, and who holds the body in the draw order (the push-back clears
|
|
5004
5048
|
// only fringe below CORE_ALPHA, and the seam override only recolours, so the holders read here are final).
|
|
5005
5049
|
const holderAt = new Int32Array(W * H).fill(-1);
|
|
@@ -5123,7 +5167,7 @@ export function assemble(input: AssembleInput): AssembleResult {
|
|
|
5123
5167
|
for (const p of placed) if (p.record.depth !== undefined && artFiles.has(p.record.depth.image)) refuseIfAny([{ code: 'DEPTH_SHEET_UNAMBIGUOUS', object: p.record.depth.image, detail: 'collides with a part artwork filename; choose noncolliding part names before sheet emission' }]);
|
|
5124
5168
|
|
|
5125
5169
|
|
|
5126
|
-
seamOverride(placed, srcr, seamRule, seamRule === 'silhouette' ? silhouette : null, keepInOrder);
|
|
5170
|
+
seamOverride(placed, srcr, seamRule, seamRule === 'silhouette' ? silhouette : null, keepInOrder, input.turnMovingPair ?? null);
|
|
5127
5171
|
const can = recomposite(placed, W, H);
|
|
5128
5172
|
// Issue #242: on a scene painting the figure is read off the full run, and every recomposite figure inside it.
|
|
5129
5173
|
const inside = input.scene === true ? sceneFigure([...rig.entries()].filter(([k]) => k.startsWith('full:')).map(([, r]) => r), W, H) : null;
|
|
@@ -5923,7 +5967,14 @@ function unplannedNotes(
|
|
|
5923
5967
|
* full-loader config, where it is optional.
|
|
5924
5968
|
*/
|
|
5925
5969
|
export function stageFields(
|
|
5926
|
-
cfg: Pick<CharacterConfig, 'seethrough' | 'assemble' | 'scene' | 'motion_seams'> & {
|
|
5970
|
+
cfg: Pick<CharacterConfig, 'seethrough' | 'assemble' | 'scene' | 'motion_seams'> & {
|
|
5971
|
+
limbs?: Record<string, Limb>;
|
|
5972
|
+
bones?: BoneEntry[];
|
|
5973
|
+
meshes?: Record<string, MeshSpec>;
|
|
5974
|
+
regions?: Record<string, RegionSpec>;
|
|
5975
|
+
constraints?: ConfigConstraint[];
|
|
5976
|
+
turn?: TurnSpec;
|
|
5977
|
+
},
|
|
5927
5978
|
single: { w: number; h: number } | null = null,
|
|
5928
5979
|
): {
|
|
5929
5980
|
resolution: number;
|
|
@@ -5941,6 +5992,7 @@ export function stageFields(
|
|
|
5941
5992
|
armSplit?: ArmSplit;
|
|
5942
5993
|
keySkeleton?: ControlSkeleton;
|
|
5943
5994
|
headFaceUnderfill?: boolean;
|
|
5995
|
+
turnMovingPair?: (a: string, b: string) => boolean;
|
|
5944
5996
|
} {
|
|
5945
5997
|
const problems: Problem[] = [];
|
|
5946
5998
|
if (cfg.seethrough === undefined) {
|
|
@@ -5952,6 +6004,7 @@ export function stageFields(
|
|
|
5952
6004
|
refuseIfAny(problems);
|
|
5953
6005
|
const st = cfg.seethrough as SeeThrough;
|
|
5954
6006
|
const keySkeleton = controlSkeletonOf(cfg);
|
|
6007
|
+
const turnMovingPair = turnMovingPartPair(cfg);
|
|
5955
6008
|
return {
|
|
5956
6009
|
resolution: st.resolution,
|
|
5957
6010
|
headBox: single !== null ? singleRunHeadBox(single.w, single.h, st.resolution) : (st.head_box as [number, number, number, number]),
|
|
@@ -5959,6 +6012,7 @@ export function stageFields(
|
|
|
5959
6012
|
...(st.arm_split === undefined ? {} : { armSplit: st.arm_split }),
|
|
5960
6013
|
...(keySkeleton === undefined ? {} : { keySkeleton }),
|
|
5961
6014
|
...(cfg.assemble.head_face_underfill === undefined ? {} : { headFaceUnderfill: cfg.assemble.head_face_underfill }),
|
|
6015
|
+
...(turnMovingPair === null ? {} : { turnMovingPair }),
|
|
5962
6016
|
rigScale: cfg.assemble.rig_scale,
|
|
5963
6017
|
plan: cfg.assemble.plan,
|
|
5964
6018
|
extend: cfg.assemble.extend_below_crop ?? [],
|
package/src/build.ts
CHANGED
|
@@ -659,6 +659,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
659
659
|
...(fields.scene === undefined ? {} : { scene: fields.scene }),
|
|
660
660
|
...(fields.armSplit !== undefined && altPlan.some((e) => e[1] === 'full' && (e[2] === 'handwear-r' || e[2] === 'handwear-l')) ? { armSplit: fields.armSplit } : {}),
|
|
661
661
|
...(fields.headFaceUnderfill === undefined ? {} : { headFaceUnderfill: fields.headFaceUnderfill }),
|
|
662
|
+
...(fields.turnMovingPair === undefined ? {} : { turnMovingPair: fields.turnMovingPair }),
|
|
662
663
|
seamRule: input.seam,
|
|
663
664
|
projectRule: input.project,
|
|
664
665
|
...(altExclude.length === 0 ? {} : { exclude: altExclude }),
|