@rig-c/parts 1.22.0 → 1.23.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 +3 -3
- package/cli.ts +4 -1
- package/docs/AUTHORING.md +38 -6
- package/docs/STABILITY.md +1 -1
- package/package.json +1 -1
- package/src/build.ts +12 -12
- package/src/check.ts +1 -1
- package/src/cloth.ts +15 -3
- package/src/config.ts +11 -1
- package/src/motion.ts +9 -8
- package/src/propose.ts +79 -5
- package/src/rig.ts +1 -1
package/README.md
CHANGED
|
@@ -107,7 +107,7 @@ page** (issue #2):
|
|
|
107
107
|
|
|
108
108
|
| path under `--out` | what |
|
|
109
109
|
| --- | --- |
|
|
110
|
-
| `check/build/skeleton.json`, `skeleton.atlas`, `skeleton.png` | **the artifact** — Spine 4.3 skeleton data and one packed page, written by `rigc build --pack --page-edges free --pack-shape polygon` and gated under `spine-html
|
|
110
|
+
| `check/build/skeleton.json`, `skeleton.atlas`, `skeleton.png` | **the artifact** — Spine 4.3 skeleton data and one packed page, written by `rigc build --pack --page-edges free --pack-shape polygon` and gated under `rig-play` (named `spine-html` before rig-c 2.50.0), which holds every rule `spine` measures (on reference-demo, rigc 2.1.3 and 2.10.1: the 14 rules `validate --profile spine` measures are among the build's 24; 16 are not in `spine`) |
|
|
111
111
|
| `parts/*.png`, `parts.json`, `recomposite_rig.png`, `recomposite_error_rig.png` | the loose parts, each cropped to its alpha box; the record of where every part came from, how many of its pixels were re-taken from the painting, and the recomposite's uncovered holes with their boxes; the flat stack of parts; its error map — red where no part covers a pixel the painting has, blue where a part covers it in the wrong colour |
|
|
112
112
|
| `rig/` | `rig.json` and `motion.json` in rig-c's spec, `mesh_report.json`, the padded `images/` |
|
|
113
113
|
| `check/` | both gate files verbatim, the idle's frames and their `geometry.json` (skinned vertices per frame), `contact.png`, `motion_heat.png`, `check.json` (with `pack_mode`, the `--page-edges` and `--pack-shape` the page was packed under) |
|
|
@@ -155,7 +155,7 @@ atlas written by anything else would have no oracle behind it.
|
|
|
155
155
|
| --- | --- | --- |
|
|
156
156
|
| 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 |
|
|
157
157
|
| 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 |
|
|
158
|
-
| 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 `
|
|
158
|
+
| 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` |
|
|
159
159
|
|
|
160
160
|
rig-parts never writes Spine data itself. Everything on disk under `check/build/`
|
|
161
161
|
was written by rig-c after its own gate passed.
|
|
@@ -305,7 +305,7 @@ agent skill.
|
|
|
305
305
|
| `propose … --from-config <config>` | draw and LINT the config's current bones (by the joints too, given `--keypoints`) |
|
|
306
306
|
| `compare --left <file> --right <file> [--map <bonemap.json>]` | compare two skeletons — a config, a proposal or a `rig.json` — bone by bone: origin, parent, tip, length and direction per pair, the bones neither side pairs, the required ones missing, and each side's roles read off the spec; no frame is guessed, and nothing pairs by resemblance (`propose --compare` reads origins only) |
|
|
307
307
|
| `rig --config --parts --out [--idle-keys ctl\|direct]` | author `rig.json` + `motion.json`, written only after rig-c's gate is green; each mesh is in the mode its config entry names — `grid` (the lattice, what `propose` writes), `contour` (the traced outline with declared interior points) or `auto` (the contour mesh at alpha 1 and above, reduced and locally refined by rig-c's `reduceMesh` under the author's declared bounds, written only when its motion against the unreduced source on the idle passes the author's `motion` bounds through rig-c's `compareMeshesInMotion`; [AUTHORING §3](docs/AUTHORING.md)); every chain link is turned along its chain and carries its `length`, so a physics constraint added later has a lever, with every offset under it in the turned frame so nothing moves; `--idle-keys` says whether the idle's keys on mesh-driving bones go through `<bone>_ctl` parents (default) or stay on the bones with `invariants.idleDrivesMeshes` declared; the config's `constraints` go to rigc as written, and a two-bone ik over keyed links needs `--idle-keys direct` (on `rig` or `build`) |
|
|
308
|
-
| `check --rig --out [--parts] [--source] [--requirements]` | build packed, gated under `
|
|
308
|
+
| `check --rig --out [--parts] [--source] [--requirements]` | build packed, gated under `rig-play`, render the idle, measure seam, loop and the six judgement lines (mesh texture stretch among them, from the idle's `render --geometry`), and report the recomposite's holes from `parts.json`; on a rig spec with no `parts.json` or no `idle` (a merged rig, issue #77) the gate still runs and every line that needs the missing input says SKIP by name; `--source <painting.png>` adds `SETUP_POSE_VS_SOURCE`, the setup pose against the painting by assemble's recomposite figures; `--requirements <scene.json>` measures what a scene declares of the motion — a contact, a follow fraction, an aim, a joint range, a mesh's stretch, the seam between two parts over the motion — each against the author's own bar, from rig-c's posed frames, one line each, PASS, FAIL or NOT MEASURABLE (AUTHORING §7, *Declared requirements*) |
|
|
309
309
|
| `loop --frames <dir> --out <file.gif \| file.png> [--palette]` | encode a rendered idle as a looping GIF, lossless APNG, or indexed APNG (`--palette`) |
|
|
310
310
|
| `build --config --source --full --head --out [--seam] [--project] [--loop] [--lead-in <periods>] [--requirements] [--seam-pairs] [--keep-stills] [--idle-keys ctl\|direct]` | assemble, rig and check in one process, stopping at the first refusal; `--requirements`, `--seam-pairs` and `--keep-stills` are forwarded to check, `--idle-keys` to rig; `--lead-in` (with `--loop`) encodes the loop from the last of n + 1 idle periods played back to back, for a rig whose physics does not end where the render starts it |
|
|
311
311
|
| `compose --scene <scene.json> --out [--requirements] [--accept]` | bind several characters' green builds into one rig (or, under `--accept`, builds failing only the bars named — for looking, not shipping): every name prefixed `<id>:` under one shared root, each character's offset added at its first-level bones, an optional background plate (its provenance recorded, judged by nothing) drawn first, and the draw order between the characters' slots as the scene file declares it — nothing inferred, nothing scaled; gated through rig-c as `rig` is, then checked ([AUTHORING §7](docs/AUTHORING.md), *Composing several characters*) |
|
package/cli.ts
CHANGED
|
@@ -209,7 +209,10 @@ usage:
|
|
|
209
209
|
of the consumer's environment — no direction is drafted), and drafts no
|
|
210
210
|
idle key on them. A bottomwear recipe's "swing" drives each tree's
|
|
211
211
|
first link from one shared pendulum. A recipe that drafts nothing is
|
|
212
|
-
refused (PROPOSE_CLOTH_DRAFTED).
|
|
212
|
+
refused (PROPOSE_CLOTH_DRAFTED). A topwear part shaped like a skirt (a
|
|
213
|
+
dress) is named in a note, never drafted on its shape; a bottomwear
|
|
214
|
+
recipe's "part" declares it, and its trees hang from the hip over the
|
|
215
|
+
part's art below it (PROPOSE_CLOTH_PART). Without --cloth nothing changes.
|
|
213
216
|
|
|
214
217
|
rig-parts propose --parts <dir> --source <painting.png> --out <dir> --from-config <config.json>
|
|
215
218
|
Draw the config's CURRENT bones instead (<out>/render/landmarks_config.png
|
package/docs/AUTHORING.md
CHANGED
|
@@ -29,6 +29,12 @@ kept as fixtures because their `expected/` is that implementation's own output;
|
|
|
29
29
|
figure this guide quotes for them was measured on them. `demo` is the painting the
|
|
30
30
|
README shows since issue #227 and `scarf` the hanging-element example; both have
|
|
31
31
|
`expected/` from this port's own build, and a figure quoted for them says so.
|
|
32
|
+
In every example, `expected/rig.json` is the flat form: every bone unturned, which is
|
|
33
|
+
`flattenRig` (`src/rig.ts`) of the built rig. A build's `rig/rig.json` carries
|
|
34
|
+
`rotation` and `length` on its chain links, and the offsets under them in the turned
|
|
35
|
+
frame (§5, the `rig` row), where that file holds unturned offsets only, so the two
|
|
36
|
+
differ as text and not as a rig: the chain suite (`CH03`) compares `expected/rig.json`
|
|
37
|
+
with `flattenRig(built)`, not with the built file.
|
|
32
38
|
|
|
33
39
|
## 1. Prerequisites
|
|
34
40
|
|
|
@@ -117,7 +123,7 @@ read by no CPU stage).
|
|
|
117
123
|
| `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 |
|
|
118
124
|
| `turn` | rig (adds the turn control) | **proposed** only with `propose --full`/`--head` (issue #251), then corrected: `{pivot, depths}`. `depths` holds, per part, the See-through layer's `depth_median` the part came from (larger = further back), read from the run the part was assembled from; a `painting:` patch has none and is not carried. A rider (issue #271) — a part from an `eyewhite`, `irides`, `eyelash`, `eyebrow`, `nose` or `mouth` layer — is drafted at the `face` part's depth, 0.001 nearer when parts.json draws it after the face and 0.001 further when before: See-through makes no depth of its own for the eye group (it cuts them from one depth map of the combined eyes) and clamps nose and mouth to the face's median − 0.001, and the two runs' own medians for these layers disagreed by up to 0.47 and swapped their order against the face. Every other layer — ears, headwear and earwear included — keeps its own median. With no `face` part, or more than one, the riders keep their own and a note says so. One note lists each part's depth and where it came from; a carrier the other run places more than 10 % of `pivot − nearest` away gets a note naming both values and the run read — the two runs are not reconciled. `pivot` is the depth that stays put; `propose` drafts the mean of the parts' depths weighted by `opaque_px`, the one depth at which the painted pixels' centroid does not slide under the dial. The rig stage adds a bone `turn` under `root` at its origin that nothing keys — its local x is the dial, in rig px — and carries each part by `(pivot − depth) / (pivot − nearest depth)` of it: the nearest part all of it, a part behind the pivot the other way, a part at the pivot not at all. Each part rides leaf twins (`turn_<part>_<bone>`, an identity child of every bone its slot and weights bind) moved by one `transform` constraint (`turn_<part>`, after the config's own); the idle's keys, the `<bone>_ctl` controls and a physics constraint stay on the bones, and the dial moves none of them. 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 field has a default (`CONFIG_FIELD_PRESENT`); the pivot must lie behind the nearest part (`CONFIG_TURN_PIVOT_BEHIND_NEAREST`). Absent, no control is added and no byte of any output moves |
|
|
119
125
|
| `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 |
|
|
120
|
-
| `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?}`. `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`). The two defaults are the recipe's own, measured on its synthetic fixture (the recipe below). The recipe below says what each field drafts |
|
|
126
|
+
| `cloth` | `propose --cloth` only; no other stage reads it, so it moves no byte of any build | **authored**, optional (issue #364): one recipe per tag, `{"bottomwear": {…}, "back hair": {…}, "front hair": {…}}`, each `{chains, links, wind, gravity, split?, length_ratio?, strength?, damping?, alternate_damping?, translate?, swing?, part?}`. `chains` — trees across the piece (for `back hair`, per side of the eye axis), a whole number, 1 or more; `links` — links from root to tip on every path, 1 or more; `split` — `{at, into}`: the first `at` links are the trunk, which forks into `into` (2 or more) branches; `at` below `links` (`CONFIG_CLOTH_SPLIT_BEFORE_TIP`); `length_ratio` — a path's last link over its first, above 0, default 0.5; `strength` — `{trunk, branch, edge}`, each above 0 and below the spring's stability bound (`CONFIG_CLOTH_SPRING_STABLE`), default 100 / 100 / 50; `damping` — in [0, 1], absent: rig-c's default; `alternate_damping` — the odd trees' damping, in [0, 1], beside `damping` and different from it (`CONFIG_CLOTH_ALTERNATE_DIFFERS`); `wind`, `gravity` — `[root, tip]`, each 0 or more, tip at or above root (`CONFIG_CLOTH_RESPONSE_GROWS_TO_TIP`); `translate` — the x and y mix of a dangling end's flutter, above 0 and at most 1; `swing` — `bottomwear` only, `{scales}`, one positive scale per tree (`CONFIG_CLOTH_SWING_SCALE_PER_TREE`); `part` — `bottomwear` only (`CONFIG_CLOTH_PART_ON_BOTTOMWEAR`), a non-empty part name: the `topwear` part that holds a skirt See-through returned inside it (a dress), which takes the skirt's trees as well (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 |
|
|
121
127
|
|
|
122
128
|
**A scene target is an ordinary bone.** A target the scene places — a point a hand
|
|
123
129
|
reaches for, a face something turns toward — is a single bone parented to `root`,
|
|
@@ -1583,6 +1589,7 @@ What each rule drafts (`src/cloth.ts` holds them):
|
|
|
1583
1589
|
| response | link j of an n-link path takes `wind` and `gravity` at j/(n − 1) of the way from the root value to the tip value; a single-link path takes the tip value. Each is a scalar **multiplier** of the environment the consumer sets (spine-core's skeleton `windX, windY`, `gravityX, gravityY`; rig-c 2.52.0's live track `setEnvironment`, rig-play 1.10.0's `environment()`): no direction is drafted | `wind`, `gravity` |
|
|
1584
1590
|
| out of phase | the odd trees take `alternate_damping`, the even ones `damping` | `damping`, `alternate_damping` |
|
|
1585
1591
|
| flutter | the last link of every path gets a second physics constraint, `<bone>_translate`, moving x and y by `translate`, with the link's stiffness and damping and **no** wind or gravity response. spine-core scales a translate spring's response by the skeleton's reference scale (100) and a rotation's by the link's length over it, so one response on both pushes an end about 100/length times further than it turns it (the table below) | `translate` |
|
|
1592
|
+
| part | `bottomwear` only (issue #402): the named `topwear` part takes the skirt's rule as the `bottomwear` parts do — trees from `hip` over its art below the hip, its waist line, and, as its art reaches above the chest, the chest segment the long-robe `bottomwear` keeps — in place of the two robe chains the topwear rule drafts; the prefix is `skirt` when it is the only skirt, `skirt_<part>` beside another | `part` |
|
|
1586
1593
|
| swing | `bottomwear` only: a bone `<prefix>_swing` under `hip` at the centre of the root row, one link long, straight down, with physics (the trunk's stiffness, the root's response); each tree's first link takes the swing's rotation times its scale — a transform `<swing>_<k>`, local source and target, additive, the swing's setup rotation in hip's frame (−90: hip is drafted unturned) subtracted — and no physics of its own | `swing.scales` |
|
|
1587
1594
|
|
|
1588
1595
|
Every link but a swing-driven first link gets `<bone>_physics` (`rotate` 1), and no
|
|
@@ -1590,6 +1597,29 @@ idle key: the drafted idle keys none of the trees. A recipe that drafts nothing
|
|
|
1590
1597
|
its tag on no part, or `back hair` that ends above the shoulders (a bun) — is refused,
|
|
1591
1598
|
`PROPOSE_CLOTH_DRAFTED`.
|
|
1592
1599
|
|
|
1600
|
+
**A skirt inside topwear (issue #402).** The recipe finds a skirt by the `bottomwear`
|
|
1601
|
+
tag alone. When See-through returns the skirt inside `topwear` (a dress), nothing is
|
|
1602
|
+
tagged `bottomwear`, and the proposer does not pick the dress by its shape: with
|
|
1603
|
+
`--cloth`, a `topwear` part whose box reaches 0.25 face heights below the hip (the
|
|
1604
|
+
topwear rule's own waist line) and whose art is wider across its last 24 rows than in
|
|
1605
|
+
the 24-row band at the hip is **named in a note** — the part, its art's rows below the
|
|
1606
|
+
hip, and the field — and in `PROPOSE_CLOTH_DRAFTED`'s line when a `bottomwear` recipe
|
|
1607
|
+
found no part. The author declares it, `"bottomwear": { …, "part": "<name>" }`, instead
|
|
1608
|
+
of moving the layer. Why a name and not a draft, measured on the public examples' builds
|
|
1609
|
+
(this port's assemble, the proposer's hip): `scarf`'s `topwear`, an outer robe over a
|
|
1610
|
+
separate `bottomwear` skirt, passes the same shape (rows 658 to 890 below the hip at y
|
|
1611
|
+
657; 287 px across its last rows against 271 at the hip), so a draft by shape would hang
|
|
1612
|
+
a second set of skirt trees on a robe; `wind`'s `topwear`, a blouse whose sleeves reach
|
|
1613
|
+
the hip band, does not (350 px against 493). Without `--cloth` nothing is named, so every
|
|
1614
|
+
example's proposal is the one it was. What a declared dress drafts, measured on the
|
|
1615
|
+
selftest's dress fixture (`fixtures/cloth.ts`, flat colour; RG480 prints the figures):
|
|
1616
|
+
one lattice on chest, hip and the trees, built green through the gate with no split of
|
|
1617
|
+
the mesh; the bodice is not held wholly to the chest — a vertex above the hip carries up
|
|
1618
|
+
to 0.258 of its weight on the trees; and `check`'s `BREATH_VISIBLE`, which reads every
|
|
1619
|
+
`topwear` part as the torso, read the dress's idle heat at 1.592 against the floor
|
|
1620
|
+
3.809, where the same dress with the robe chains read 3.9 — the half on the trees has
|
|
1621
|
+
no idle key. Neither is barred here; both are the dress's to weigh before declaring it.
|
|
1622
|
+
|
|
1593
1623
|
**Every spring is stable at its step (A23's inequality).** Per step spine-core does
|
|
1594
1624
|
`v += −strength·x·step·massInverse`, `x += v·step`, `v *= d` with d = damping^(60·step);
|
|
1595
1625
|
in (x, v·step) that is the matrix [[1 − k, 1], [−d·k, d]] with
|
|
@@ -2239,8 +2269,8 @@ reference's so the examples stay comparable with it. `build` takes both flags.
|
|
|
2239
2269
|
**`rig --idle-keys ctl|direct`** (and `build --idle-keys`, which forwards the
|
|
2240
2270
|
value to its rig stage; without the flag, or with `ctl`, a build writes and prints
|
|
2241
2271
|
what it did before `build` took the flag). rig-c's `A15_IDLE_NO_MESH_BONE_KEYS`
|
|
2242
|
-
(profile `spine-html`) refuses an idle that
|
|
2243
|
-
(the default, the reference's answer) gives every such bone a same-origin
|
|
2272
|
+
(profile `rig-play`, named `spine-html` before rig-c 2.50.0) refuses an idle that
|
|
2273
|
+
keys a bone a mesh is weighted to. `ctl` (the default, the reference's answer) gives every such bone a same-origin
|
|
2244
2274
|
`<bone>_ctl` parent and moves its keys there, which passes A15 on any rig-c;
|
|
2245
2275
|
the stage prints `idle keys ctl: N mesh-driving bone(s) keyed …`. `direct` keys the
|
|
2246
2276
|
bones themselves and writes `invariants.idleDrivesMeshes: { "why": … }` into
|
|
@@ -2543,6 +2573,7 @@ See-through with another seed.
|
|
|
2543
2573
|
| <a id="CONFIG_CLOTH_RESPONSE_GROWS_TO_TIP"></a>`CONFIG_CLOTH_RESPONSE_GROWS_TO_TIP` | a `cloth` recipe's `wind` or `gravity` is `[root, tip]` with tip below root: the response grows from the root to the tip, where the motion accumulates down the chain | that pair |
|
|
2544
2574
|
| <a id="CONFIG_CLOTH_ALTERNATE_DIFFERS"></a>`CONFIG_CLOTH_ALTERNATE_DIFFERS` | a `cloth` recipe's `alternate_damping` without `damping`, or equal to it: neighbouring trees are declared out of phase, and an alternate that alternates nothing declares nothing | `damping` beside it, a different value, or leave `alternate_damping` out |
|
|
2545
2575
|
| <a id="CONFIG_CLOTH_SWING_SCALE_PER_TREE"></a>`CONFIG_CLOTH_SWING_SCALE_PER_TREE` | `swing` on a tag other than `bottomwear`, or `swing.scales` not one scale per tree (`chains`) | one scale per tree, in tree order across the skirt |
|
|
2576
|
+
| <a id="CONFIG_CLOTH_PART_ON_BOTTOMWEAR"></a>`CONFIG_CLOTH_PART_ON_BOTTOMWEAR` | `part` on a `cloth` recipe for a tag other than `bottomwear` (issue #402) | leave it out there; `part` hands the skirt's recipe to a `topwear` part that holds a skirt (a dress) |
|
|
2546
2577
|
| <a id="CONFIG_CLOTH_SPRING_STABLE"></a>`CONFIG_CLOTH_SPRING_STABLE` | a `cloth` recipe's strength — declared, or the default 100 / 100 / 50 — whose spring is unstable at a damping the recipe runs at (`damping`, `alternate_damping`, or rig-c's 0.85 when `damping` is left out): k = strength·massInverse·step² at or past 2(1 + damping^(60·step)), step 1/60 and mass 1 (rig-c's defaults; the recipe sets neither). The detail gives k and the bound | a lower strength, or a higher damping |
|
|
2547
2578
|
| <a id="CONFIG_TURN_BONE_FREE"></a>`CONFIG_TURN_BONE_FREE` | the config has `turn` and `bones` declares a bone named `turn`, the control the rig stage adds | rename that bone |
|
|
2548
2579
|
|
|
@@ -2624,7 +2655,8 @@ says why each requirement exists and what breaks without it.
|
|
|
2624
2655
|
| <a id="PROPOSE_FACE_PRESENT"></a>`PROPOSE_FACE_PRESENT` | no part comes from a `face` layer, and the face-less fallback cannot derive a face box either: it needs the head run's `neck` and at least one head-run `front hair`/`back hair` part whose top is above the neck's, and the message names the half that is missing. With both, `propose` does not refuse — it derives the box and says so in its first note (§5) | `assemble.plan`: take the face, or the head run's hair and neck |
|
|
2625
2656
|
| <a id="PROPOSE_CUT_FROM_RECORDED"></a>`PROPOSE_CUT_FROM_RECORDED` | two parts share one layer and none of them records `cut_from`: a `parts.json` an `assemble` before 1.6.0 wrote with `assemble.cuts`. The records are in draw order, so which is the plan part and which the piece cannot be read off the file; the message names the parts and the layer. Every other reader still takes the file | `--parts`: re-run assemble (1.6.0+) to record `cut_from` |
|
|
2626
2657
|
| <a id="PROPOSE_LIMB_PARTS"></a>`PROPOSE_LIMB_PARTS` | `parts.json` holds parts `config.limbs` cut at their joints (issue #349); the limbs are drafted from the parts before the cut, which the rules read by layer | `--parts` a build assembled with the config's `limbs` left out; keep the block the config holds (its caps and ranges are the author's). `propose --from-config` reads the config's bones on either build |
|
|
2627
|
-
| <a id="PROPOSE_CLOTH_DRAFTED"></a>`PROPOSE_CLOTH_DRAFTED` | with `--cloth` (issue #364): the config's `cloth` block holds a recipe for a tag the proposer drafts no chain on — no part has that tag, or every `back hair` part ends above the shoulders (a bun bone, no chain) | leave that recipe out, or assemble the layer it is for |
|
|
2658
|
+
| <a id="PROPOSE_CLOTH_DRAFTED"></a>`PROPOSE_CLOTH_DRAFTED` | with `--cloth` (issue #364): the config's `cloth` block holds a recipe for a tag the proposer drafts no chain on — no part has that tag, or every `back hair` part ends above the shoulders (a bun bone, no chain). A `bottomwear` recipe with no `bottomwear` part names every `topwear` part shaped like a skirt (issue #402) | leave that recipe out, or assemble the layer it is for, or declare the named part in `cloth.bottomwear.part` |
|
|
2659
|
+
| <a id="PROPOSE_CLOTH_PART"></a>`PROPOSE_CLOTH_PART` | with `--cloth` (issue #402): `cloth.bottomwear.part` names no part, a part that is not `topwear` (a `bottomwear` part takes the recipe by its tag already), a cut piece (`cut_from`), or a `topwear` whose box ends above the hip + 0.25 face heights, the topwear rule's waist line | name the `topwear` part that holds the skirt, or leave `part` out |
|
|
2628
2660
|
| <a id="PROPOSE_ACCESSORY_BODY"></a>`PROPOSE_ACCESSORY_BODY` | an accessory has nothing above its pendant rows to hang its bone on | that part's plan entry, or author its bones by hand |
|
|
2629
2661
|
| <a id="PROPOSE_TURN_RUN_GIVEN"></a><a id="PROPOSE_TURN_LAYER_PRESENT"></a><a id="PROPOSE_TURN_DEPTH_PRESENT"></a>`PROPOSE_TURN_RUN_GIVEN`, `PROPOSE_TURN_LAYER_PRESENT`, `PROPOSE_TURN_DEPTH_PRESENT` | with `--full`/`--head` (issue #251): a part came from a run whose layers were not given, the run given holds no layer of the part's tag, or its layer carries no `depth_median` while another part's layer carries one; a run with no depth on any part's layer (a PSD, or an export of one) is not refused — the turn is skipped, and the note says `turn: SKIP` and names the run (issue #359) | give the run the parts were assembled from, as the wrapper's `layers.json` |
|
|
2630
2662
|
| <a id="BASIS_RECORDS_EVERY_BONE"></a><a id="BASIS_NAMES_RESOLVE"></a><a id="BASIS_KIND_KNOWN"></a><a id="BASIS_KIND_HOLDS"></a>`BASIS_RECORDS_EVERY_BONE`, `BASIS_NAMES_RESOLVE`, `BASIS_KIND_KNOWN`, `BASIS_KIND_HOLDS` | `propose --keypoints`'s record of how it placed each bone, `basis.json`, does not hold to the proposal it was written with: a proposed bone with no record, one recorded twice or out of the proposal's order; a part, bone or frame quantity it names that is not there; a placement kind outside the known ones; or a placement that does not hold what its kind says (a joint placement with no joint, a non-joint one with a joint, a derived one with no bone, a constant that is not finite). Nothing is written | a proposer bug, not an input problem: report it with the line |
|
|
@@ -2800,8 +2832,8 @@ implementation's bars) — each one that measured; a rig with no `parts.json` or
|
|
|
2800
2832
|
assemble*, at the end of this section):
|
|
2801
2833
|
|
|
2802
2834
|
- `gate_spine-html.txt`: every summary line `(N passed, 0 failed)` — the packed build
|
|
2803
|
-
under the `
|
|
2804
|
-
pages on disk. There is no `spine` gate of its own: `
|
|
2835
|
+
under the `rig-play` profile, gated once over the compile and once over the packed
|
|
2836
|
+
pages on disk. There is no `spine` gate of its own: `rig-play` holds every rule
|
|
2805
2837
|
`spine` measures (on reference-demo, rigc 1.5.1 and 2.0.3: `validate --profile spine`'s 14
|
|
2806
2838
|
measured rules are all among the build's 23, the 15 others not in `spine`; rigc
|
|
2807
2839
|
2.1.3 and 2.10.1: the same 14 among the build's 24, which adds
|
package/docs/STABILITY.md
CHANGED
|
@@ -147,7 +147,7 @@ part name, `[i]` an entry of a list):
|
|
|
147
147
|
- **meshes.<part>.auto.regions[i]** — required: `name`, `shape`, `maxEdgeLength`, `transition`, `grade`, `minArtSamples`, and `cx`, `cy`, `r` for a circle or `points` for a polygon; optional: `bone`, `band` (both or neither; with neither the region is density only)
|
|
148
148
|
- **meshes.<part>.auto.boundaryRuns** — required: `maxVertices`
|
|
149
149
|
- **meshes.<part>.auto.stimulus**, or each entry of it when a list — required: `chain`, `degrees`
|
|
150
|
-
- **cloth.<tag>**, the tag bottomwear, back hair or front hair (issue #364; read by propose --cloth only) — required: `chains`, `links`, `wind`, `gravity`; optional: `split`, `length_ratio`, `strength`, `damping`, `alternate_damping`, `translate`, `swing` (on bottomwear only)
|
|
150
|
+
- **cloth.<tag>**, the tag bottomwear, back hair or front hair (issue #364; read by propose --cloth only) — required: `chains`, `links`, `wind`, `gravity`; optional: `split`, `length_ratio`, `strength`, `damping`, `alternate_damping`, `translate`, `swing` (on bottomwear only), `part` (on bottomwear only)
|
|
151
151
|
- **cloth.<tag>.split** — required: `at`, `into`
|
|
152
152
|
- **cloth.<tag>.strength** — required: `trunk`, `branch`, `edge`
|
|
153
153
|
- **cloth.<tag>.swing** — required: `scales`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rig-c/parts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.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/build.ts
CHANGED
|
@@ -357,13 +357,13 @@ function gateRun(label: string, rigc: RigcRunner, args: string[]): GateRun {
|
|
|
357
357
|
|
|
358
358
|
/**
|
|
359
359
|
* The motion gate's reference build (issue #135): rigc's `build` under the
|
|
360
|
-
*
|
|
361
|
-
* the
|
|
362
|
-
*
|
|
363
|
-
* atlas puts each region (its
|
|
364
|
-
* allowlists as atlas layout; the pages a
|
|
365
|
-
* written anywhere, so packing them was work
|
|
366
|
-
* of rigc by either build.
|
|
360
|
+
* `rig-play` profile (named `spine-html` before rig-c 2.50.0) and nothing
|
|
361
|
+
* else — the same gate over the compile that the candidate's build runs,
|
|
362
|
+
* without `--pack`. Its model document is all the comparison reads, and it
|
|
363
|
+
* differs from a packed build's only in where the atlas puts each region (its
|
|
364
|
+
* `pages`), which rig-c's comparison allowlists as atlas layout; the pages a
|
|
365
|
+
* reference would pack are never written anywhere, so packing them was work
|
|
366
|
+
* nobody read. No render is asked of rigc by either build.
|
|
367
367
|
*/
|
|
368
368
|
export const REFERENCE_BUILD_ARGS: readonly string[] = ['--profile', GATE_PROFILE];
|
|
369
369
|
|
|
@@ -372,9 +372,9 @@ export const REFERENCE_BUILD_LABEL = `build ${REFERENCE_BUILD_ARGS.join(' ')}`;
|
|
|
372
372
|
|
|
373
373
|
/**
|
|
374
374
|
* rig-c's gate over the rig in a scratch directory: `build` under the
|
|
375
|
-
*
|
|
375
|
+
* rig-play profile with `--pack --page-edges <edges> --pack-shape <shape>`, which runs the gate
|
|
376
376
|
* once over the compile and once over the packed pages on disk. There is no
|
|
377
|
-
* second `validate --profile spine` run:
|
|
377
|
+
* second `validate --profile spine` run: rig-play holds every rule spine
|
|
378
378
|
* measures (selftest `CH09`). The files are staged exactly as `--out` will
|
|
379
379
|
* receive them, so what passed is what is written. The scratch directory is
|
|
380
380
|
* the caller's, and is emptied here before and after. `images` are the PNG
|
|
@@ -506,7 +506,7 @@ function modelAt(buildDir: string): string | null {
|
|
|
506
506
|
* The motion gate of every automatic part (issue #126, item 3): for each, the
|
|
507
507
|
* reference rig — `rig` with that part's attachment swapped for its unreduced
|
|
508
508
|
* source and nothing else — through rigc's gate ({@link REFERENCE_BUILD_ARGS}:
|
|
509
|
-
* the stage's `build` under
|
|
509
|
+
* the stage's `build` under rig-play, without packing, issue #135), then
|
|
510
510
|
* rig-c's comparison of its `skeleton.model.json` with the candidate's
|
|
511
511
|
* (`candidateModel`, the stage's own gate build). A part refused before
|
|
512
512
|
* compiling (no `motion`, no stimulus) costs no build.
|
|
@@ -1170,7 +1170,7 @@ export function checkStage(input: CheckStageInput, rigc: RigcRunner, bin: string
|
|
|
1170
1170
|
log(` ${rigcIdentity(bin, v)}${entryLine === undefined ? '' : `; ${entryLine}`}`);
|
|
1171
1171
|
const mode: PackMode = { pageEdges: input.pageEdges ?? DEFAULT_PAGE_EDGES, packShape: input.packShape ?? DEFAULT_PACK_SHAPE };
|
|
1172
1172
|
const r = runCheck(input.rig, input.out, rigc, input.parts, mode, input.source, input.requirements, input.seamPairs === true, input.keepStills === true);
|
|
1173
|
-
log(` gate
|
|
1173
|
+
log(` gate rig-play (rigc ${packedBuildLabel(mode)}), verbatim:`);
|
|
1174
1174
|
for (const l of r.gateHtml) log(l);
|
|
1175
1175
|
for (const l of packLines(r)) log(` ${l}`);
|
|
1176
1176
|
const fig = r.figures;
|
|
@@ -1206,7 +1206,7 @@ export function checkStage(input: CheckStageInput, rigc: RigcRunner, bin: string
|
|
|
1206
1206
|
for (const [name, line] of Object.entries(r.requirements.lines)) log(` ${requirementText(name, line)}`);
|
|
1207
1207
|
log(` ${summaryText(r.requirements.summary)}`);
|
|
1208
1208
|
}
|
|
1209
|
-
log(` gate:
|
|
1209
|
+
log(` gate: rig-play ${fig.gate_spine_html_green ? 'green' : 'RED'} (${fig.rigc_entry.entry}${fig.rigc_entry.spine_core === null ? ', rigc\'s own validator' : `, the spine-core ${fig.rigc_entry.spine_core} round trip`})`);
|
|
1210
1210
|
log(` wrote ${r.written.map((w) => join(input.out, w)).join(', ')}, ${join(input.out, 'build')}/${r.idle === null ? '' : `, ${join(input.out, 'idle_frames')}/`}${r.requirements === null ? '' : `, ${join(input.out, REQUIREMENTS_DIR)}/`}${fig.seam_pairs === undefined ? '' : `, ${join(input.out, SEAM_DIR)}/`}${existsSync(join(input.out, STILL_DIR)) ? `, ${join(input.out, STILL_DIR)}/` : ''}`);
|
|
1211
1211
|
for (const p of r.problems) log(failLine(p));
|
|
1212
1212
|
const reqNotPass = r.requirements === null ? 0 : r.requirements.summary.declared - r.requirements.summary.pass;
|
package/src/check.ts
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
* | output | what |
|
|
32
32
|
* | --- | --- |
|
|
33
33
|
* | `build/` | `rigc build --profile rig-play --pack --page-edges free --pack-shape polygon` (or `pot`, `rect`, when the caller names them; {@link PAGE_EDGES}, {@link PACK_SHAPES}) — the packed atlas is the final artifact |
|
|
34
|
-
* | `gate_spine-html.txt` | that build's gate lines, verbatim — the one gate: rigc's `build` runs it once over the compile and once over the packed pages on disk, and `
|
|
34
|
+
* | `gate_spine-html.txt` | that build's gate lines, verbatim — the one gate: rigc's `build` runs it once over the compile and once over the packed pages on disk, and `rig-play` holds every rule `spine` measures (selftest `CH09`) |
|
|
35
35
|
* | `idle_frames/` | `rigc render --animation idle --fps 12 --max 640 --geometry`: `frames.json` + `idle/f*.png` + `idle/geometry.json` (each mesh's skinned vertices, which `TEXTURE_STRETCH` reads, every attachment's posed triangles, which `TIP_OVER_ROOT` and both halves of `STILL_REGIONS_DARK` read since issues #118 and #123, and every bone's world transform, which the face half reads its head bone from) |
|
|
36
36
|
* | `contact.png` | rigc's own contact sheet of that render, copied out |
|
|
37
37
|
* | `motion_heat.png` | frame 0 in grey with each pixel's largest change across the idle in red |
|
package/src/cloth.ts
CHANGED
|
@@ -42,6 +42,12 @@
|
|
|
42
42
|
* - **Translate.** `translate`, when declared, is the `x` and `y` mix of a
|
|
43
43
|
* second physics constraint on the last link of every path, beside its
|
|
44
44
|
* rotation, with no wind or gravity response ({@link physics} says why).
|
|
45
|
+
* - **Part** (`bottomwear` only, issue #402). `part` names a `topwear` part
|
|
46
|
+
* that takes the skirt's recipe as well: a skirt See-through returned inside
|
|
47
|
+
* `topwear` (a dress). Its trees hang from the hip over its art below the
|
|
48
|
+
* hip, by the skirt's own rule, in place of the robe chains the topwear rule
|
|
49
|
+
* drafts; its art above the hip stays on the chest. The proposer never picks
|
|
50
|
+
* such a part by itself: it names a candidate, and the author declares it.
|
|
45
51
|
* - **Swing** (`bottomwear` only). `swing.scales` declares one shared pendulum:
|
|
46
52
|
* a bone `<prefix>swing` under the attachment at the centre of the root row,
|
|
47
53
|
* one link long, with physics; each tree's first link takes the swing's
|
|
@@ -84,6 +90,8 @@ export interface ClothRecipe {
|
|
|
84
90
|
gravity: [number, number];
|
|
85
91
|
translate?: number;
|
|
86
92
|
swing?: { scales: number[] };
|
|
93
|
+
/** `bottomwear` only (issue #402): a `topwear` part the skirt's trees are drafted on as well — a dress. */
|
|
94
|
+
part?: string;
|
|
87
95
|
}
|
|
88
96
|
|
|
89
97
|
export type ClothRecipes = Partial<Record<ClothTarget, ClothRecipe>>;
|
|
@@ -364,14 +372,18 @@ export function chainConstraints(chain: string, links: number, tree: number, edg
|
|
|
364
372
|
return out;
|
|
365
373
|
}
|
|
366
374
|
|
|
367
|
-
/**
|
|
368
|
-
|
|
375
|
+
/**
|
|
376
|
+
* The one note a piece drafted by the recipe gets. `via` is the part's own
|
|
377
|
+
* `from` when the recipe reached it by `part` rather than by its tag
|
|
378
|
+
* (issue #402); absent, the note is the one written before the field existed.
|
|
379
|
+
*/
|
|
380
|
+
export function clothNote(part: string, tag: ClothTarget, trees: readonly TreeChain[], r: ClothRecipe, constraints: number, extra: string, via?: string): string {
|
|
369
381
|
const defaults: string[] = [];
|
|
370
382
|
if (r.length_ratio === undefined) defaults.push(`length_ratio ${RECIPE_LENGTH_RATIO}`);
|
|
371
383
|
if (r.strength === undefined) defaults.push(`strength ${RECIPE_STRENGTH.trunk}/${RECIPE_STRENGTH.branch}/${RECIPE_STRENGTH.edge}`);
|
|
372
384
|
const shape = r.split === undefined ? `${r.links} link(s) each` : `a ${r.split.at}-link trunk forking into ${r.split.into} branches, ${r.links} links root to tip`;
|
|
373
385
|
return (
|
|
374
|
-
`${part} (${tag}): config.cloth."${tag}" -> ${r.chains} tree(s)${extra}, ${shape} (${trees.map((t) => t.chain).join(', ')}); ` +
|
|
386
|
+
`${part} (${via === undefined ? tag : `${via}, which config.cloth."${tag}".part names`}): config.cloth."${tag}" -> ${r.chains} tree(s)${extra}, ${shape} (${trees.map((t) => t.chain).join(', ')}); ` +
|
|
375
387
|
`${constraints} constraint(s), physics on every link, wind ${r.wind[0]} -> ${r.wind[1]} and gravity ${r.gravity[0]} -> ${r.gravity[1]} root to tip (multipliers of the consumer's environment; no direction is drafted), no idle key` +
|
|
376
388
|
(defaults.length === 0 ? '' : `; the recipe's own defaults, measured on its synthetic fixture (AUTHORING §3): ${defaults.join(', ')}`)
|
|
377
389
|
);
|
package/src/config.ts
CHANGED
|
@@ -2663,6 +2663,11 @@ function attachedParts(meshes: Json, regions: Json): Set<string> {
|
|
|
2663
2663
|
* not a declaration (`CONFIG_CLOTH_ALTERNATE_DIFFERS`);
|
|
2664
2664
|
* - `swing` on a tag other than `bottomwear`, or `swing.scales` not one per
|
|
2665
2665
|
* tree (`CONFIG_CLOTH_SWING_SCALE_PER_TREE`);
|
|
2666
|
+
* - `part` on a tag other than `bottomwear` (`CONFIG_CLOTH_PART_ON_BOTTOMWEAR`):
|
|
2667
|
+
* the field hands the skirt's recipe to a part of another tag (issue #402),
|
|
2668
|
+
* and only the skirt has a recipe that part can take; whether the part
|
|
2669
|
+
* exists, and is a `topwear` that hangs below the hip, is read off the parts
|
|
2670
|
+
* by `propose` (`PROPOSE_CLOTH_PART`);
|
|
2666
2671
|
* - a strength, declared or the recipe's default, whose spring is unstable at
|
|
2667
2672
|
* a damping the recipe runs at — k = strength·massInverse·step² at or past
|
|
2668
2673
|
* 2(1 + damping^(60·step)), rig-c's default fps 60 and mass 1, the damping
|
|
@@ -2690,7 +2695,7 @@ function checkCloth(c: Check, v: Json): void {
|
|
|
2690
2695
|
for (const tag of CLOTH_TARGETS) {
|
|
2691
2696
|
if (!(tag in v)) continue;
|
|
2692
2697
|
const path = `${at}.${JSON.stringify(tag)}`;
|
|
2693
|
-
const r = c.object(path, v[tag], ['chains', 'links', 'wind', 'gravity'], ['split', 'length_ratio', 'strength', 'damping', 'alternate_damping', 'translate', 'swing']);
|
|
2698
|
+
const r = c.object(path, v[tag], ['chains', 'links', 'wind', 'gravity'], ['split', 'length_ratio', 'strength', 'damping', 'alternate_damping', 'translate', 'swing', 'part']);
|
|
2694
2699
|
if (r === null) continue;
|
|
2695
2700
|
const chains = 'chains' in r && c.int(`${path}.chains`, r.chains, 1) ? (r.chains as number) : null;
|
|
2696
2701
|
const links = 'links' in r && c.int(`${path}.links`, r.links, 1) ? (r.links as number) : null;
|
|
@@ -2743,6 +2748,11 @@ function checkCloth(c: Check, v: Json): void {
|
|
|
2743
2748
|
if ('translate' in r && c.number(`${path}.translate`, r.translate, 'unit') && r.translate === 0) {
|
|
2744
2749
|
c.fail('CONFIG_FIELD_TYPE', `${path}.translate`, 'is 0; a mix above 0 and at most 1 is required (leave translate out for none)');
|
|
2745
2750
|
}
|
|
2751
|
+
if ('part' in r) {
|
|
2752
|
+
if (tag !== 'bottomwear') {
|
|
2753
|
+
c.fail('CONFIG_CLOTH_PART_ON_BOTTOMWEAR', `${path}.part`, `is declared on "${tag}"; part hands the skirt's recipe (bottomwear) to a topwear part that holds a skirt (a dress) — leave it out here`);
|
|
2754
|
+
} else c.string(`${path}.part`, r.part);
|
|
2755
|
+
}
|
|
2746
2756
|
if ('swing' in r) {
|
|
2747
2757
|
if (tag !== 'bottomwear') {
|
|
2748
2758
|
c.fail('CONFIG_CLOTH_SWING_SCALE_PER_TREE', `${path}.swing`, `is declared on "${tag}"; the shared swing is the skirt's (bottomwear) — leave it out here`);
|
package/src/motion.ts
CHANGED
|
@@ -53,14 +53,15 @@
|
|
|
53
53
|
*
|
|
54
54
|
* ## Control bones — `A15_IDLE_NO_MESH_BONE_KEYS`
|
|
55
55
|
*
|
|
56
|
-
* rig-c's `
|
|
57
|
-
* is weighted to (the player skips
|
|
58
|
-
* answer, ported as is and still the
|
|
59
|
-
* every keyed bone that some mesh names
|
|
60
|
-
* `<bone>_ctl` at the SAME origin,
|
|
61
|
-
* keys to the control. The pose is
|
|
62
|
-
*
|
|
63
|
-
* level in a channel (measured on both
|
|
56
|
+
* rig-c's `rig-play` profile (named `spine-html` before rig-c 2.50.0)
|
|
57
|
+
* refuses an `idle` that keys a bone a mesh is weighted to (the player skips
|
|
58
|
+
* idle work on meshes). The reference's answer, ported as is and still the
|
|
59
|
+
* default (`rig --idle-keys ctl`): for every keyed bone that some mesh names
|
|
60
|
+
* among its candidates, add a parent `<bone>_ctl` at the SAME origin,
|
|
61
|
+
* re-parent the bone under it, and move the keys to the control. The pose is
|
|
62
|
+
* the same up to float rounding: the extra bone in each chain moves the
|
|
63
|
+
* rendered idle frames by at most one level in a channel (measured on both
|
|
64
|
+
* public examples, rig-parts #13).
|
|
64
65
|
*
|
|
65
66
|
* ⚠️ **This satisfies the rule's wording only.** The meshes are still
|
|
66
67
|
* deformed every frame — by the control's motion, through the bone they are
|
package/src/propose.ts
CHANGED
|
@@ -820,6 +820,42 @@ export const HIP_MIN_FRACTION = 0.25;
|
|
|
820
820
|
/** A row is a waist when the torso there is at most this fraction of the shoulders' width (the examples' torsos narrow to 0.648 of their shoulders in `demo` and 0.710 in `sample`). */
|
|
821
821
|
export const WAIST_MAX_OF_SHOULDERS = 0.8;
|
|
822
822
|
|
|
823
|
+
/**
|
|
824
|
+
* A `topwear` part hangs below the hip when its box reaches this many face
|
|
825
|
+
* heights below the hip's y: above it, the topwear rule reads a bodice that
|
|
826
|
+
* stops at the waist and drafts no robe chains (the reference's line). Issue
|
|
827
|
+
* #402 reads the same line for a skirt held inside `topwear` (a dress), so
|
|
828
|
+
* the two rules cannot disagree about which topwear hangs.
|
|
829
|
+
*/
|
|
830
|
+
export const TOPWEAR_HANGS_FACE_HEIGHTS = 0.25;
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* Issue #402: the note naming a `topwear` part shaped like a skirt — its box
|
|
834
|
+
* hanging {@link TOPWEAR_HANGS_FACE_HEIGHTS} face heights past the hip, and
|
|
835
|
+
* its art wider across its last 24 rows than in the 24-row band at the hip
|
|
836
|
+
* (the band the robe rule reads) — or null when it is not. The cloth recipe
|
|
837
|
+
* finds a skirt by the `bottomwear` tag alone, and the shape cannot tell a
|
|
838
|
+
* dress from an outer robe over a skirt, so the proposer drafts nothing on
|
|
839
|
+
* the strength of it: the note names the part, its art's rows below the hip
|
|
840
|
+
* and the field, `cloth.bottomwear.part`, by which the author declares it.
|
|
841
|
+
*/
|
|
842
|
+
function skirtInsideNote(p: PartRecord, mask: Mask, hipY: number, fh: number): string | null {
|
|
843
|
+
const bot = p.y + p.h;
|
|
844
|
+
const line = hipY + TOPWEAR_HANGS_FACE_HEIGHTS * fh;
|
|
845
|
+
if (bot < line) return null;
|
|
846
|
+
const span = (xs: number[]): number => (xs.length === 0 ? 0 : xs[xs.length - 1] - xs[0] + 1);
|
|
847
|
+
const atHip = span(colsAny(mask, pyInt(hipY) - 12, pyInt(hipY) + 12));
|
|
848
|
+
const atBottom = span(colsAny(mask, bot - 24, bot));
|
|
849
|
+
if (!(atBottom > atHip)) return null;
|
|
850
|
+
const hipRow = pyRound(hipY);
|
|
851
|
+
let last = bot - 1;
|
|
852
|
+
while (last > p.y && colsAny(mask, last, last + 1).length === 0) last--;
|
|
853
|
+
return (
|
|
854
|
+
`${p.name} (${p.from}): shaped like a skirt — its art's rows ${hipRow + 1} to ${last} lie below hip (y ${hipRow}), past hip + ${TOPWEAR_HANGS_FACE_HEIGHTS} face heights (y ${pyFixed(line, 1)}), and it is wider across its last 24 rows (${atBottom} px) than in the 24-row band at the hip (${atHip} px); ` +
|
|
855
|
+
`the cloth recipe finds a skirt by the bottomwear tag alone, so it drafted no skirt trees on ${p.name}, and the topwear rule drafts it instead. If See-through returned the skirt inside it (a dress), declare config.cloth.bottomwear.part: "${p.name}", and the bottomwear recipe's trees hang from hip over its art below the hip`
|
|
856
|
+
);
|
|
857
|
+
}
|
|
858
|
+
|
|
823
859
|
/**
|
|
824
860
|
* One handwear blob is clasped hands, not two sleeves, when it is at most this
|
|
825
861
|
* fraction of the shoulders' width: two sleeves that hang from the shoulders
|
|
@@ -2022,8 +2058,42 @@ export function proposeWithBasis(
|
|
|
2022
2058
|
if (hw.length === 1) notes.push(`handwear is one blob (${hw[0].name}): both sleeves in one mesh, split at the eye axis x=${pyFixed(axis, 0)}`);
|
|
2023
2059
|
}
|
|
2024
2060
|
|
|
2061
|
+
// Issue #402: the topwear part config.cloth.bottomwear.part names takes the skirt's rule and recipe below; every
|
|
2062
|
+
// other topwear shaped like a skirt is named in a note when a recipe is in play, never drafted on by its shape.
|
|
2063
|
+
const namedSkirt = ((): PartRecord | null => {
|
|
2064
|
+
const name = recipeOf('bottomwear')?.part;
|
|
2065
|
+
if (name === undefined) return null;
|
|
2066
|
+
const refuse = (detail: string): never => {
|
|
2067
|
+
throw new PartsError([{ code: 'PROPOSE_CLOTH_PART', object: 'config.cloth."bottomwear".part', detail }]);
|
|
2068
|
+
};
|
|
2069
|
+
const q = P.recs.find((x) => x.name === name);
|
|
2070
|
+
if (q === undefined) return refuse(`names "${name}", which is no part in parts.json; a topwear part whose art hangs below the hip (a dress) is required`);
|
|
2071
|
+
if (q.cut_from !== undefined) return refuse(`names "${name}", a piece an assemble.cuts entry took from ${q.cut_from}; name the part the plan made, ${q.cut_from}, or leave part out`);
|
|
2072
|
+
if (!tw.includes(q)) {
|
|
2073
|
+
return refuse(
|
|
2074
|
+
`names "${name}", from ${q.from}; ${splitFrom(q.from)[1] === 'bottomwear' ? 'a bottomwear part takes the recipe by its tag already — leave part out' : "only a topwear part takes the skirt's recipe by name (a skirt See-through returned inside topwear, a dress)"}`,
|
|
2075
|
+
);
|
|
2076
|
+
}
|
|
2077
|
+
const line = hip[1] + TOPWEAR_HANGS_FACE_HEIGHTS * fh;
|
|
2078
|
+
if (q.y + q.h < line) {
|
|
2079
|
+
return refuse(`names "${name}", whose box ends at y=${q.y + q.h}, above hip + ${TOPWEAR_HANGS_FACE_HEIGHTS} face heights (y=${pyFixed(line, 1)}), where the topwear rule reads a bodice that stops at the waist: no skirt hangs below the hip to hang trees on`);
|
|
2080
|
+
}
|
|
2081
|
+
return q;
|
|
2082
|
+
})();
|
|
2083
|
+
const skirtHints = new Map<string, string>();
|
|
2084
|
+
if (cloth !== null) {
|
|
2085
|
+
for (const p of tw) {
|
|
2086
|
+
if (p === namedSkirt) continue;
|
|
2087
|
+
const hint = skirtInsideNote(p, P.alpha(p), hip[1], fh);
|
|
2088
|
+
if (hint !== null) skirtHints.set(p.name, hint);
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2025
2092
|
// ---- outer robe (topwear)
|
|
2026
2093
|
for (const p of tw) {
|
|
2094
|
+
if (p === namedSkirt) continue;
|
|
2095
|
+
const hint = skirtHints.get(p.name);
|
|
2096
|
+
if (hint !== undefined) notes.push(hint);
|
|
2027
2097
|
const [g, r] = gridR(p);
|
|
2028
2098
|
const mask = P.alpha(p);
|
|
2029
2099
|
const top = chest[1] - 0.3 * fh;
|
|
@@ -2039,7 +2109,7 @@ export function proposeWithBasis(
|
|
|
2039
2109
|
['chest', rnd(along(hip, trunk.u, artExtent(mask, p, hip, trunk.u)[0])), rnd(along(hip, trunk.u, -20))],
|
|
2040
2110
|
['hip', rnd(along(hip, trunk.u, -20)), rnd(along(hip, trunk.u, 100))],
|
|
2041
2111
|
];
|
|
2042
|
-
if (bw.length > 0 && bot < hip[1] +
|
|
2112
|
+
if (bw.length > 0 && bot < hip[1] + TOPWEAR_HANGS_FACE_HEIGHTS * fh) {
|
|
2043
2113
|
// A bodice that stops at the waist: robe chains down to the hem would fall off the art.
|
|
2044
2114
|
meshes[p.name] = { grid: g, r, segments: segs };
|
|
2045
2115
|
notes.push(`${p.name} ends at y=${bot} (hip ${pyFixed(hip[1], 0)}): no robe chains -- add a sash chain by hand if one hangs`);
|
|
@@ -2086,8 +2156,9 @@ export function proposeWithBasis(
|
|
|
2086
2156
|
meshes[p.name] = { grid: g, r, segments: segs };
|
|
2087
2157
|
}
|
|
2088
2158
|
|
|
2089
|
-
// ---- skirt (bottomwear)
|
|
2090
|
-
|
|
2159
|
+
// ---- skirt (bottomwear, and the topwear part config.cloth.bottomwear.part names: issue #402)
|
|
2160
|
+
const skirts = namedSkirt === null ? bw : [...bw, namedSkirt];
|
|
2161
|
+
for (const p of skirts) {
|
|
2091
2162
|
const [g, r] = gridR(p);
|
|
2092
2163
|
const mask = P.alpha(p);
|
|
2093
2164
|
const bot = p.y + p.h;
|
|
@@ -2122,7 +2193,7 @@ export function proposeWithBasis(
|
|
|
2122
2193
|
// Issue #364: with config.cloth.bottomwear, the recipe's trees hang from the hip in place of the three keyed chains.
|
|
2123
2194
|
const skirtRecipe = recipeOf('bottomwear');
|
|
2124
2195
|
if (skirtRecipe !== null) {
|
|
2125
|
-
const prefix =
|
|
2196
|
+
const prefix = skirts.length === 1 ? 'skirt' : `skirt_${p.name}`;
|
|
2126
2197
|
const trees = T(p, 'bottomwear', skirtRecipe, {
|
|
2127
2198
|
prefix,
|
|
2128
2199
|
parent: 'hip',
|
|
@@ -2162,6 +2233,7 @@ export function proposeWithBasis(
|
|
|
2162
2233
|
skirtRecipe,
|
|
2163
2234
|
made.length,
|
|
2164
2235
|
`${swing === null ? '' : ` on one shared swing, ${swing.bone} (each tree's first link takes its rotation times ${skirtRecipe.swing?.scales.join('/')}, its setup rotation ${swing.rest} degrees subtracted)`} from hip, rooted 20 px below its y and tipped 4 px above ${p.name}'s bottom, laid down the screen`,
|
|
2236
|
+
p === namedSkirt ? p.from : undefined,
|
|
2165
2237
|
),
|
|
2166
2238
|
);
|
|
2167
2239
|
meshes[p.name] = { grid: g, r, segments: segs };
|
|
@@ -2316,7 +2388,9 @@ export function proposeWithBasis(
|
|
|
2316
2388
|
object: `config.cloth."${t}"`,
|
|
2317
2389
|
detail:
|
|
2318
2390
|
P.byTag(t).length === 0 && P.headFirst(t).length === 0
|
|
2319
|
-
?
|
|
2391
|
+
? t === 'bottomwear' && skirtHints.size > 0
|
|
2392
|
+
? `declares a recipe for "${t}", and no part is tagged "${t}"; leave the recipe out, assemble the layer it is for, or name the part that holds the skirt — ${[...skirtHints.values()].join('; ')}`
|
|
2393
|
+
: `declares a recipe for "${t}", and no part is tagged "${t}"; leave the recipe out, or assemble the layer it is for`
|
|
2320
2394
|
: t === 'back hair'
|
|
2321
2395
|
? `declares a recipe for "back hair", and every back hair part ends above the shoulders (0.5 face heights below the neck), which the proposer drafts as a bun bone with no chain; leave the recipe out`
|
|
2322
2396
|
: `declares a recipe for "${t}", and the proposer drafted no chain on it`,
|
package/src/rig.ts
CHANGED
|
@@ -615,7 +615,7 @@ function applyTurn(
|
|
|
615
615
|
* work. `ctl` stays the default because the examples' expected `rig.json` and
|
|
616
616
|
* `motion.json` are the reference implementation's output, and because the
|
|
617
617
|
* declaration lives in the rig spec only: `rigc validate <build> --profile
|
|
618
|
-
*
|
|
618
|
+
* rig-play`, which has no rig spec to read, refuses a `direct` build once
|
|
619
619
|
* per keyed mesh bone.
|
|
620
620
|
*/
|
|
621
621
|
export const IDLE_KEYS = ['ctl', 'direct'] as const;
|