spine-parts 2.40.0 → 2.41.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/docs/AUTHORING.md +39 -6
- package/docs/STABILITY.md +8 -1
- package/package.json +1 -1
- package/src/check.ts +23 -7
- package/src/config.ts +29 -3
- package/src/instruments.ts +7 -3
- package/src/motion.ts +26 -24
- package/src/rig.ts +25 -14
package/docs/AUTHORING.md
CHANGED
|
@@ -175,8 +175,9 @@ read by no CPU stage).
|
|
|
175
175
|
| `regions.<part>` | rig | **proposed**: the bone a rigid part rides. Every plan part is exactly one of a mesh or a region (`CONFIG_PART_ATTACHED`) Also accepts `{bone, gather?}`: `bone` is the same required bone name and `gather: false` keeps an exclusive non-segment limb rider at its authored draw position without changing its binding (issue #680). Remove `gather` for normal gathering; other values are refused and a non-rider is `RIG_GATHER_RIDER`. |
|
|
176
176
|
| `motion.duration` | rig; check (the loop is measured at this time) | proposed as 40 frames at 12 fps, `40/12` s, written `3.3333333333333335` (issue #252; the reference proposed 4 s, and every period it drafted is scaled with it so each track keeps its cycles per idle); a whole number of 1/12 s ticks, because `check` renders at 12 fps and compares frame 0 with the frame at this time — read within 10^-9 s (`TIME_SLACK`, issue #244), since a whole number of frames is often not exact in binary: rigc's 40th frame sits at `40 × (1/12)` = `3.333333333333333`. Half a frame off is `CHECK_LOOP_LAST_FRAME_AT_DURATION` |
|
|
177
177
|
| `motion.tracks` | rig | **proposed**, then tuned. Single `{bone, prop, amp, period, phase, base?}` or chain `{chain, amps, period, phase, lag}` — one amplitude per link, link `i` at phase `phase + lag·i`. Every `period` must divide `duration` (`CONFIG_PERIOD_DIVIDES_DURATION`). A bone property is keyed by one track (`CONFIG_BONE_PROPERTY_KEYED_ONCE`): a chain keys `rotate` on every link, the blink's `eyes` group `scaley` and its `brows` group `translatey` on every member, so a single track on any of those is a second track on it — rigc would refuse it one stage later, `animation "idle" has two tracks on eye.scaley`. The proposed breath (issues #252, #270) is `chest` `translatey` travelling 2.5 % of the torso's length peak to peak — the distance from the `neck` bone to the `hip` bone as the proposal writes them, the run the chest sits half way along, whichever rule placed them — (amplitude half of it to two decimals, `base` the amplitude, so the chest rises from the setup pose and returns); the `breath:` note prints the fraction, the length, the two bones and the pixels. Until #270 it was 2.5 % of the `topwear` part's height, and a sweater to the thighs (`scarf`, 690 px) breathed 2.9 times as deep as `demo`; on neck → hip `scarf` reads 431 px (10.78 px) and `demo` 192 px (4.80 px). Neck and hip on one point: no length to scale by, so the breath keeps the reference's amplitude 1.3 (2.6 px peak to peak) and the note says so — scale it to the figure. `chest` `scalex` and the `head` and `neck` rolls are a ratio and angles and are proposed the same on every figure. A chain link is turned along its chain (the `bones` row), so a `translatex`/`translatey` key on a bone whose parent is a turned link, or a `scale`/`shear` key on a turned link, would move or stretch along the link and not along the picture's axis: the rig stage refuses it (`RIG_KEY_FRAME_UNTURNED`); `rotate` is keyed on any bone |
|
|
178
|
-
| `motion.blink` | rig | **proposed
|
|
179
|
-
| `motion.blink.
|
|
178
|
+
| `motion.blink` | rig | **proposed** with one scalar `t`: `{t, eyes, brows, squash, brow_drop}`; optional authored `more` repeats it (next row). The whole blink, `t` to `t + 0.364` s (`t + 0.314` s without brows: the brows' keys are the ones that end last), must fit strictly inside the idle (`RIG_BLINK_INSIDE_IDLE`), for `t` and every added start time. The `eyes` group's `scaley` squashes every part on the eye bones about the bone's origin, the eyewhite's centre. Optional: a figure with no `eyewhite-r`/`-l` part has no eye bone, so `propose` writes no `blink` and notes `no blink: no eyewhite part (looked for: eyewhite-r, eyewhite-l), …`; with eyes and no `eyebrow-r`/`-l` part it writes the blink without `brows` and `brow_drop` and notes `blink without brows: …`. `brows` and `brow_drop` are stated together or not at all (`CONFIG_BLINK_BROWS_PAIRED`), and a group that names no bone is refused (`CONFIG_BLINK_GROUP_MEMBERS`) — rigc would refuse it one stage later, `group "eyes" declares no members` — as is a group that names one bone twice (`CONFIG_BLINK_GROUP_UNIQUE`; rigc: `group "eyes" names member "eye" twice`). An `irides-*` or `eyelash-*` part on a side with no eyewhite has no eye bone to ride: `propose` places it on `head` as a region, which the blink does not move, and notes `no eyewhite part for eye_r (looked for: eyewhite-r): iris (head:irides-r) is placed on head as a region, …`. The timing is fixed, not a field (table below) |
|
|
179
|
+
| `motion.blink.more` | rig | **authored**, optional (issue #1304): a non-empty array of finite start times in seconds, strictly increasing and each greater than the scalar `motion.blink.t` (`CONFIG_BLINK_MORE_TIMES`). Each repeats the same blink shape, fixed timing, `eyes`/`brows` groups, `squash`, `brow_drop` and `still` split. Every complete blink must lie strictly inside the idle (`RIG_BLINK_INSIDE_IDLE`); full blink windows cannot overlap (`RIG_BLINK_WINDOWS_DISJOINT`). Omit `more` for a single blink: all output bytes are preserved. `propose` drafts only the scalar `t`, never `more` |
|
|
180
|
+
| `motion.blink.still` | rig | **proposed** only for a lash `propose` notes (below), then checked: `{<part>: {row, bone}}` — the rows of that region part above `row` (rig px, y down) are drawn by a second slot `<part>_still` on `bone` and do not blink; rows from `row` down keep the part's slot and blink. The part must be a region on a bone `eyes` names, `bone` one it does not (`CONFIG_STILL_OFF_THE_BLINK`), and `row` a non-negative integer strictly inside the part (`RIG_STILL_ROW_INSIDE_PART`), with no art across its whole width (`RIG_STILL_ROW_CLEAR`) and art in both pieces (`RIG_STILL_PIECES_HAVE_ART`). The generated `<part>_still` name must be free (`RIG_STILL_NAME_FREE`). The same split applies to every blink |
|
|
180
181
|
| `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 |
|
|
181
182
|
| `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 |
|
|
182
183
|
| `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/core/stop`). `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 |
|
|
@@ -285,7 +286,8 @@ selftest's `RG56`–`RG58` hold every row on the installed rigc:
|
|
|
285
286
|
| transform on a link (`rotate` from the target) | gates green; the link's world rotation is the target's | the same |
|
|
286
287
|
|
|
287
288
|
The blink's timing is the tree's (`BLINK` in `src/motion.ts`), in seconds after
|
|
288
|
-
`motion.blink.t
|
|
289
|
+
each start time: `motion.blink.t`, followed by each entry in `motion.blink.more`
|
|
290
|
+
when present:
|
|
289
291
|
|
|
290
292
|
| phase | eyes (`scaley` 1 → `squash` → 1) | brows (`translatey` 0 → `-brow_drop` → 0) | easing |
|
|
291
293
|
| --- | --- | --- | --- |
|
|
@@ -305,6 +307,35 @@ grew by the same 0.044 s, so they still reach their drop 0.01 s after the lids s
|
|
|
305
307
|
leave it 0.01 s after the lids open. The rig stage refuses a hold under one frame by
|
|
306
308
|
name (`RIG_BLINK_HOLD_SPANS_A_FRAME`, §6), counted over the same 250,000 phases.
|
|
307
309
|
|
|
310
|
+
For example, `"t": 1, "more": [2, 3]` schedules the same blink at 1, 2 and 3 s
|
|
311
|
+
in an idle long enough to contain all three. `t` remains a required scalar; `more`
|
|
312
|
+
is an array of additional starts, not an array of blink objects or replacement
|
|
313
|
+
settings. An empty array, non-number, non-finite time, duplicate, descending time,
|
|
314
|
+
or time at or before `t` is `CONFIG_BLINK_MORE_TIMES`. Leave the field out rather
|
|
315
|
+
than writing `[]` when there is no additional blink.
|
|
316
|
+
|
|
317
|
+
For every start `s`, the complete window is `s` through `s + span`, where `span`
|
|
318
|
+
is 0.364 s with brows or 0.314 s without them, derived from the fixed timings
|
|
319
|
+
above. Both ends must be strictly inside the idle: `s > 0` and
|
|
320
|
+
`s + span < motion.duration` (`RIG_BLINK_INSIDE_IDLE`). These full windows,
|
|
321
|
+
including the brows' return when present, must not overlap
|
|
322
|
+
(`RIG_BLINK_WINDOWS_DISJOINT`); increasing start times alone do not guarantee
|
|
323
|
+
that. Move the named starts apart or omit an added blink. No timing or group is
|
|
324
|
+
inferred separately for an entry in `more`.
|
|
325
|
+
|
|
326
|
+
The fixed hold and `RIG_BLINK_HOLD_SPANS_A_FRAME` apply to every blink; `more`
|
|
327
|
+
does not offer a shorter hold. `check`'s `BLINK_NO_HOLE` compares the shared closed-eye
|
|
328
|
+
shape against the setup pose on the same grid, with a zero-background-hole bar;
|
|
329
|
+
it does not render each added blink separately to judge its appearance during the
|
|
330
|
+
idle. It reports each closed window separately: `idle_frames_closed` is the
|
|
331
|
+
sorted union of sampled closed frames, and multiple blinks also report
|
|
332
|
+
`idle_frames_closed_per_blink`. Open intervals between blinks are excluded.
|
|
333
|
+
The colour-patch figures remain observations, not a bar (§7).
|
|
334
|
+
`motion.blink.still` likewise splits the part once: its upper piece stays on the
|
|
335
|
+
specified non-eye bone for every blink, and its lower piece follows the same eye
|
|
336
|
+
group each time. The region, clear-row, art-on-both-sides and free-name constraints
|
|
337
|
+
apply unchanged.
|
|
338
|
+
|
|
308
339
|
The proposer's reach (from `src/propose.ts`): roles come from each part's tag —
|
|
309
340
|
`face` makes `hip`/`chest`/`neck`/`head`, the eyewhites make the eye bones (irides and
|
|
310
341
|
lashes ride them, or `head` on a side with no eyewhite), brows are
|
|
@@ -5379,6 +5410,7 @@ See-through with another seed.
|
|
|
5379
5410
|
| <a id="CONFIG_BLINK_GROUP_MEMBERS"></a>`CONFIG_BLINK_GROUP_MEMBERS` | `motion.blink.eyes` or `motion.blink.brows` is `[]`: a group with no members, which rigc refuses at the gate | a figure with no eyewhite part has nothing to blink: leave `motion.blink` out; one with no eyebrow part: leave `brows` and `brow_drop` out |
|
|
5380
5411
|
| <a id="CONFIG_BLINK_GROUP_UNIQUE"></a>`CONFIG_BLINK_GROUP_UNIQUE` | `motion.blink.eyes` or `motion.blink.brows` names one bone more than once; the detail gives the bone and every index it sits at. rigc refuses it at the gate (`group "eyes" names member "eye" twice`) | name each bone once: the group keys every member it names |
|
|
5381
5412
|
| <a id="CONFIG_BONE_PROPERTY_KEYED_ONCE"></a>`CONFIG_BONE_PROPERTY_KEYED_ONCE` | two tracks key one bone property: two single tracks, a single track on a chain link's `rotate`, or a single track on a blink member's `scaley` (`eyes`) or `translatey` (`brows`); the detail names the property and every track by its config path. rigc refuses it at the gate (`animation "idle" has two tracks on eye.scaley; merge them into one track`) | merge them into one track, or key another property or bone |
|
|
5413
|
+
| <a id="CONFIG_BLINK_MORE_TIMES"></a>`CONFIG_BLINK_MORE_TIMES` | `motion.blink.more` is not a non-empty array of finite numbers, is not strictly increasing, or contains a time at or before scalar `motion.blink.t` | omit `more` for one blink, or list additional start times in strictly increasing order, each greater than `t` |
|
|
5382
5414
|
| <a id="CONFIG_BLINK_BROWS_PAIRED"></a>`CONFIG_BLINK_BROWS_PAIRED` | `motion.blink.brows` without `brow_drop`, or `brow_drop` without `brows` | state both or neither |
|
|
5383
5415
|
| <a id="CONFIG_STILL_OFF_THE_BLINK"></a>`CONFIG_STILL_OFF_THE_BLINK` | a `motion.blink.still` entry names a region on a bone the blink's `eyes` does not name (nothing to hold still), or its `bone` is one the blink's `eyes` names (the still piece would blink) | that entry's part, or its `bone` — the eye bone's parent, `head` as proposed |
|
|
5384
5416
|
| <a id="CONFIG_CONSTRAINT_TYPE_KNOWN"></a>`CONFIG_CONSTRAINT_TYPE_KNOWN` | a `constraints` entry's `type` is not one of rig-c's five: `ik`, `transform`, `path`, `physics`, `slider` (spelled as rigc spells them; `IK` is not `ik`) | that entry's `type` |
|
|
@@ -5856,8 +5888,9 @@ recorded transform. The record fields and sampling formula are specified in
|
|
|
5856
5888
|
| <a id="FLATTEN_REGION_UPRIGHT"></a>`FLATTEN_REGION_UPRIGHT` | `flattenRig` (`src/rig.ts`), the reference's unturned form of a built rig — which only the repository's `scripts/rig_oracle.ts` calls, no command — met a region whose `rotation` does not cancel its bone's turn, so its flat form would be drawn turned | a repository tool's input, not an author's: report it with the line |
|
|
5857
5889
|
| <a id="RIG_TURN_NAME_FREE"></a>`RIG_TURN_NAME_FREE` | with `turn`: a twin (`turn_<part>_<bone>`), the control `turn` or a transform constraint `turn_<part>` the turn writes is a name the rig already holds | rename the declared bone or constraint |
|
|
5858
5890
|
| <a id="RIG_KEY_FRAME_UNTURNED"></a>`RIG_KEY_FRAME_UNTURNED` | a `translate` key on a bone whose parent is a chain link turned along its chain, or a `scale`/`shear` key (a track, or the blink's `eyes`/`brows` group) on a turned link: the key would act along the link's axis, not the picture's; the detail names the track, the bone and the turn | key the chain's own parent, or key `rotate`; a link whose turn is 0 (a level chain) keeps every key |
|
|
5859
|
-
| <a id="RIG_BLINK_INSIDE_IDLE"></a>`RIG_BLINK_INSIDE_IDLE` |
|
|
5860
|
-
| <a id="
|
|
5891
|
+
| <a id="RIG_BLINK_INSIDE_IDLE"></a>`RIG_BLINK_INSIDE_IDLE` | a blink at `motion.blink.t` or an entry in `motion.blink.more` does not fit strictly inside the idle, including the brows' return when present | the named start time: require `s > 0` and `s + span < motion.duration`, with span 0.364 s with brows or 0.314 s without |
|
|
5892
|
+
| <a id="RIG_BLINK_WINDOWS_DISJOINT"></a>`RIG_BLINK_WINDOWS_DISJOINT` | complete blink windows overlap, including the brows' return when present; strictly increasing starts alone do not keep windows apart | separate the named starts in `motion.blink.t` / `motion.blink.more`, or omit an added blink |
|
|
5893
|
+
| <a id="RIG_BLINK_HOLD_SPANS_A_FRAME"></a>`RIG_BLINK_HOLD_SPANS_A_FRAME` | the tree's `BLINK.hold` is shorter than one frame at `IDLE_FPS`, so for some blink start (`motion.blink.t` or `motion.blink.more`) no idle frame — and no frame of the loop — shows the closed eye; the detail counts the phases that miss and names the first | nothing in the config: `BLINK.hold` in `src/motion.ts`, at least `1/IDLE_FPS` s (§3) |
|
|
5861
5894
|
| <a id="CONFIG_LAYOUT_TARGET"></a>`CONFIG_LAYOUT_TARGET` | `config.limbs.<name>.layout` declares both or neither `before`/`after`, or a target declares both or neither `limb`/`part` | write one immediate placement side and one typed named target |
|
|
5862
5895
|
| <a id="CONFIG_LAYOUT_NAME"></a>`CONFIG_LAYOUT_NAME` | a layout names no declared target limb or produced part; a consumed source layer is not an emitted part | use the declared limb or produced segment/part names printed in the detail |
|
|
5863
5896
|
| <a id="CONFIG_LAYOUT_SCOPE"></a>`CONFIG_LAYOUT_SCOPE` | layout `parts` is empty, duplicated, nonconsecutive, foreign, or names a rider instead of an own source-bound segment part | select distinct consecutive own segment-part references; inherited riders are proven separately |
|
|
@@ -8686,7 +8719,7 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
|
|
|
8686
8719
|
| `STRESS_OFF_CHAIN.per_part` | `STRESS_OFF_CHAIN.per_part` | 'part' | finding when poses.some(p => typeof p.reading === 'number' && p.reading > STRESS_RIGID); otherwise evidence | [r.part] | [check.ts:3927](../src/check.ts#L3927) |
|
|
8687
8720
|
| `STRESS_OFF_CHAIN.per_part[].off_chain` | `STRESS_OFF_CHAIN.per_part[].off_chain` | 'part' | evidence | [r.part] | [check.ts:3927](../src/check.ts#L3927) |
|
|
8688
8721
|
| `STRESS_OFF_CHAIN.per_part[].poses` | `STRESS_OFF_CHAIN.per_part[].poses` | 'part' | evidence; finding when shown > STRESS_RIGID; otherwise evidence | [r.part] | [check.ts:3895](../src/check.ts#L3895), [check.ts:3913](../src/check.ts#L3913) |
|
|
8689
|
-
| `TEXTURE_STRETCH.per_mesh` | `TEXTURE_STRETCH.per_mesh` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when severity > TEXTURE_STRETCH_CEILING; otherwise evidence | resolved piece for m.slot; otherwise [] | [check.ts:
|
|
8722
|
+
| `TEXTURE_STRETCH.per_mesh` | `TEXTURE_STRETCH.per_mesh` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when severity > TEXTURE_STRETCH_CEILING; otherwise evidence | resolved piece for m.slot; otherwise [] | [check.ts:9560](../src/check.ts#L9560), [check.ts:9570](../src/check.ts#L9570) |
|
|
8690
8723
|
| `TIP_OVER_ROOT.parts` | `TIP_OVER_ROOT.parts` | 'part' | evidence; finding when !ok && !(!rigid && hanging.onLink && Math.max(c.root, c.tip) < TIP_TRAVEL_FLOOR); otherwise evidence | [p.name] | [check.ts:8325](../src/check.ts#L8325), [check.ts:8330](../src/check.ts#L8330), [check.ts:8351](../src/check.ts#L8351), [check.ts:8362](../src/check.ts#L8362) |
|
|
8691
8724
|
| `WIND_BAND.pairs` | `WIND_BAND.pairs` | 'pair' | finding when !holdsAll; otherwise evidence | [p.a, p.b] | [check.ts:6464](../src/check.ts#L6464) |
|
|
8692
8725
|
| `WIND_BAND.pairs[].steps` | `WIND_BAND.pairs[].steps` | 'pair' | finding when !s.holds; otherwise evidence | [p.a, p.b] | [check.ts:6475](../src/check.ts#L6475) |
|
package/docs/STABILITY.md
CHANGED
|
@@ -413,7 +413,7 @@ part name, `[i]` an entry of a list):
|
|
|
413
413
|
- **motion** — required: `duration`, `tracks`; optional: `blink`, `animations_from`
|
|
414
414
|
- **motion.tracks[i]**, a single track — required: `bone`, `prop`, `amp`, `period`, `phase`; optional: `base`
|
|
415
415
|
- **motion.tracks[i]**, a chain track — required: `chain`, `amps`, `period`, `phase`, `lag`
|
|
416
|
-
- **motion.blink** — required: `t`, `eyes`, `squash`; optional: `brows`, `brow_drop`, `still`
|
|
416
|
+
- **motion.blink** — required: `t`, `eyes`, `squash`; optional: `brows`, `brow_drop`, `still`, `more`
|
|
417
417
|
- **motion.blink.still.<part>** — required: `row`, `bone`
|
|
418
418
|
- **motion.animations_from**, the file it names — required: `spec`, `animations`
|
|
419
419
|
- **turn** — required: `pivot`, `depths` (or `roles` / `body`, issues #763, #787); optional: `deform`, `band`, `radius`, `surface`, `head`, `roles`, `counter`, `grid`, `unitDepths`, `body`
|
|
@@ -435,6 +435,13 @@ part name, `[i]` an entry of a list):
|
|
|
435
435
|
- **waist** — required: `top`, `bottom`, `upper`, `lower`, `bone`, `constraint` (#650; absent keeps the ordinary bindings and graph)
|
|
436
436
|
<!-- /stable:config -->
|
|
437
437
|
|
|
438
|
+
`motion.blink.more` is an optional, authored non-empty array of finite additional
|
|
439
|
+
start times in seconds, strictly increasing and each greater than scalar
|
|
440
|
+
`motion.blink.t` (`CONFIG_BLINK_MORE_TIMES`). It repeats the same blink shape,
|
|
441
|
+
timing and groups; every complete window must be strictly inside the idle
|
|
442
|
+
(`RIG_BLINK_INSIDE_IDLE`) and windows cannot overlap (`RIG_BLINK_WINDOWS_DISJOINT`).
|
|
443
|
+
When absent, output bytes are unchanged; `propose` drafts scalar `t` only.
|
|
444
|
+
|
|
438
445
|
`assemble.seam` accepts `near-white` or `silhouette` (issue #905). CLI
|
|
439
446
|
`--seam` overrides config, then the existing `near-white` default applies.
|
|
440
447
|
Invalid values refuse as `CONFIG_FIELD_TYPE` at `config.assemble.seam`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spine-parts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.41.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/check.ts
CHANGED
|
@@ -7247,7 +7247,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7247
7247
|
animations[BLINK_ANIMATION] = {
|
|
7248
7248
|
duration: STILL_DURATION,
|
|
7249
7249
|
loop: false,
|
|
7250
|
-
tracks: shut.map((b) => ({ ...b.target, property: 'scaley', keys: [{ t: 0, v: [b.closed] }, { t: STILL_DURATION, v: [b.closed] }] })),
|
|
7250
|
+
tracks: shut.filter((b, i) => shut.findIndex(a => JSON.stringify(a.target) === JSON.stringify(b.target)) === i).map((b) => ({ ...b.target, property: 'scaley', keys: [{ t: 0, v: [b.closed] }, { t: STILL_DURATION, v: [b.closed] }] })),
|
|
7251
7251
|
};
|
|
7252
7252
|
}
|
|
7253
7253
|
const stillRig = { ...withoutSliders(inp.rig, animations), images };
|
|
@@ -9159,21 +9159,37 @@ function blinkLine(
|
|
|
9159
9159
|
const box = frameBox(eyes, H, inp.stage, open.viewport);
|
|
9160
9160
|
if (box === null) return skip('the eye box falls outside the setup-pose frame');
|
|
9161
9161
|
const b = blinkFigures(open.frames[0].image, closed.frames[0].image, open.background, box, BLINK_PATCH_LEVEL);
|
|
9162
|
-
|
|
9163
|
-
|
|
9164
|
-
const
|
|
9162
|
+
// Separate closed runs on each eye target before intersecting targets.
|
|
9163
|
+
// An open interval between authored blinks must never count as closed.
|
|
9164
|
+
const byTarget = new Map<string, typeof shut>();
|
|
9165
|
+
for (const track of shut) {
|
|
9166
|
+
const key = JSON.stringify(track.target);
|
|
9167
|
+
const list = byTarget.get(key) ?? [];
|
|
9168
|
+
list.push(track);
|
|
9169
|
+
byTarget.set(key, list);
|
|
9170
|
+
}
|
|
9171
|
+
const targets = [...byTarget.values()];
|
|
9172
|
+
let windows = (targets[0] ?? []).map(t => ({ from: t.window[0], to: t.window[1] }));
|
|
9173
|
+
for (const target of targets.slice(1)) {
|
|
9174
|
+
windows = windows.flatMap(w => target.map(t => ({ from: Math.max(w.from, t.window[0]), to: Math.min(w.to, t.window[1]) })).filter(w => w.from <= w.to));
|
|
9175
|
+
}
|
|
9176
|
+
windows.sort((a, b) => a.from - b.from || a.to - b.to);
|
|
9177
|
+
const perBlink = windows.map(w => framesInside(w.from, w.to, idle.fps, idle.sampled));
|
|
9178
|
+
const frames = [...new Set(perBlink.flat())].sort((a, b) => a - b);
|
|
9165
9179
|
if (b.holePx > BLINK_HOLE_BAR) {
|
|
9166
|
-
|
|
9180
|
+
// A missing common interval must not suppress a measured hole refusal.
|
|
9181
|
+
(targets[0] ?? [null]).forEach((_, i) => problems.push({
|
|
9167
9182
|
code: 'CHECK_BLINK_NO_HOLE',
|
|
9168
|
-
object: `the eye box ${boxLabel(box)} (${quoteParts(eyes)}) with the eyes shut`,
|
|
9183
|
+
object: `the eye box ${boxLabel(box)} (${quoteParts(eyes)}) with the eyes shut${(targets[0]?.length ?? 0) > 1 ? ` at ${i === 0 ? 'blink.t' : `blink.more[${i - 1}]`}` : ''}`,
|
|
9169
9184
|
detail: `${b.holePx} px show the background where the open eye had art; ${BLINK_HOLE_BAR} is required — the layer under the eye has no art there (See-through left it empty), so a closed eye opens a hole`,
|
|
9170
|
-
});
|
|
9185
|
+
}));
|
|
9171
9186
|
}
|
|
9172
9187
|
return {
|
|
9173
9188
|
status: b.holePx > BLINK_HOLE_BAR ? 'FAIL' : 'PASS',
|
|
9174
9189
|
eye_parts: eyes.map((p) => p.name),
|
|
9175
9190
|
closed: shut.map((s) => `${'bone' in s.target ? `bone ${s.target.bone}` : `group ${s.target.group}`} scaley ${s.closed} from ${s.window[0]}s to ${s.window[1]}s`),
|
|
9176
9191
|
idle_frames_closed: frames,
|
|
9192
|
+
...(windows.length > 1 ? { idle_frames_closed_per_blink: perBlink } : {}),
|
|
9177
9193
|
box_px: b.px,
|
|
9178
9194
|
hole_px: b.holePx,
|
|
9179
9195
|
hole_bar: BLINK_HOLE_BAR,
|
package/src/config.ts
CHANGED
|
@@ -1161,7 +1161,7 @@ export interface BlinkStill {
|
|
|
1161
1161
|
}
|
|
1162
1162
|
|
|
1163
1163
|
/**
|
|
1164
|
-
* The idle's
|
|
1164
|
+
* The idle's authored blinks. `eyes` names at least one bone; `brows` and
|
|
1165
1165
|
* `brow_drop` are stated together or not at all, and a stated `brows` names
|
|
1166
1166
|
* at least one bone — rigc refuses a group with no members, and a
|
|
1167
1167
|
* `brow_drop` with no brows is a value nothing reads. A figure with no eye
|
|
@@ -1169,6 +1169,8 @@ export interface BlinkStill {
|
|
|
1169
1169
|
*/
|
|
1170
1170
|
export interface Blink {
|
|
1171
1171
|
t: number;
|
|
1172
|
+
/** Further authored times, strictly increasing after t; omitted for one blink. */
|
|
1173
|
+
more?: number[];
|
|
1172
1174
|
eyes: string[];
|
|
1173
1175
|
brows?: string[];
|
|
1174
1176
|
squash: number;
|
|
@@ -4483,9 +4485,21 @@ function checkMotion(c: Check, v: Json, bones: Set<string>, chains: Map<string,
|
|
|
4483
4485
|
});
|
|
4484
4486
|
}
|
|
4485
4487
|
if ('blink' in m) {
|
|
4486
|
-
const b = c.object(`${p}.blink`, m.blink, ['t', 'eyes', 'squash'], ['brows', 'brow_drop', 'still']);
|
|
4488
|
+
const b = c.object(`${p}.blink`, m.blink, ['t', 'eyes', 'squash'], ['brows', 'brow_drop', 'still', 'more']);
|
|
4487
4489
|
if (b === null) return refuseSharedTargets(c, claims);
|
|
4488
4490
|
if ('t' in b) c.number(`${p}.blink.t`, b.t, 'non-negative');
|
|
4491
|
+
if ('more' in b) {
|
|
4492
|
+
if (!Array.isArray(b.more) || b.more.length === 0) {
|
|
4493
|
+
c.fail('CONFIG_BLINK_MORE_TIMES', `${p}.blink.more`, `is ${show(b.more)}; a non-empty list of finite times strictly increasing after t is required`);
|
|
4494
|
+
} else {
|
|
4495
|
+
Array.from(b.more).forEach((time, i) => {
|
|
4496
|
+
const previous = i === 0 ? b.t : (b.more as Json[])[i - 1];
|
|
4497
|
+
if (typeof time !== 'number' || !Number.isFinite(time) || typeof b.t !== 'number' || !(time > b.t) || typeof previous !== 'number' || !(time > previous)) {
|
|
4498
|
+
c.fail('CONFIG_BLINK_MORE_TIMES', `${p}.blink.more[${i}]`, `is ${show(time)}; a finite time greater than t (${show(b.t)}) and the preceding time (${show(previous)}) is required`);
|
|
4499
|
+
}
|
|
4500
|
+
});
|
|
4501
|
+
}
|
|
4502
|
+
}
|
|
4489
4503
|
if ('squash' in b) c.number(`${p}.blink.squash`, b.squash, 'positive');
|
|
4490
4504
|
if ('brow_drop' in b) c.number(`${p}.blink.brow_drop`, b.brow_drop);
|
|
4491
4505
|
if ('brows' in b && !('brow_drop' in b)) {
|
|
@@ -4529,7 +4543,19 @@ function checkMotion(c: Check, v: Json, bones: Set<string>, chains: Map<string,
|
|
|
4529
4543
|
}
|
|
4530
4544
|
}
|
|
4531
4545
|
}
|
|
4532
|
-
if ('still' in b)
|
|
4546
|
+
if ('still' in b) {
|
|
4547
|
+
const start = c.problems.length;
|
|
4548
|
+
checkBlinkStill(c, b.still, b.eyes, bones, regions);
|
|
4549
|
+
// All blinks use the same groups and cut-offs. Keep scalar diagnostics
|
|
4550
|
+
// unchanged; for multiple blinks name each entry owning a failed cut.
|
|
4551
|
+
if (Array.isArray(b.more) && b.more.length > 0) {
|
|
4552
|
+
const stillProblems = c.problems.splice(start);
|
|
4553
|
+
for (const problem of stillProblems) {
|
|
4554
|
+
if (problem.code !== 'CONFIG_STILL_OFF_THE_BLINK') { c.problems.push(problem); continue; }
|
|
4555
|
+
for (let i = 0; i <= b.more.length; i++) c.problems.push({ ...problem, object: `${problem.object} (${i === 0 ? `${p}.blink.t` : `${p}.blink.more[${i - 1}]`})` });
|
|
4556
|
+
}
|
|
4557
|
+
}
|
|
4558
|
+
}
|
|
4533
4559
|
}
|
|
4534
4560
|
refuseSharedTargets(c, claims);
|
|
4535
4561
|
}
|
package/src/instruments.ts
CHANGED
|
@@ -672,7 +672,7 @@ export interface BlinkTrack {
|
|
|
672
672
|
target: { bone: string } | { group: string };
|
|
673
673
|
/** The smallest `scaley` it keys — the closed eye. */
|
|
674
674
|
closed: number;
|
|
675
|
-
/**
|
|
675
|
+
/** One contiguous run of keys at that value, never spanning an open interval. */
|
|
676
676
|
window: [number, number];
|
|
677
677
|
}
|
|
678
678
|
|
|
@@ -712,8 +712,12 @@ export function blinkTracks(motion: Record<string, unknown>, eyes: ReadonlySet<s
|
|
|
712
712
|
if (target === null || keys === null || keys.length === 0) continue;
|
|
713
713
|
const closed = Math.min(...keys.map((k) => k.v[0]));
|
|
714
714
|
if (!(closed < keys[0].v[0])) continue;
|
|
715
|
-
|
|
716
|
-
|
|
715
|
+
for (let i = 0; i < keys.length; i++) {
|
|
716
|
+
if (keys[i].v[0] !== closed) continue;
|
|
717
|
+
const from = keys[i].t;
|
|
718
|
+
while (i + 1 < keys.length && keys[i + 1].v[0] === closed) i++;
|
|
719
|
+
out.push({ target, closed, window: [from, keys[i].t] });
|
|
720
|
+
}
|
|
717
721
|
}
|
|
718
722
|
return out;
|
|
719
723
|
}
|
package/src/motion.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The idle: every channel a sine,
|
|
2
|
+
* The idle: every channel a sine, authored blinks, and the control bones that move
|
|
3
3
|
* idle keys off the bones a mesh is weighted to.
|
|
4
4
|
*
|
|
5
5
|
* ## Sines
|
|
@@ -211,38 +211,35 @@ export function idleMotion(cfg: CharacterConfig, chains: ReadonlyMap<string, str
|
|
|
211
211
|
const groups: Record<string, string[]> = {};
|
|
212
212
|
const bl = mc.blink;
|
|
213
213
|
if (bl !== undefined) {
|
|
214
|
-
const tb = bl.t;
|
|
215
214
|
groups.eyes = [...bl.eyes];
|
|
216
|
-
// A blink without brows (no eyebrow part) writes no brows group: rigc
|
|
217
|
-
// refuses a group with no members, and the loader refuses an empty one.
|
|
218
215
|
if (bl.brows !== undefined) groups.brows = [...bl.brows];
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
216
|
+
const eyeKeys: MotionKey[] = [{ t: 0, v: [1] }];
|
|
217
|
+
const browKeys: MotionKey[] = [{ t: 0, v: [0] }];
|
|
218
|
+
// Config order is time order. Each key is computed from its authored
|
|
219
|
+
// start, never from a preceding blink or an accumulated time delta.
|
|
220
|
+
for (const tb of blinkTimes(bl)) {
|
|
221
|
+
const at = (dt: number): number => pyRound(tb + dt, 6);
|
|
222
|
+
eyeKeys.push(
|
|
225
223
|
{ t: tb, v: [1], ease: 'shut' },
|
|
226
224
|
{ t: at(BLINK.shut), v: [bl.squash] },
|
|
227
225
|
{ t: at(BLINK.shut + BLINK.hold), v: [bl.squash], ease: 'open' },
|
|
228
226
|
{ t: at(BLINK.shut + BLINK.hold + BLINK.open), v: [1] },
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if (bl.brows !== undefined && drop !== undefined) {
|
|
234
|
-
tracks.push({
|
|
235
|
-
group: 'brows',
|
|
236
|
-
property: 'translatey',
|
|
237
|
-
keys: [
|
|
238
|
-
{ t: 0, v: [0] },
|
|
227
|
+
);
|
|
228
|
+
const drop = bl.brow_drop;
|
|
229
|
+
if (bl.brows !== undefined && drop !== undefined) {
|
|
230
|
+
browKeys.push(
|
|
239
231
|
{ t: tb, v: [0], ease: 'shut' },
|
|
240
232
|
{ t: at(BLINK.browShut), v: [-drop] },
|
|
241
233
|
{ t: at(BLINK.browShut + BLINK.browHold), v: [-drop], ease: 'open' },
|
|
242
234
|
{ t: at(BLINK.browShut + BLINK.browHold + BLINK.browOpen), v: [0] },
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
eyeKeys.push({ t: T, v: [1] });
|
|
239
|
+
tracks.push({ group: 'eyes', property: 'scaley', keys: eyeKeys });
|
|
240
|
+
if (bl.brows !== undefined && bl.brow_drop !== undefined) {
|
|
241
|
+
browKeys.push({ t: T, v: [0] });
|
|
242
|
+
tracks.push({ group: 'brows', property: 'translatey', keys: browKeys });
|
|
246
243
|
}
|
|
247
244
|
}
|
|
248
245
|
const name = `${cfg.key}_painting`;
|
|
@@ -252,7 +249,7 @@ export function idleMotion(cfg: CharacterConfig, chains: ReadonlyMap<string, str
|
|
|
252
249
|
cut: name,
|
|
253
250
|
easings: { shut: [...EASINGS.shut], open: [...EASINGS.open] },
|
|
254
251
|
groups,
|
|
255
|
-
animations: { idle: { duration: T, loop: true, note: IDLE_NOTE, tracks } },
|
|
252
|
+
animations: { idle: { duration: T, loop: true, note: bl?.more === undefined ? IDLE_NOTE : IDLE_NOTE.replace('one blink', 'authored blinks'), tracks } },
|
|
256
253
|
};
|
|
257
254
|
}
|
|
258
255
|
|
|
@@ -317,6 +314,11 @@ const HOLD_MISSES = new Map<string, Readonly<HoldMisses>>();
|
|
|
317
314
|
/** The last time any blink key sits at before the closing key, in seconds after `blink.t`, for a blink with brows. */
|
|
318
315
|
export const BLINK_SPAN = Math.max(BLINK.shut + BLINK.hold + BLINK.open, BLINK.browShut + BLINK.browHold + BLINK.browOpen);
|
|
319
316
|
|
|
317
|
+
/** Authored order, validated by the config reader; the scalar stays scalar on disk. */
|
|
318
|
+
export function blinkTimes(bl: { t: number; more?: readonly number[] }): number[] {
|
|
319
|
+
return [bl.t, ...(bl.more ?? [])];
|
|
320
|
+
}
|
|
321
|
+
|
|
320
322
|
/** {@link BLINK_SPAN} for this blink: without brows, only the eyes' keys have to fit inside the idle. */
|
|
321
323
|
export function blinkSpan(bl: { brows?: readonly string[] }): number {
|
|
322
324
|
return bl.brows === undefined ? BLINK.shut + BLINK.hold + BLINK.open : BLINK_SPAN;
|
package/src/rig.ts
CHANGED
|
@@ -177,7 +177,7 @@ import { skeletonLimbJoints } from './limbs.ts';
|
|
|
177
177
|
import { coalesceLimbSlots } from './limbslots.ts';
|
|
178
178
|
import { layoutAlias, placeLimbLayouts, type LayoutPlan } from './limblayout.ts';
|
|
179
179
|
import { artCoverage, ART_ALPHA, latticeCells, latticeMesh, latticeStray, ONE_LOOP_PASSES, type LatticeMesh } from './mesh.ts';
|
|
180
|
-
import { bindFaceSurfaceDeform, BLINK, blinkHoldMisses, blinkSpan, CONTROL_SUFFIX, controlledBones, IDLE_FPS, idleMotion, type MotionSpec, moveKeysToControls } from './motion.ts';
|
|
180
|
+
import { bindFaceSurfaceDeform, BLINK, blinkHoldMisses, blinkSpan, blinkTimes, CONTROL_SUFFIX, controlledBones, IDLE_FPS, idleMotion, type MotionSpec, moveKeysToControls } from './motion.ts';
|
|
181
181
|
import { type PartRecord, type AlternateSetMap, FRONT_SUFFIX, PAINTING_RUN, type PartsFile, readFrom, tagOf } from './parts.ts';
|
|
182
182
|
import { waistPairs, waistBand, waistInfluences } from './waist.ts';
|
|
183
183
|
import { preserveWaistRest, refineWaistMesh, remapWaistDeforms, storedWorld, waistBottomMesh, waistBottomLayoutOf, type WaistMapping } from './waistmesh.ts';
|
|
@@ -1602,27 +1602,38 @@ export function buildWaistPairSource(
|
|
|
1602
1602
|
// ---- motion ------------------------------------------------------------
|
|
1603
1603
|
const bl = cfg.motion.blink;
|
|
1604
1604
|
const span = bl === undefined ? 0 : blinkSpan(bl);
|
|
1605
|
-
if (bl !== undefined
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
'config.motion.blink.t'
|
|
1609
|
-
|
|
1610
|
-
|
|
1605
|
+
if (bl !== undefined) {
|
|
1606
|
+
const times = blinkTimes(bl);
|
|
1607
|
+
times.forEach((time, i) => {
|
|
1608
|
+
const at = i === 0 ? 'config.motion.blink.t' : `config.motion.blink.more[${i - 1}]`;
|
|
1609
|
+
if (!(time > 0 && Math.max(time + span, pyRound(time + span, 6)) < cfg.motion.duration)) {
|
|
1610
|
+
fail('RIG_BLINK_INSIDE_IDLE', at,
|
|
1611
|
+
`is ${time} s; the blink's keys run from t to t + ${pyRound(span, 6)} s between the idle's first key at 0 and its last at ${cfg.motion.duration} s, so 0 < t < ${pyRound(cfg.motion.duration - span, 6)} is required`);
|
|
1612
|
+
}
|
|
1613
|
+
if (i > 0 && time <= Math.max(times[i - 1] + span, pyRound(times[i - 1] + span, 6))) {
|
|
1614
|
+
fail('RIG_BLINK_WINDOWS_DISJOINT', at,
|
|
1615
|
+
`starts at ${time} s; the preceding blink ends at ${pyRound(times[i - 1] + span, 6)} s, so a later start is required to keep the blink windows disjoint`);
|
|
1616
|
+
}
|
|
1617
|
+
problems.push(...blinkHoldProblems(BLINK.shut, BLINK.hold, IDLE_FPS).map(p => bl.more === undefined ? p : { ...p, object: `${at}: ${p.object}` }));
|
|
1618
|
+
});
|
|
1611
1619
|
}
|
|
1612
|
-
if (bl !== undefined) problems.push(...blinkHoldProblems(BLINK.shut, BLINK.hold, IDLE_FPS));
|
|
1613
1620
|
// ---- blink.still: a blinking region cut at a row ----------------------
|
|
1614
1621
|
const stills = bl?.still ?? {};
|
|
1615
1622
|
const partNames = new Map(parts.parts.map((p) => [foldName(p.name), p.name]));
|
|
1623
|
+
const stillFail = (code: string, object: string, detail: string): void => {
|
|
1624
|
+
if (bl?.more === undefined) { fail(code, object, detail); return; }
|
|
1625
|
+
blinkTimes(bl).forEach((_, i) => fail(code, `${object} (${i === 0 ? 'config.motion.blink.t' : `config.motion.blink.more[${i - 1}]`})`, detail));
|
|
1626
|
+
};
|
|
1616
1627
|
for (const [part, st] of Object.entries(stills)) {
|
|
1617
1628
|
const at = `config.motion.blink.still.${part}`;
|
|
1618
1629
|
const p = byPart.get(part);
|
|
1619
|
-
if (!(part in cfg.regions))
|
|
1620
|
-
if (!B.has(st.bone))
|
|
1630
|
+
if (!(part in cfg.regions)) stillFail('RIG_NAME_RESOLVES', at, `names "${part}", which config.regions does not attach; a region part is required`);
|
|
1631
|
+
if (!B.has(st.bone)) stillFail('RIG_NAME_RESOLVES', `${at}.bone`, `names the bone "${st.bone}", which config.bones does not declare`);
|
|
1621
1632
|
if (p === undefined) continue;
|
|
1622
1633
|
const still = `${part}${STILL_SUFFIX}`;
|
|
1623
|
-
if (partNames.has(foldName(still)))
|
|
1634
|
+
if (partNames.has(foldName(still))) stillFail('RIG_STILL_NAME_FREE', at, `the still piece is drawn by the slot "${still}" ("${still}.png"), and parts.json already holds part "${partNames.get(foldName(still))}" ("${partNames.get(foldName(still))}.png"); rename that part`);
|
|
1624
1635
|
if (!(st.row > p.y && st.row < p.y + p.h)) {
|
|
1625
|
-
|
|
1636
|
+
stillFail('RIG_STILL_ROW_INSIDE_PART', `${at}.row`, `is ${st.row}; "${part}" spans rows ${p.y}..${p.y + p.h - 1}, so a row with part rows on both sides, ${p.y + 1}..${p.y + p.h - 1}, is required`);
|
|
1626
1637
|
continue;
|
|
1627
1638
|
}
|
|
1628
1639
|
const img = images.get(part);
|
|
@@ -1631,7 +1642,7 @@ export function buildWaistPairSource(
|
|
|
1631
1642
|
const crossing: number[] = [];
|
|
1632
1643
|
for (let x = 0; x < img.width; x++) if (img.data[(r * img.width + x) * 4 + 3] > 0) crossing.push(x);
|
|
1633
1644
|
if (crossing.length > 0) {
|
|
1634
|
-
|
|
1645
|
+
stillFail(
|
|
1635
1646
|
'RIG_STILL_ROW_CLEAR',
|
|
1636
1647
|
`${at}.row`,
|
|
1637
1648
|
`is ${st.row}, and "${part}" has ${crossing.length} pixel(s) with alpha above 0 on that row (the first at x = ${p.x + crossing[0]}); a row with no art across the part's whole width is required — two pieces cut through art are each resampled against their own transparent edge, so the render changes at rest, not only while the eye moves`,
|
|
@@ -1641,7 +1652,7 @@ export function buildWaistPairSource(
|
|
|
1641
1652
|
const artAbove = alphaCount(img, 0, r);
|
|
1642
1653
|
const artBelow = alphaCount(img, r, img.height);
|
|
1643
1654
|
if (artAbove === 0 || artBelow === 0) {
|
|
1644
|
-
|
|
1655
|
+
stillFail('RIG_STILL_PIECES_HAVE_ART', `${at}.row`, `is ${st.row}; "${part}" has ${artAbove} art pixel(s) above it and ${artBelow} below; both pieces need art, or the cut holds nothing still (or nothing blinks)`);
|
|
1645
1656
|
}
|
|
1646
1657
|
}
|
|
1647
1658
|
refuseIfAny(problems);
|