rig-parts 2.55.0 → 2.56.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 +45 -68
- package/docs/AUTHORING.md +101 -9
- package/docs/MIGRATION.md +2 -2
- package/docs/PAINTING.md +1 -1
- package/docs/STABILITY.md +7 -7
- package/package.json +1 -1
- package/src/scene.ts +112 -25
- package/src/sceneclips.ts +83 -2
- package/src/scenerepeat.ts +111 -0
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ from it by max 1 level, 0 px over 40 (<code>--lead-in</code>). Frame 29 (2.417 s
|
|
|
64
64
|
closed eye: the blink holds for 0.084 s, one 12 fps frame rounded up; the painting is
|
|
65
65
|
shown at half size, resampled and written by this package's PNG codec (nothing here
|
|
66
66
|
encodes JPEG). <code>rig-parts sheet</code> made the contact sheet. Its
|
|
67
|
-
<code>expected/</code> is this port's own build (<a href="examples/demo/README.md">examples/demo</a>).
|
|
67
|
+
<code>expected/</code> is this port's own build (<a href="https://github.com/rig-c/parts/blob/main/examples/demo/README.md">examples/demo</a>).
|
|
68
68
|
</em></p>
|
|
69
69
|
|
|
70
70
|
<p align="center"><em>
|
|
@@ -74,7 +74,7 @@ with its proposal used unedited — the only hand corrections are four
|
|
|
74
74
|
<code>assemble.patches</code>, each answering an <code>uncovered hole</code> line.
|
|
75
75
|
<code>check</code> passes 9 of 9 with every mesh on the lattice and with every mesh
|
|
76
76
|
switched to the contour mode. It has no reference output: its <code>expected/</code>
|
|
77
|
-
is this port's own build (<a href="examples/scarf/README.md">examples/scarf</a>).
|
|
77
|
+
is this port's own build (<a href="https://github.com/rig-c/parts/blob/main/examples/scarf/README.md">examples/scarf</a>).
|
|
78
78
|
</em></p>
|
|
79
79
|
|
|
80
80
|
<p align="center"><em>
|
|
@@ -86,6 +86,11 @@ until issue #227, which took the clasped-hands painting off display). Their
|
|
|
86
86
|
this port to.
|
|
87
87
|
</em></p>
|
|
88
88
|
|
|
89
|
+
One rig can also carry **alternate drawings** as named sets — an outfit swap, or
|
|
90
|
+
mouth shapes (visemes) for speech — cut from extra paintings you supply, and the
|
|
91
|
+
player switches a set by name: see `assemble.alternates` in
|
|
92
|
+
[AUTHORING §3](docs/AUTHORING.md#3-configjson-field-by-field).
|
|
93
|
+
|
|
89
94
|
## What it takes in
|
|
90
95
|
|
|
91
96
|
- **One painting** — a PNG of one character that a rig can be cut from: front view,
|
|
@@ -126,6 +131,10 @@ page** (issue #2):
|
|
|
126
131
|
| `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) |
|
|
127
132
|
| `idle.png`, `idle-indexed.png`, `idle.gif` | with `--loop`: the idle as a lossless APNG (the exactness record), an indexed APNG with one shared palette (the small one) and a GIF; the last two print their palette error |
|
|
128
133
|
|
|
134
|
+
Beside the skeleton data rig-c writes `check/build/skeleton.model.json`, the compiled
|
|
135
|
+
model document. [@rig-c/play](https://github.com/rig-c/play) loads that file and
|
|
136
|
+
draws the rig in a browser, as plain DOM elements or on one canvas.
|
|
137
|
+
|
|
129
138
|
The last lines of a green build are the pack line, printed beside the Spine example
|
|
130
139
|
export's `spineboy.png` as a yardstick (a reference, not a bar), and the three
|
|
131
140
|
artifact paths — here for `examples/reference-sample`:
|
|
@@ -168,11 +177,13 @@ atlas written by anything else would have no oracle behind it.
|
|
|
168
177
|
| --- | --- | --- |
|
|
169
178
|
| 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 |
|
|
170
179
|
| specs → Spine skeleton data | **[@rig-c/core](https://github.com/rig-c/core)** (npm dependency `@rig-c/core`) | 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 |
|
|
171
|
-
|
|
|
180
|
+
| compiled model → a page | **[rig-play](https://github.com/rig-c/play)** (npm `@rig-c/play`; formerly spine-html), a sibling project | the browser player: it loads the compiled model document and draws it as DOM elements or on one canvas; rigc's `rig-play` profile is its policy, and every build here is gated under that profile as well as under `spine` |
|
|
172
181
|
|
|
173
182
|
rig-parts never writes Spine data itself. Everything on disk under `check/build/`
|
|
174
183
|
was written by rig-c after its own gate passed.
|
|
175
184
|
|
|
185
|
+
Next stops: [@rig-c/review](https://github.com/rig-c/review) is where a person looks at a build and answers, and [@rig-c/create](https://github.com/rig-c/create) drives the whole cycle with an agent.
|
|
186
|
+
|
|
176
187
|
## Getting See-through layers
|
|
177
188
|
|
|
178
189
|
See-through is required; how you run it is not. rig-parts does not vendor, embed or
|
|
@@ -215,7 +226,7 @@ box at its exact size (`st_input_head.png`). Pure raster, no GPU.
|
|
|
215
226
|
### The optional ComfyUI adapter
|
|
216
227
|
|
|
217
228
|
For a user who has a ComfyUI box, two
|
|
218
|
-
commands
|
|
229
|
+
commands make the painting and the layers on it; nothing else in the pipeline needs one:
|
|
219
230
|
|
|
220
231
|
```sh
|
|
221
232
|
rig-parts comfy paint --config config.json --out <dir> --host http://<box>:8188
|
|
@@ -290,25 +301,8 @@ rig-parts build --config config.json --source painting.png --full layers/full --
|
|
|
290
301
|
|
|
291
302
|
At each step the config holds only what that step reads; the one table of what
|
|
292
303
|
that is, step by step, is [docs/AUTHORING.md §4](docs/AUTHORING.md#4-the-command-order).
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
`--write-config` forms below save the proposed fields; `RL01` does not exercise
|
|
296
|
-
that flag. On `demo` the
|
|
297
|
-
proposal pasted uncorrected stops at the last step, naming its `bottomwear` on
|
|
298
|
-
`CHECK_TIP_OVER_ROOT` — the correction its tracked config records there, the two outer
|
|
299
|
-
skirt chains moved (issue #227, [its README](examples/demo/README.md)); on `scarf`,
|
|
300
|
-
since issue #262, it builds green, and on `wind` too. `wind`'s config declares the cloth
|
|
301
|
-
recipe and its limbs, so the block runs on it again with that `cloth` block authored,
|
|
302
|
-
`--cloth config.json` on the drafting `propose` line and its tracked `keypoints.json` on both
|
|
303
|
-
`propose --parts` lines (`RL05`): it pastes `limbs` and `constraints` with the rest and gives
|
|
304
|
-
back the tracked config, section for section ([its README](examples/wind/README.md)).
|
|
305
|
-
On `demo`, which tracks the pose file it was painted on, the block runs again with
|
|
306
|
-
`--keypoints` on both `propose --parts` lines (`RL03`): the proposal then also drafts
|
|
307
|
-
`limbs`, the step's list carries them, and the run ends where `RL01` ends. The joints
|
|
308
|
-
are that pose file scaled to the painting, not read off it, so this shows what the
|
|
309
|
-
loop carries, not where the joints are. On `wind`, which tracks the joints read off its
|
|
310
|
-
painting (`keypoints.json`), `RL03` runs with those. The list as it stood before issue #375, four
|
|
311
|
-
sections, stops at `--from-config` naming every limb part (`RL04`).
|
|
304
|
+
How the selftest runs this block on each example is in
|
|
305
|
+
[CONTRIBUTING.md](https://github.com/rig-c/parts/blob/main/CONTRIBUTING.md#the-readme-loop-as-the-selftest-runs-it).
|
|
312
306
|
|
|
313
307
|
`propose` is deliberately not a step of `build`: the proposal is a draft to correct
|
|
314
308
|
against its overlay, and a config with bones is `build`'s input. `rig`, `check` and
|
|
@@ -325,11 +319,17 @@ Command details and config saving are in the [command reference](docs/AUTHORING.
|
|
|
325
319
|
| command | does |
|
|
326
320
|
| --- | --- |
|
|
327
321
|
| `inputs` | [Prepare the two See-through input images](docs/AUTHORING.md#command-reference) |
|
|
328
|
-
| `comfy` | [Drive
|
|
322
|
+
| `comfy` | [Drive optional ComfyUI jobs: painting, layers, matte and plate](docs/AUTHORING.md#command-reference) |
|
|
329
323
|
| `layers` | [Inspect wrapper layers or a PSD](docs/AUTHORING.md#command-reference) |
|
|
324
|
+
| `head-crop-preflight` | [Report what a head box would clip, before the head run](docs/AUTHORING.md#command-reference) |
|
|
330
325
|
| `sheet` | [Make a contact sheet](docs/AUTHORING.md#command-reference) |
|
|
331
326
|
| `assemble` | [Merge layers into measured parts](docs/AUTHORING.md#command-reference) |
|
|
327
|
+
| `check-parts` | [Check assembled parts' integrity and write a report](docs/AUTHORING.md#check-parts) |
|
|
328
|
+
| `diff-components` | [List every place the stacked parts differ from the painting](docs/AUTHORING.md#whole-figure-difference-inventory) |
|
|
332
329
|
| `diff-drafts` | [Compare two assemble outputs](docs/AUTHORING.md#command-reference) |
|
|
330
|
+
| `depth-prepare` | [Write one depth-model input image per part](docs/DEPTH.md#1-prepare-one-inference-image-per-part) |
|
|
331
|
+
| `depth-bind` | [Bind a depth map to its prepared input](docs/DEPTH.md#3-bind-every-map-to-its-prepared-input) |
|
|
332
|
+
| `depth-apply` | [Apply depth maps to the parts as depth sheets](docs/DEPTH.md#4-apply-the-maps-as-depth-sheets) |
|
|
333
333
|
| `edited-part` | [Record an edited part receipt](docs/AUTHORING.md#edited-rig-space-parts-assembleedited_parts-issue-1278) |
|
|
334
334
|
| `external-receipt` | [Record or verify an external mask](docs/AUTHORING.md#external-mask-receipt) |
|
|
335
335
|
| `propose` | [Draft or inspect a character config](docs/AUTHORING.md#command-reference) |
|
|
@@ -347,6 +347,14 @@ Command details and config saving are in the [command reference](docs/AUTHORING.
|
|
|
347
347
|
| `retune` | [Revise constraints and idle in a gated rig](docs/AUTHORING.md#command-reference) |
|
|
348
348
|
| `guide` | [Read the installed authoring reference](docs/AUTHORING.md#command-reference) |
|
|
349
349
|
|
|
350
|
+
## Depth-driven rigging
|
|
351
|
+
|
|
352
|
+
[docs/DEPTH.md](docs/DEPTH.md) is the feature page for a person: what a depth-driven turn gives you, the two stages that make the sheets, how to pick a painting and how to judge the result.
|
|
353
|
+
See the [depth-driven rigging reference](docs/AUTHORING.md#depth-driven-rigging) for sampled head and body turns and unit-depth precedence.
|
|
354
|
+
|
|
355
|
+
### Per-layer depth input
|
|
356
|
+
|
|
357
|
+
See the [per-layer depth input contract](docs/AUTHORING.md#per-layer-depth-input) for opt-in sheets, calibration and their consumers.
|
|
350
358
|
|
|
351
359
|
## What it does not do
|
|
352
360
|
|
|
@@ -359,10 +367,13 @@ These are limits of the approach, stated so nobody reads more into a green run:
|
|
|
359
367
|
sheets, consumed by the shipped 2.5D head-turn producer through [config.turn.roles](docs/AUTHORING.md#3-configjson-field-by-field). A layer that is in front of another in one place and behind it in another is drawn
|
|
360
368
|
right in the still (the painting's own pixels are projected onto it) and wrong once
|
|
361
369
|
it moves.
|
|
362
|
-
- **No expression
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
370
|
+
- **No expression axis, no lip-sync from audio, and no jiggle.** The base rig's mouth is
|
|
371
|
+
one layer. Mouth shapes exist only as alternate sets you paint and declare
|
|
372
|
+
(`assemble.alternates`, [AUTHORING §3](docs/AUTHORING.md#3-configjson-field-by-field)),
|
|
373
|
+
switched by name or keyed by hand in a named animation; nothing here draws them or
|
|
374
|
+
reads speech, and nothing here proposes, keys or judges a soft region. An expression
|
|
375
|
+
that moves the face's parts, and a jiggle, can be built on the rig it writes
|
|
376
|
+
([below](#what-can-be-built-on-top)).
|
|
366
377
|
- **Occluded pixels are See-through's synthesis**, not the artist's. How much of a rig
|
|
367
378
|
that is, is below.
|
|
368
379
|
- **No success rate is claimed.** Ten characters have been measured stage by stage
|
|
@@ -408,9 +419,9 @@ for each — a config fragment, the `check` lines it passes with, and its limit:
|
|
|
408
419
|
named by `motion.animations_from` are built and gated beside the idle on every build. Keys
|
|
409
420
|
carry core motion fields, including raw `curve` control points in absolute time/value
|
|
410
421
|
coordinates ([core key format](https://github.com/rig-c/core/blob/main/docs/AUTHORING.md#45-keys--times-values-curves));
|
|
411
|
-
the linked recipe includes a core-gated example.
|
|
412
|
-
|
|
413
|
-
|
|
422
|
+
the linked recipe includes a core-gated example. Without
|
|
423
|
+
an alternate set a slot holds one image, so a part moves, turns and scales but is not
|
|
424
|
+
swapped for another; `check` measures the idle alone.
|
|
414
425
|
- [**A soft region driven by physics**](docs/AUTHORING.md#recipe-a-soft-region-driven-by-physics)
|
|
415
426
|
(a bust, the hips): a bone the config authors, a contour-mode region that hands it the patch,
|
|
416
427
|
and a `physics` constraint on it; `examples/reference-sample` carries one. Under its slow
|
|
@@ -467,7 +478,7 @@ beside `rig-parts` for the transition, the same launcher under both names. On np
|
|
|
467
478
|
both compatibility names stay published beside `@rig-c/parts` at every version, as aliases
|
|
468
479
|
carrying the same files with only the `name` in `package.json` changed, so a
|
|
469
480
|
project that depends on either keeps receiving every release; a new
|
|
470
|
-
install names `@rig-c/parts` ([RELEASING.md](RELEASING.md), *The registry side*). `@rig-c/core`
|
|
481
|
+
install names `@rig-c/parts` ([RELEASING.md](https://github.com/rig-c/parts/blob/main/RELEASING.md), *The registry side*). `@rig-c/core`
|
|
471
482
|
comes with it as a dependency, providing the `rigc` command. No Spine runtime does: since
|
|
472
483
|
rig-c 2.0 the installed `rigc` gates every build with its own validator over the
|
|
473
484
|
compiled model document, and `rigc --version` says `entry: cli_core.ts —
|
|
@@ -481,42 +492,8 @@ MIT; see [NOTICE.md](NOTICE.md) for third-party terms and the Spine runtime lice
|
|
|
481
492
|
|
|
482
493
|
## Development
|
|
483
494
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
bun run typecheck # tsc --noEmit, strict
|
|
487
|
-
bun run lint # one rule: no explicit any
|
|
488
|
-
bun run fetch-examples # the public examples' paintings and layers, into examples/*/inputs (needs a network); each file held to its blob id at the pinned commit, a stale one replaced by name
|
|
489
|
-
bun run selftest # every gate's controls; with the examples fetched, build on each of them against its expected/
|
|
490
|
-
bun run selftest -- --summary-json summary.json # also write rig-selftest-summary/1 (per-suite PASS/FAIL/SKIP counts, holes, partial flag and exit)
|
|
491
|
-
bun run smoke # pack, install into an empty directory, run from the install (needs a network)
|
|
492
|
-
```
|
|
493
|
-
|
|
494
|
-
`bun run selftest -- --summary-json <file>` writes a machine-readable summary (`spec: "rig-selftest-summary/1"`, `tool: "rig-parts"`) derived from the same `RunTally` that prints the console summary: `exit` (`0 | 1 | 2`), `partial` (`boolean`), `only` (`string[] | null`), `faults`, `totals` (`suites`, `ran`, `skipped_suites`, `controls`, `passed`, `failed`, `skipped`, `holes`), per-suite `suites` entries (`suite`, `ran`, `controls`, `passed`, `failed`, `skipped`, `status`, `reason`), `skips` (`{ suite, name, reason, hole }`), and `holes` (`{ suite, name, reason }`). See [AUTHORING §8](docs/AUTHORING.md#machine-readable-selftest-summary---summary-json-issue-725) for the full shape.
|
|
495
|
-
|
|
496
|
-
The generated `foot-ownership` suite can be run alone with
|
|
497
|
-
`bun run selftest -- --only foot-ownership` (exit 2 means a green partial run,
|
|
498
|
-
not a full-tree verdict). Issue #638's revised acceptance requires zero foreign-leg
|
|
499
|
-
components and reports historical own-cap components separately; it was changed
|
|
500
|
-
after measurement, and the historical case did not pass the original second-island
|
|
501
|
-
1% bar. Issue #637 additionally preserves assigned own-cap connections under covers:
|
|
502
|
-
the generated default is now one connected component, retaining the historical
|
|
503
|
-
own-cap pixels and their bridge. The controls require both historical measurements
|
|
504
|
-
and current connected ownership, with no foreign-leg pixels.
|
|
505
|
-
[AUTHORING's limb section](docs/AUTHORING.md#limbs-cut-at-their-joints-limbs-issue-349)
|
|
506
|
-
records the generated default-cap case and its preservation controls.
|
|
507
|
-
|
|
508
|
-
[CLAUDE.md](CLAUDE.md) is the doctrine, [CONTRIBUTING.md](CONTRIBUTING.md) the
|
|
509
|
-
practice, [RELEASING.md](RELEASING.md) the cut, [docs/STABILITY.md](docs/STABILITY.md)
|
|
510
|
-
the interface it holds.
|
|
511
|
-
|
|
512
|
-
## Depth-driven rigging
|
|
513
|
-
|
|
514
|
-
[docs/DEPTH.md](docs/DEPTH.md) is the feature page for a person: what a depth-driven turn gives you, the two stages that make the sheets, how to pick a painting and how to judge the result.
|
|
515
|
-
See the [depth-driven rigging reference](docs/AUTHORING.md#depth-driven-rigging) for sampled head and body turns and unit-depth precedence.
|
|
516
|
-
|
|
517
|
-
### Per-layer depth input
|
|
518
|
-
|
|
519
|
-
See the [per-layer depth input contract](docs/AUTHORING.md#per-layer-depth-input) for opt-in sheets, calibration and their consumers.
|
|
495
|
+
`bun install`, then `bun run typecheck`, `bun run lint` and `bun run selftest`.
|
|
496
|
+
[CONTRIBUTING.md](https://github.com/rig-c/parts/blob/main/CONTRIBUTING.md) has every command and what a change has to clear; [CLAUDE.md](https://github.com/rig-c/parts/blob/main/CLAUDE.md) is the doctrine, [RELEASING.md](https://github.com/rig-c/parts/blob/main/RELEASING.md) the cut, [docs/STABILITY.md](docs/STABILITY.md) the interface it holds.
|
|
520
497
|
|
|
521
498
|
## Licence
|
|
522
499
|
|
package/docs/AUTHORING.md
CHANGED
|
@@ -23,14 +23,14 @@ A path this page names that the installed package does not hold — anything und
|
|
|
23
23
|
`bun run` names — is in the repository, https://github.com/rig-c/parts; the package holds the files
|
|
24
24
|
`package.json` lists under `files` (`npm pack --dry-run` prints them).
|
|
25
25
|
|
|
26
|
-
For repository changes, run `bun run selftest:pre` on an ordinary
|
|
26
|
+
For repository changes, run `bun run selftest:pre` on an ordinary slot of the remote job pool,
|
|
27
27
|
beside the change's targeted suites (or add them with
|
|
28
28
|
`bun run selftest:pre -- --only rig,propose`). Its fixed minimum forms are demo's
|
|
29
29
|
AE02, TY12/TY16, one demo build with CH04/CH05 goldens, and declaration ownership
|
|
30
30
|
plus RT14, accounting and the family-memory check. It uses one worker and needs
|
|
31
31
|
demo's pinned inputs. Missing inputs, SKIPs and HOLEs cannot pass. Its result
|
|
32
32
|
covers those forms only: **the full forms and full-tree verdict belong to PR CI**.
|
|
33
|
-
[CONTRIBUTING](
|
|
33
|
+
[CONTRIBUTING](https://github.com/rig-c/parts/blob/main/CONTRIBUTING.md#before-you-open-a-pull-request) records their
|
|
34
34
|
historical derivation, the selected forms and the separate pre/ordinary-PARTIAL
|
|
35
35
|
exit contracts.
|
|
36
36
|
|
|
@@ -1538,6 +1538,71 @@ and no byte moves; a build that passes under it writes the same bytes as
|
|
|
1538
1538
|
without it. Of the public examples, every config holds no drawn shape except
|
|
1539
1539
|
`scarf`, whose four patches `trace_parts` would refuse.
|
|
1540
1540
|
|
|
1541
|
+
### Outfit alternates
|
|
1542
|
+
|
|
1543
|
+
Keep the base rig config and add an entry to `assemble.alternates` for the
|
|
1544
|
+
second painting. Use a painting on the base canvas and a full run containing
|
|
1545
|
+
the layers for the changed parts. Reuse the base head run if the selected head
|
|
1546
|
+
art is unchanged. In this example the outfit replaces three clothing pieces
|
|
1547
|
+
and both arm segments and hides the base hairpin.
|
|
1548
|
+
|
|
1549
|
+
```json
|
|
1550
|
+
{
|
|
1551
|
+
"name": "outfit_b",
|
|
1552
|
+
"source": "painting_b.png",
|
|
1553
|
+
"full": "full_b",
|
|
1554
|
+
"head": "head",
|
|
1555
|
+
"parts": ["topwear", "bottomwear", "shoes", "upperarm_r", "forearm_r"],
|
|
1556
|
+
"hides": ["hairpin"]
|
|
1557
|
+
}
|
|
1558
|
+
```
|
|
1559
|
+
|
|
1560
|
+
Use the existing limb joints when the painting has the same arm pose. The
|
|
1561
|
+
`assemble.alternates` field above describes `drawn` and `skeleton` for a
|
|
1562
|
+
different painted pose. Build with the base `--source`, `--full`, and
|
|
1563
|
+
`--head` inputs and use `--all-sets` to check each alternate in its setup pose.
|
|
1564
|
+
Use `check --set outfit_b` to inspect this outfit on its own.
|
|
1565
|
+
|
|
1566
|
+
For sleeves and overgarments, check the layer that feeds the limb cut.
|
|
1567
|
+
|
|
1568
|
+
- List every segment of a replaced limb in `parts`. Partial coverage or hiding
|
|
1569
|
+
a limb segment is refused by [`CONFIG_LIMB_SET_JOINTS`](#CONFIG_LIMB_SET_JOINTS).
|
|
1570
|
+
If the arm should keep its base art, omit all its segments from both
|
|
1571
|
+
`parts` and `hides`.
|
|
1572
|
+
- If a sleeve should move with the arm, its layer must carry both segments
|
|
1573
|
+
and cover the elbow cut. A speck removed as ghost pixels can trigger
|
|
1574
|
+
[`ASSEMBLE_PART_OPAQUE`](#ASSEMBLE_PART_OPAQUE). A wrist-only layer can
|
|
1575
|
+
leave the upper segment empty
|
|
1576
|
+
([`ASSEMBLE_LIMB_PIXELS`](#ASSEMBLE_LIMB_PIXELS)). A gap at the elbow leaves
|
|
1577
|
+
the joint without art
|
|
1578
|
+
([`ASSEMBLE_LIMB_JOINT_ON_ART`](#ASSEMBLE_LIMB_JOINT_ON_ART)).
|
|
1579
|
+
[Alternate part layers](#alternate-part-layers-assemblealternatesilayers-issue-666)
|
|
1580
|
+
shows how to select a corrected sleeve layer.
|
|
1581
|
+
- A required layer missing from the alternate run triggers
|
|
1582
|
+
[`ASSEMBLE_ALT_INPUT_PRESENT`](#ASSEMBLE_ALT_INPUT_PRESENT). An alternate
|
|
1583
|
+
painting with different canvas dimensions triggers
|
|
1584
|
+
[`ASSEMBLE_ALT_CANVAS_SIZE`](#ASSEMBLE_ALT_CANVAS_SIZE).
|
|
1585
|
+
|
|
1586
|
+
An outfit and a mouth viseme can share the build. In the synthetic outfit
|
|
1587
|
+
fixture, the outfit and the `a` viseme bind disjoint slots. The consumer can
|
|
1588
|
+
combine their slot maps in either order. For overlapping slots, merging two
|
|
1589
|
+
slot maps with object spread gives the later map precedence on the shared
|
|
1590
|
+
slots. This is a consumer-side merge. The fixture measures it with a sleeve
|
|
1591
|
+
override map. For keyed visemes, see the `motion.animations_from` field above.
|
|
1592
|
+
|
|
1593
|
+
The synthetic fixture in selftest `BU173` builds the base rig, then builds it
|
|
1594
|
+
with the outfit and three viseme sets. The first four rows have the same
|
|
1595
|
+
SHA-256 of the serialized JSON value in both builds. The last row is the new
|
|
1596
|
+
skirt attachment, triangulated for the alternate art.
|
|
1597
|
+
|
|
1598
|
+
| JSON value measured by BU173 | SHA-256 |
|
|
1599
|
+
| --- | --- |
|
|
1600
|
+
| Base bones and drawn rest pose | `337b27f126c6e023fc89975a8336f6e238e6d88efcd43e4a4bdb2c4bb530afdf` |
|
|
1601
|
+
| Face axis | `eae7351e1206641929b2625359ced7ba31d065756272319b09bc83da50b82498` |
|
|
1602
|
+
| Idle animation | `87b6a843d36cd4a46fff474ab10e6874a7667f819bfa12d674e75e7dcf70667c` |
|
|
1603
|
+
| Base skirt mesh (24 vertices, 30 triangles) | `9c9bca3e0270160bc557248a250f7e015012161e7f1be7460b4bcb368b917925` |
|
|
1604
|
+
| Alternate skirt mesh (30 vertices, 40 triangles) | `e15b4ba5a013495d23fe945c7aafb980a12351cdc9ca067b4904ce0d48059701` |
|
|
1605
|
+
|
|
1541
1606
|
### Alternate part layers (`assemble.alternates[i].layers`, issue #666)
|
|
1542
1607
|
|
|
1543
1608
|
A gesture run may hold a raised arm only in a layer the author added, while
|
|
@@ -5564,7 +5629,7 @@ outline lies right of every removed pixel, and an image of only that silhouette
|
|
|
5564
5629
|
none of the 15,070 — `ASSEMBLE_UNDER_EMPTY` [observed]. Producing a hand-supplied PNG is the
|
|
5565
5630
|
author's; for a receipted plate route (issue #1230), run in order: (1) `rig-parts assemble --source <painting.png> --full <dir> [--head <dir>] --config <config.json> [--requirements <file.json>] --emit-fill-masks <masks-dir>` to write `<masks-dir>/<into>.png` on the painting's grid (`[255, 255, 255, 255]` where `(polygon ∩ from alpha > 0)`, overlap band included, and `[0, 0, 0, 0]` elsewhere; where a region take or a busy-visible figure mask reads requirements, `--emit-fill-masks` reads `config.requirements` and optional `--requirements` by the same rule as `--out`); (2) `rig-parts comfy plate --mode occluder --painting <painting.png> --occluder <masks-dir>/<into>.png --out <plate-dir>`; and (3) set `"under": {"plate": "<plate-dir>"}` on `assemble.cuts[i]` and re-run `rig-parts assemble` (or `build`).
|
|
5566
5631
|
|
|
5567
|
-
**Splitting a horizontal hem between two plan layers (`assemble.edge_splits`, issue #1231).** `assemble.edge_splits` (`[{ "over": "<part>", "under": "<part>", "band": [x0, y0, x1, y1] }, ...]`) takes `assemble.plan` part names only (`over !== under`), so a part made by `assemble.cuts` is refused with `CONFIG_NAME_RESOLVES`. Its effect is a horizontal hem split between two plan layers on the rig grid inside `band` (`x0 < x1`, `y0 < y1`, upper bounds exclusive; `ASSEMBLE_PAINTING_BAND_INSIDE` when the box reaches outside the rig canvas), applied after ghost clean-up and rig-space resampling and before projection: per column `x` in `x0 .. x1 - 1`, `y*` is the first row in `y0 .. y1 - 1` (with `y + 1 < H`) with the largest vertical painting RGB step `max(|R(x,y) - R(x,y+1)|, |G(x,y) - G(x,y+1)|, |B(x,y) - B(x,y+1)|)` among rows where `over` has `alpha >= 128` (`
|
|
5632
|
+
**Splitting a horizontal hem between two plan layers (`assemble.edge_splits`, issue #1231).** `assemble.edge_splits` (`[{ "over": "<part>", "under": "<part>", "band": [x0, y0, x1, y1] }, ...]`) takes `assemble.plan` part names only (`over !== under`), so a part made by `assemble.cuts` is refused with `CONFIG_NAME_RESOLVES`. Its effect is a horizontal hem split between two plan layers on the rig grid inside `band` (`x0 < x1`, `y0 < y1`, upper bounds exclusive; `ASSEMBLE_PAINTING_BAND_INSIDE` when the box reaches outside the rig canvas), applied after ghost clean-up and rig-space resampling and before projection: per column `x` in `x0 .. x1 - 1`, `y*` is the first row in `y0 .. y1 - 1` (with `y + 1 < H`) with the largest vertical painting RGB step `max(|R(x,y) - R(x,y+1)|, |G(x,y) - G(x,y+1)|, |B(x,y) - B(x,y+1)|)` among rows where `over` has `alpha >= 128` (`EDGE_SPLIT_ALPHA`; columns with no such row are skipped), and for every row strictly below `y*` inside `band` (`y* + 1 .. y1 - 1`), where `over` has `alpha >= 128`, `over` is cleared to `[0, 0, 0, 0]` and `under` takes the painting's RGB there with `alpha = 255`, and where `over` has `0 < alpha < 128`, `over` is cleared to `[0, 0, 0, 0]`. It transfers static plan-layer ownership along a painted horizontal hem; it does not close a `cuts` seam that opens in motion.
|
|
5568
5633
|
|
|
5569
5634
|
**A layer the author made** (issue #256). A cut covers a piece one polygon over a
|
|
5570
5635
|
planned part can take. When the piece is a layer you made by hand outside the tool — a
|
|
@@ -6779,7 +6844,7 @@ writes `parts-check.json` and reads no rig, motion or plate. Exit 0 records inpu
|
|
|
6779
6844
|
integrity. Quality classes without measurements remain named HOLEs.
|
|
6780
6845
|
[STABILITY](STABILITY.md#parts-stage-integrity-report) defines the binding and
|
|
6781
6846
|
closed diagnostic vocabulary. Base and alternate `scene.figure_mask` remain
|
|
6782
|
-
outside the consumed inputs
|
|
6847
|
+
outside the consumed inputs.
|
|
6783
6848
|
|
|
6784
6849
|
| rule | means | change |
|
|
6785
6850
|
| --- | --- | --- |
|
|
@@ -6969,6 +7034,8 @@ Renderer metadata and exact raster reads use the promised `@rig-c/core/render-sh
|
|
|
6969
7034
|
|
|
6970
7035
|
The body-root bar counts stock partitions `gapOpen` plus `ghostA` or `ghostB` owned by the pair's UNDER-owned drawing in resolved draw order on each active frame, comparing their summed cells against the unchanged strict floor `px > round(max(box width, box height) / cell)` on the original raw kind boxes (their union when both kinds contribute), never the narrowed partition boxes; `gapCovered` and OVER-owned ghost cells do not count (issue #711). The metric mode is `gap-open+under-ghost`; rows retain the exact partition counts, UNDER owner and counted total in `cells`, including excluded and under-floor readings. Missing partitions, inconsistent sums or unavailable ownership are named `FRAMES_SIDECAR` refusals, never inferred zero. An active rendered environment fails `CHECK_SEAM_OVER_MOTION` above that floor, setting overall PASS false and exits 1. Existing internal-joint and explicit-only pairs remain warnings: their PASS, exit status and bar count are unchanged; reference worlds remain informational. The root bar is counted once, and absence is not a zero or a PASS. No whole-box alpha exemption or consumer compositor is used. This gate samples the supplied animations at 12 fps, not another motion or player scene.
|
|
6971
7036
|
|
|
7037
|
+
<a id="openings-inside-the-figure-on-undeclared-layer-pairs-issue-933"></a>
|
|
7038
|
+
|
|
6972
7039
|
**Openings inside the figure on undeclared layer pairs** (issue #933). Declared `SEAM_OVER_MOTION` reads only limb segments at a cut joint, proven body-root pairs, and explicit `--requirements` or `motion_seams` declarations — `0` pairs on `demo`, `reference-demo`, `reference-sample` and `scarf`, and `10` of `63` setup-overlapping pairs (`alpha >= 128`) on `wind`. An upper layer sliding off a lower layer where the lower layer lacks opaque art under it opens a sliver of transparent canvas (`alpha == 0`) inside the figure while declared `SEAM_OVER_MOTION` stays `SKIP`. To read openings inside the figure across every undeclared setup-overlapping (`alpha >= 128`) layer pair in `rig.json` draw order (`under` drawn before `above`, so `"<above>"` is the part above the opening), `readFigurePairOpenings` evaluates on each animation frame at 12 fps (`scale = 1 / cell`, so one raster cell is `cell` world units on a side — about `2.2` to `2.5` world units on the public examples) the cells inside both drawings' posed overlap bounding box and inside the pair's own posed hole-filled union (`fillHoles(a ∪ b)`, so a pocket closed only by a third part does not count against `a|b`) that are transparent across the whole skeleton (`alpha == 0`), covered at setup (`t = 0`) by both `under` and `above` (`setup.a0[p] >= 128 && setup.b0[p] >= 128`), and not already transparent at the setup pose (`setup.any0[p] === 0`, so a deliberate gap between arm and body present at rest is art, not a motion opening). A frame opening exceeds the one-cell floor when `found_cells > allowed_cells`, where `found_cells` is the open cell count and `allowed_cells = round(max(box width, box height) / cell)` on the opening's world box (`[x0, y0, x1, y1]`). Each run prints a status line (`figure_openings: CLEAR — …`, `figure_openings: WARN — …` followed by one `WARN opening` line per pair and animation above the floor, or `figure_openings: SKIP — <reason>` when there is no `parts.json`, no animation, or no undeclared setup-overlapping pair) and writes `figure_openings` in `check.json` whenever the reader ran (`status !== "SKIP"`). Each warning names the pair `"<a>|<b>"`, the part above (`above "<above>"`) and under (`under "<under>"`), the worst frame (`frame <index>`), `found <found_cells> cell(s)`, `<= <allowed_cells> cell(s) allowed` in `<w>x<h> world units at <cell> world units/cell`. Measured wall-time cost inside `check`: `0.4 s` of `186.2 s` (`0.2 %`) on `wind` (`53` undeclared pairs, `1` animation) and `0.7 s` of `41.2 s` (`1.7 %`) on `scarf` (`67` undeclared pairs, `8` animations).
|
|
6973
7040
|
|
|
6974
7041
|
| example | slots | total slot pairs | setup-overlapping pairs (`alpha >= 128`) | declared `SEAM_OVER_MOTION` pairs | undeclared pairs read | cell (`idle`, world units) | setup interior `alpha == 0` holes (cells / components) | `figure_openings` (`idle` warnings / all-animation warnings) | worst opening (`pair`, `above`, `animation`, `frame`, `found_cells` vs `allowed_cells` in `box` at `cell`) |
|
|
@@ -7018,7 +7085,12 @@ and stay absent).
|
|
|
7018
7085
|
| <a id="SCENE_BUILD_FIELD_KNOWN"></a>`SCENE_BUILD_FIELD_KNOWN` | a build's `rig.json` or `motion.json` carries a key compose does not know how to prefix or place, or a root with a transform of its own | a rig `build` wrote; a rig written by something else is `check`'s to measure (§7, *Measuring a rig rig-parts did not assemble*), not compose's to merge |
|
|
7019
7086
|
| <a id="SCENE_RIG_SCALE_AGREES"></a>`SCENE_RIG_SCALE_AGREES` | the characters' `parts.json` `scale_rig_per_source` differ (each named) | one `assemble.rig_scale` for every character; `characters[].scale` sizes a placed character, it does not make two `rig_scale`s one |
|
|
7020
7087
|
| <a id="SCENE_SCALE_EXACT"></a>`SCENE_SCALE_EXACT` | a character at a `scale` other than 1 carries something no per-character value can scale: a physics constraint with a nonzero `wind` or `gravity`, or a physics track keying `wind` or `gravity` with a nonzero value (Spine applies both through the skeleton's `referenceScale`, which the composed skeleton holds once for every character), a track whose `property` compose does not know to be a length or not, or a translate key whose `v` is neither a list of numbers nor a map of them | `scale` 1 for that character, or rebuild it at another `assemble.rig_scale` |
|
|
7021
|
-
| <a id="SCENE_DURATION_AGREES"></a>`SCENE_DURATION_AGREES` | the characters' idles are of different durations (each named), or `scene.animations.idle.duration` differs from the composed idle | declare the same duration; compose
|
|
7088
|
+
| <a id="SCENE_DURATION_AGREES"></a>`SCENE_DURATION_AGREES` | with no `idle_repeats`, the characters' idles are of different durations (each named), or `scene.animations.idle.duration` differs from the composed idle | declare the same duration; compose preserves the original key timing |
|
|
7089
|
+
| <a id="SCENE_REPEAT_COUNT"></a>`SCENE_REPEAT_COUNT` | a character declares an invalid `idle_repeats` value | declare a safe integer of 2 or more, or omit the field to use one source period |
|
|
7090
|
+
| <a id="SCENE_REPEAT_IDLE_REQUIRED"></a>`SCENE_REPEAT_IDLE_REQUIRED` | a character opts in but the scene declares no `animations.idle` | declare the scene idle and its duration |
|
|
7091
|
+
| <a id="SCENE_REPEAT_DURATION"></a>`SCENE_REPEAT_DURATION` | in an opted-in scene, the declared idle duration differs from a character's source period times its playback count, including a count of one for a character without `idle_repeats` | use the exact finite, positive product for every character |
|
|
7092
|
+
| <a id="SCENE_REPEAT_SOURCE_LOOP_CLOSES"></a>`SCENE_REPEAT_SOURCE_LOOP_CLOSES` | a repeated source idle has a loop flag other than `true`, or its original gated keyed poses at the start and stored end do not close or cannot be read | use a closed source idle with `loop: true` and correct the named pose channel |
|
|
7093
|
+
| <a id="SCENE_REPEAT_KEY_SEAM"></a>`SCENE_REPEAT_KEY_SEAM` | a repeated source timeline cannot be spliced on its effective key clock, for example because of a setup gap, an unequal boundary state or left limit, or a reset at the boundary | author a timeline that starts at effective time zero and closes continuously, with any explicit reset strictly inside the source period and separate on Core's playback clock |
|
|
7022
7094
|
| <a id="CE_COMPILE_ANIMATION_GROUP_UNKNOWN"></a>`CE_COMPILE_ANIMATION_GROUP_UNKNOWN` | a scene track names no own declared group, including inherited object names such as `constructor` | name an explicitly declared final group; prototype properties are not groups |
|
|
7023
7095
|
| <a id="SCENE_ANIMATION_NAME_FREE"></a>`SCENE_ANIMATION_NAME_FREE` | a scene clip name already belongs to an imported character animation | choose a new name; only shared `idle` can be extended |
|
|
7024
7096
|
| <a id="SCENE_DIAL_RANGE_DECLARED"></a>`SCENE_DIAL_RANGE_DECLARED` | a keyed slider has no readable explicit `from` and `max` bounds, or its bounds are reversed; the bone and slider are named | declare both finite bounds with `from <= max`; no limits are invented |
|
|
@@ -7027,6 +7099,7 @@ and stay absent).
|
|
|
7027
7099
|
| <a id="SCENE_ANIMATION_LOOP_CLOSES"></a>`SCENE_ANIMATION_LOOP_CLOSES` | the gated posed samples at 0 and the scene clip's declared duration differ, for a new clip or an idle extension | close the posed bone, slot, geometry, alpha, clip and draw-order state; comparison omits physics simulation only and never wraps the endpoint to zero |
|
|
7028
7100
|
| <a id="SCENE_ANIMATION_POSE_READABLE"></a>`SCENE_ANIMATION_POSE_READABLE` | Core cannot read or pose the compiled scene clip for its endpoint comparison | correct the construct named by Core; unreadable poses never count as closed and no scene is emitted |
|
|
7029
7101
|
| <a id="SCENE_PIVOT_NAME_FREE"></a>`SCENE_PIVOT_NAME_FREE` | an opted-in character's source build already has a bone named `placement` that resolves to the generated name | rename the source bone or omit `placement_pivot` |
|
|
7102
|
+
| <a id="SCENE_PIVOT_DECLARED"></a>`SCENE_PIVOT_DECLARED` | a scene track keys an unresolved `<id>:placement` directly or through a bone group, and the character has not opted in | declare `"placement_pivot": true` on the named character |
|
|
7030
7103
|
| <a id="SCENE_PIVOT_UNUSED"></a>`SCENE_PIVOT_UNUSED` | an opted-in character has no scene-authored translation key on its generated pivot | add a `translate`, `translatex` or `translatey` track with a key on `<id>:placement` in `animations`, or omit `placement_pivot` |
|
|
7031
7104
|
| <a id="SCENE_PIVOT_TRACK"></a>`SCENE_PIVOT_TRACK` | a scene track keys a property other than translation on `<id>:placement`, or keys the generated `<id>:root` carrier | key translation on `<id>:placement` and leave the carrier unkeyed |
|
|
7032
7105
|
| <a id="SCENE_CHARACTER_INSIDE_CANVAS"></a>`SCENE_CHARACTER_INSIDE_CANVAS` | a character without `canvas_clip` has placed part bounds that leave the canvas | adjust its scale, offset or canvas, or declare `canvas_clip: true` for intentional overflow |
|
|
@@ -7816,10 +7889,13 @@ single-character path (§4, steps 0–9) on its own, already isolated input to a
|
|
|
7816
7889
|
| `characters[].scale` | optional, a positive number; absent is 1, and 1 composes to the bytes a scene without the key writes. The character's size on the canvas, about its stage's top-left corner: a rig px `p` lands at canvas px `scale * p + offset` (issue #197). A character scaled up past its art is drawn soft — the art is not resampled; rebuild it at a higher `assemble.rig_scale` if that matters |
|
|
7817
7890
|
| `characters[].canvas_clip` | optional literal `true` for intentional overflow (issue #1491). The placed part bounds must be finite, extend past at least one canvas edge and overlap the canvas with positive width and height. Omitting the key requires containment, with flush edges allowed. Every explicit value other than `true` is `SCENE_FIELD_TYPE` |
|
|
7818
7891
|
| `characters[].placement_pivot` | optional literal `true` (issue #1498). Generates an identity `<id>:placement` under `root` and requires a scene-authored `translate`, `translatex` or `translatey` key on it. Every explicit value other than `true` is `SCENE_FIELD_TYPE` |
|
|
7892
|
+
| `characters[].idle_repeats` | optional safe integer of 2 or more (issue #1511). Counts total plays of this character's source idle within an explicit `scene.animations.idle`. Its declared duration must equal `idle_repeats * source idle duration` exactly. In the same scene, each character without the key must fill the duration once. In `scene.json`, `characters[].idle_duration` gives the source period, `characters[].idle_repeats` appears on opted-in rows, and top-level `idle_duration` gives the scene period |
|
|
7819
7893
|
| `characters[].accept` | optional, a list of bar names: the bars this character's own check may have failed and still be composed (issue #203). `compose --accept <bar>[,<bar>…]` is the same list for every character; the two are joined, so the command line applies to every character and a character's list adds to it. Each name is one of the bars `check`'s summary names, less the gate — `loop`, `seam`, `BREATH_VISIBLE`, `BLINK_NO_HOLE`, `CHAIN_LAG`, `TIP_OVER_ROOT`, `STILL_REGIONS_DARK`, `TEXTURE_STRETCH`, `ANIMATIONS_DO_NOT_FOLD` (issue #320), `STRESS_OFF_CHAIN` (issue #347), `SEAM_OVER_MOTION` (the body-root bar, issue #686); anything else is `SCENE_ACCEPT_KNOWN`. When `check/check.json` declares `spec: "rig-parts-check/1"`, `compose` reads its `bar_outcomes` for the bars whose outcome status is `FAIL` in the report's order (issue #1373); without that spec it keeps the legacy `barsNotMet` reading. A build is taken when every bar its `check.json` failed is named; its gate red, a declared requirement not PASS, or a bar not named is `SCENE_BUILD_GREEN` as before. **It is for looking, not for shipping:** the `[compose]` line says which failing bars were accepted, `scene.json` records them as the character's `accepted`, the composed rig's own check measures them again and reports them as it finds them, and the run exits 1 even when that check is PASS (a composed rig has no `parts.json`, so the seam and four judgement lines say SKIP there). A list that accepts nothing — every build green — composes to the bytes a scene without one writes |
|
|
7820
|
-
| `animations` | optional map by scene clip name, each value a rigc `MotionAnimation` (`duration`, `tracks`, optional `loop`, `note`, and core timeline collections). Names resolve against the final scene without another prefix or unit conversion: `plate`, declared named plate bones and `<id>:<bone>`, including generated dials. A new name adds
|
|
7894
|
+
| `animations` | optional map by scene clip name, each value a rigc `MotionAnimation` (`duration`, `tracks`, optional `loop`, `note`, and core timeline collections). Names resolve against the final scene without another prefix or unit conversion: `root`, `plate`, declared named plate bones and `<id>:<bone>`, including generated dials. Keying `root` moves the whole scene. A new name adds a clip. `idle` appends tracks and timelines once to the composed idle, preserving character metadata and physics constraints. Its duration must exactly equal the composed idle (`SCENE_DURATION_AGREES`, or `SCENE_REPEAT_DURATION` when a character opts in to repetition). Imported animation names are reserved (`SCENE_ANIMATION_NAME_FREE`). Absent declaration preserves legacy bytes and output paths (issue #1346) |
|
|
7821
7895
|
| `order` | the draw order, back to front: a character id (its slots not named elsewhere, in its own order) or one `<id>:<slot>`. Every slot of every character is drawn exactly once. Interleaving is written by naming slots: `["a", "b:arm_l", "b"]` draws `b`'s left arm between `a` and the rest of `b` |
|
|
7822
7896
|
|
|
7897
|
+
A `root` key moves plates together with figures. For layered travel, key the plate bones and the character's `<id>:placement` bone enabled by `placement_pivot`.
|
|
7898
|
+
|
|
7823
7899
|
Named plates join `order` exactly once, wherever their tokens occur: for example
|
|
7824
7900
|
`["backdrop", "left", "middle", "right", "foreground"]`. Character tokens still
|
|
7825
7901
|
expand only their slots not explicitly named elsewhere. Duplicate plate or slot
|
|
@@ -7923,6 +7999,20 @@ the core player hint; it does not waive this scene closure requirement. A new
|
|
|
7923
7999
|
named clip does not layer character idle automatically; extend `idle` when its
|
|
7924
8000
|
breathing/blink/deform/physics payload must remain in that take.
|
|
7925
8001
|
|
|
8002
|
+
For a repeated idle, compose checks the original gated source's keyed pose at
|
|
8003
|
+
zero and at the stored playback end without wrapping. It shifts source idle
|
|
8004
|
+
keys and absolute Bezier time handles by whole source periods, keeping one key
|
|
8005
|
+
at a shared endpoint and the following segment's outgoing curve. It carries
|
|
8006
|
+
physics through the splice and repeats only explicit interior reset keys.
|
|
8007
|
+
Prefixed side clips keep their timing. The composed idle also closes at its
|
|
8008
|
+
stored playback end.
|
|
8009
|
+
|
|
8010
|
+
The synthetic seam control compares physics tip displacement vectors into and
|
|
8011
|
+
out of each internal splice and the outer wrap against a native one-period loop
|
|
8012
|
+
with matched carrier placement, clock and history. A planted reset fails the
|
|
8013
|
+
vector comparison. Keyed pose checks around each internal splice catch defects
|
|
8014
|
+
even when the outer endpoints close.
|
|
8015
|
+
|
|
7926
8016
|
What is composed:
|
|
7927
8017
|
|
|
7928
8018
|
- **Images are `<id>.<file>`, not `<id>:<file>`.** rig-c names an atlas region
|
|
@@ -7962,8 +8052,10 @@ What is composed:
|
|
|
7962
8052
|
offset only when it is not 1, and the `[compose]` line always prints it.
|
|
7963
8053
|
- **The plate** is a region on the bone `plate` under `root`, the first slot, its
|
|
7964
8054
|
image at canvas (0, 0).
|
|
7965
|
-
- **One `idle`** holds every character's tracks
|
|
7966
|
-
duration.
|
|
8055
|
+
- **One `idle`** holds every character's tracks over the shared scene duration.
|
|
8056
|
+
Source idles can differ in duration. Each fills the scene idle in one period
|
|
8057
|
+
or, with `idle_repeats`, in exactly the declared number of periods.
|
|
8058
|
+
Constraints and `stops` entries are carried in character order with their
|
|
7967
8059
|
`invariants.detached`; `invariants.idleDrivesMeshes` once, when any character
|
|
7968
8060
|
declares it.
|
|
7969
8061
|
- **Every animation beside a character's idle** — what `motion.animations_from`
|
|
@@ -8107,7 +8199,7 @@ one-second idle extension whose pose returns to setup at both ends.
|
|
|
8107
8199
|
Use `translate` for `[x, y]` or `translatex` and `translatey` for single values.
|
|
8108
8200
|
The values are offsets in final scene pixels, x right and y up. The character's
|
|
8109
8201
|
placement scale applies to its setup art and imported tracks. These authored
|
|
8110
|
-
translation values are already in scene units. The
|
|
8202
|
+
translation values are already in scene units. The authored scene idle duration,
|
|
8111
8203
|
posed endpoint and rig-c checks apply. Check previews use the existing size
|
|
8112
8204
|
and sampling limits.
|
|
8113
8205
|
|
package/docs/MIGRATION.md
CHANGED
|
@@ -28,10 +28,10 @@ bytes, named in *Since 1.0.0-rc.1*: the skinning envelope's reference (#169).
|
|
|
28
28
|
| --- | --- | --- |
|
|
29
29
|
| npm package | the former name | `rig-parts`; the alias `spine-parts` is published beside it at every version, the same files with only the `name` in `package.json` changed |
|
|
30
30
|
| command | the former name | `rig-parts`; the install also keeps the alias `spine-parts` as a second command on the same launcher, for the transition |
|
|
31
|
-
| repository | the former repository name (GitHub redirects it) | `firejune/rig-parts
|
|
31
|
+
| repository | the former repository name (GitHub redirects it) | `rig-c/parts` (then `firejune/rig-parts`, moved after 1.5.3; *After 1.5.3* below) |
|
|
32
32
|
| selftest variables | the `SPINE_PARTS_` names | `RIG_PARTS_CORPUS`, `RIG_PARTS_SELFTEST_JOBS`, each read first, with the former `SPINE_PARTS_` name read when it is not set |
|
|
33
33
|
| spec ids of the files authors write and this package writes | `spine-parts-requirements/1`, `spine-parts-scene/1`, `spine-parts-keypoints/1`, `spine-parts-bonemap/1`, `spine-parts-basis/1`, `spine-parts-scene-report/1` | unchanged: they name a file format, not the tool, so a file written before the rename still reads |
|
|
34
|
-
| public examples repository |
|
|
34
|
+
| public examples repository | the former examples repository name (GitHub redirects it) | `rig-c/examples` |
|
|
35
35
|
|
|
36
36
|
What to do: install with `npm install -g @rig-c/parts` and write `rig-parts` in scripts.
|
|
37
37
|
A script or a dependant that names the alias `spine-parts` keeps working and keeps
|
package/docs/PAINTING.md
CHANGED
|
@@ -200,7 +200,7 @@ and chosen to be the next public example — a character for a wind demo, where
|
|
|
200
200
|
and cloth move by physics under a side gust. It is the public example `wind`: its
|
|
201
201
|
painting, See-through layers and generation record are in
|
|
202
202
|
[rig-c/examples](https://github.com/rig-c/examples) (`wind/`), and its config,
|
|
203
|
-
proposal and build are [`examples/wind`](
|
|
203
|
+
proposal and build are [`examples/wind`](https://github.com/rig-c/parts/blob/main/examples/wind/README.md). The block:
|
|
204
204
|
|
|
205
205
|
```json
|
|
206
206
|
"generation": {
|
package/docs/STABILITY.md
CHANGED
|
@@ -88,8 +88,8 @@ required references are explicit inventory rows. Symlinks and special files
|
|
|
88
88
|
are refused. Inputs are hashed again before atomic publication.
|
|
89
89
|
|
|
90
90
|
Base and alternate `scene.figure_mask` are declared but not consumed, read,
|
|
91
|
-
hashed or bound by this command.
|
|
92
|
-
|
|
91
|
+
hashed or bound by this command. Standalone `assemble` on a scene painting writes
|
|
92
|
+
the figure's mask `figure_rig.png` beside `parts.json` (issue #1177). The plate is outside this
|
|
93
93
|
command's inputs. `painting_in_rig` is written beside `parts.json` in both
|
|
94
94
|
standalone assemble and build layouts and is consumed and hash-checked.
|
|
95
95
|
|
|
@@ -1171,7 +1171,7 @@ execution in historical evidence is inferred from a current export.
|
|
|
1171
1171
|
| `parts.json`, `parts/<name>.png` | `assemble`, `build` | one record per part: `from` (`<run>:<tag>` with a See-through v3 tag, `<run>:author:<label>` for a layer the author made — issue #256, read by no role rule — or `painting:<name>` for a patch), `cut_from` on a cut's piece only (the plan part it was cut from, issue #230), `limb` on a limb segment's part only (issue #349: `name`, `segment`, `of`, `bone`, and below a joint `joint`, `range` when the config segment declares one (issue #360), and `cap` — `at`, `width`, `radius`, `box`, `layer_px`, `image_px` with a cap image, `image_layer` after it when that image was a hidden-art layer — issue #359, `<run>:<layer>:hidden` — `missing_px`, `short_px` (`left`, `right`) after it only when `missing_px` is above 0 (issue #557, additive), `excluded_px` after them only on a subset set's limb part whose cap the set exclusion took a pixel of (issue #603, additive: each pixel taken out of the count it was in, so the cap's counts are the written PNG's), then `shape` and `upper_px` under the segment's `cap_shape` — `upper_px` without the shape only when the upper segment gave a pixel (issue #557, additive) — and after them `lower_px`, `lower_kept_px` and `lower_missing_px` under `cap_shape: "ball"` (issue #579, additive), and `edge`, `feather_radius` and `feathered_px` under its `edge`, and `cut_band`, `cut_offset`, `cut_at`, `cut_crossed`, `joint_crossed`, `band_px` and `stroke_luma_max` (when the band has a split) under its `cut_band`, issue #360), the box `x`, `y`, `w`, `h` (rig px), the pixel counts `src/parts.ts` documents (`opaque_px`, `visible_px`, `occluded_px`, `projected_core_px`, `source_px_taken`, `visible_not_projected_px`, `refused_drift_px`, `merged_px` — on a subset set's limb part counted after the set exclusion, issue #603 — `seam_override_px`, and `fringe_pushed_back` when not empty); per-part `taken_layers` (with optional `transport`, issue #973, and optional `split` — `occluder`, `image`, `sha256`, `covered_px`, `visible_px` — on a split take, additive, issue #1242) and `provenance` (`unchanged_layer_px`, `hand_px`, `automatic_px`, `edits`, `automatic`, additive, issue #823); optional top-level [`assembly_config`](#assembly-config-reading), `motion_seams`, `occluder_plates` (one record per `assemble.occluders` entry declaring `plate` — `receipt`, `receipt_sha256`, `occluder_sha256`, `painting_sha256`, `output_sha256`, `mask_sha256`, additive, issue #1237), `occluder_grow` (one record per `assemble.occluders` entry with `grow > 0` — `occluder`, `image`, `grow`, `covered_px_before`, `covered_px_after`, additive, issue #1251), `occluder_guard` (one record per `assemble.occluders` entry with `guard > 0` — `occluder`, `image`, `guard`, `guarded_px_before`, `guarded_px_after`, additive, issue #1259), `alternates` and `cut_ownership` (one row per cut, independent of RGBA equality, issue #823, with optional `under_plate` — `receipt`, `receipt_sha256`, `occluder_sha256`, `painting_sha256`, `output_sha256`, `mask_sha256` — on a `{plate}` under, additive, issue #1230); `rig_size`, `scale_rig_per_source`, `ghost_px`, `recomposite`, and `scene` (`figure_alpha_above`, `figure_px`, `figure_mask`) under `config.scene` only, with the figure's mask `figure_rig.png` beside the recomposite (issue #242), and the same bytes beside `parts.json` when the two directories differ (issue #1177); `single_run_pad` (`file_size`, `side`, `left`, `top`) last, only for one run whose file is not the `seethrough.resolution` square (issue #366) |
|
|
1172
1172
|
| `rig/rig.json`, `rig/motion.json`, `rig/images/` | `rig`, `build`, `compose` | rig-c's rig spec and motion spec, `spec` `rigc-rig/1` and `rigc-motion/1`: the format is rig-c's, and this package writes only what rig-c's parser accepts; a bone carries `inherit` only where config.bones declares one, rig-c's mode name as written (issue #348) |
|
|
1173
1173
|
| `rig/mesh_report.json` | `rig`, `build` | one row per mesh: `part`, `vertices`, `triangles`, `hull`, `bones` (the sorted names the attachment's weights bind in the written `rig.json`, in every mode — since 1.49.1 (issue #536) a rig with `turn` or `stops` names the twins and `<link>_d` bones there, where the row named the segment bones they replace: a fix of a wrong name, not a format change; a rig with neither writes the bytes it wrote), `max_influences`, `mean_influences`, `art_coverage`, then `grid` (a lattice); or `mode` "explicit" with `image_sha256` and `region_sha256` (the verified guards; counts and coverage are measured from the supplied mesh, no legacy generator report is adopted); `mode` "contour" with `params`, `contour`, `regions` (`params.maxEdge` and `contour.outlineCut` only when the mesh declares `contour.maxEdge`; `params.bridges` and `contour.bridges` — `islands`, `units`, `joins`, and `faint` only when an island was left out as faint — only when it declares `contour.bridges`); or `mode` "influence" with `influence` (as declared), `reach` (`farthest`, `at`, `nearest`, `capped`, `widest`) and `lattice` (rig-c's `SegmentsLatticeReport`: `cols`, `rows`, `artCells`, `keptCells`, `passes`, `islands`) (issue #378); or `mode` "auto" with `settings`, `source`, `result`, `residuals`, `worst_residual`, `worst_region`, `motion_amplitude`, `termination`, `weights`, `regions`, `deformation`, `quality_report` (rig-c's `mesh-quality-report/1` document whole), `motion_report`, and, only when they apply, `stray_cleared` (after `source`, when `source.stray` is declared), `skinning_residual` and `replay` (`AutoMeshReport` in `src/rig.ts`); in every mode, `exponent` when the mesh declares one (after `grid`, or after `mode`); `influences`, as declared, when a lattice or contour mesh declares it (after `exponent`, or where `exponent` would be); `stray` and `stray_cleared` when a lattice mesh declares `stray` (after `influences`, or where `influences` would be); `ribs` when a contour or auto mesh declares them (after `exponent`, or after `mode`), and then `contour.ribs` (`source.contour.ribs` in the automatic mode) |
|
|
1174
|
-
| `check/check.json` and the rest of `check/` | `check`, `build`, `compose` | [Check verdict spec](#check-report-rig-parts-check1) followed by the reference's fields in its order (`gate_spine_html_green`, `rigc_entry`, `pack_mode` (with `page_size` under `--page-size` only, issue #1273, additive), `environment` after it under `--environment` only (issue #538, additive: `path` as given, `sha256`, `steps`), `loop_max_diff`, the seam figures — `seam_mean`, `seam_px_over_40`, `seam_px_over_80` and, from issue #216, `seam_frame_scale`, the frame scale the bar divides the count by), `loop_physics` after `loop_max_diff` when the rig declares a physics constraint, `seam_border` after the seam figures when `parts.json` declares a scene (issue #242), `seam_pairs` after the seam figures when the seam bar fails or `--seam-pairs` asks (each row's picture under `check/seam/`; `--keep-stills` leaves the setup-pose still and its `frames.json` under `check/setup_still/`), then the judgement lines (`BREATH_VISIBLE`, `BLINK_NO_HOLE`, `CHAIN_LAG`, `TIP_OVER_ROOT`, `STILL_REGIONS_DARK`, `TEXTURE_STRETCH`), `ANIMATIONS_DO_NOT_FOLD` after them when `motion.json` holds an animation, the idle included — on every rig with an idle since issue #333 (issues #320, #363: `status`, `animations`, `fps`, `physics_left_out`, `folding` — each `animation`, `slot`, `attachment`, `frames`, `worst_frame`, `worst_triangles`, `triangles`, `physics_on`, `physics_off`, `physics_constraints`, `declared`, `line` — `folding_undeclared`, `declared_not_folding`, `bar`), `FEET_STAY_LEVEL` after it when a `footwear` part rides a bone that hangs from another and `motion.json` holds an animation (issue #348: `status`, `reason` on a SKIP only, `animations`, `fps`, `physics_left_out`, `bar_degrees`, `bar`, `feet` — each `part`, `bone`, `hangs_from`, `status`, `frames_posed`, `worst`), `LIMB_ONE_BONE` after it (and after `STRESS_OFF_CHAIN` where that is written) when `parts.json` holds a limb segment's part (issue #349: `status`, `parts` — each `part`, `limb`, `bone`, `status`, `others`), `SEAM_OVER_RANGE` after it when a limb record carries a `range` (issue #360: `status`, `frame_scale`, `physics_left_out`, `bar` — `mean`, `rig_px_over_40`, `level` — and `joints`, each `part`, `limb`, `segment`, `joint`, `bone`, `range`, `at`, `radius`, `under_px`, `status`, `poses` — each `degrees`, `status`, `mean`, `px_over_40`, `px_over_80`, `rig_px_over_40`, and `step_px` (`left`, `right`) only on a joint whose cap record carries `short_px` (issue #557, additive) — and `unread` on a joint not read), `SEAM_OVER_MOTION` after it when `parts.json` holds a limb segment or `--requirements` a `seam` (issue #493 retains existing pair warnings; issue #686 gates
|
|
1174
|
+
| `check/check.json` and the rest of `check/` | `check`, `build`, `compose` | [Check verdict spec](#check-report-rig-parts-check1) followed by the reference's fields in its order (`gate_spine_html_green`, `rigc_entry`, `pack_mode` (with `page_size` under `--page-size` only, issue #1273, additive), `environment` after it under `--environment` only (issue #538, additive: `path` as given, `sha256`, `steps`), `loop_max_diff`, the seam figures — `seam_mean`, `seam_px_over_40`, `seam_px_over_80` and, from issue #216, `seam_frame_scale`, the frame scale the bar divides the count by), `loop_physics` after `loop_max_diff` when the rig declares a physics constraint, `seam_border` after the seam figures when `parts.json` declares a scene (issue #242), `seam_pairs` after the seam figures when the seam bar fails or `--seam-pairs` asks (each row's picture under `check/seam/`; `--keep-stills` leaves the setup-pose still and its `frames.json` under `check/setup_still/`), then the judgement lines (`BREATH_VISIBLE`, `BLINK_NO_HOLE`, `CHAIN_LAG`, `TIP_OVER_ROOT`, `STILL_REGIONS_DARK`, `TEXTURE_STRETCH`), `ANIMATIONS_DO_NOT_FOLD` after them when `motion.json` holds an animation, the idle included — on every rig with an idle since issue #333 (issues #320, #363: `status`, `animations`, `fps`, `physics_left_out`, `folding` — each `animation`, `slot`, `attachment`, `frames`, `worst_frame`, `worst_triangles`, `triangles`, `physics_on`, `physics_off`, `physics_constraints`, `declared`, `line` — `folding_undeclared`, `declared_not_folding`, `bar`), `FEET_STAY_LEVEL` after it when a `footwear` part rides a bone that hangs from another and `motion.json` holds an animation (issue #348: `status`, `reason` on a SKIP only, `animations`, `fps`, `physics_left_out`, `bar_degrees`, `bar`, `feet` — each `part`, `bone`, `hangs_from`, `status`, `frames_posed`, `worst`), `LIMB_ONE_BONE` after it (and after `STRESS_OFF_CHAIN` where that is written) when `parts.json` holds a limb segment's part (issue #349: `status`, `parts` — each `part`, `limb`, `bone`, `status`, `others`), `SEAM_OVER_RANGE` after it when a limb record carries a `range` (issue #360: `status`, `frame_scale`, `physics_left_out`, `bar` — `mean`, `rig_px_over_40`, `level` — and `joints`, each `part`, `limb`, `segment`, `joint`, `bone`, `range`, `at`, `radius`, `under_px`, `status`, `poses` — each `degrees`, `status`, `mean`, `px_over_40`, `px_over_80`, `rig_px_over_40`, and `step_px` (`left`, `right`) only on a joint whose cap record carries `short_px` (issue #557, additive) — and `unread` on a joint not read), `SEAM_OVER_MOTION` after it when `parts.json` holds a limb segment or `--requirements` a `seam` (issue #493 retains existing pair warnings; issue #686 gates proven body-root pairs only, on gapOpen plus UNDER-owned ghost: `status` — `WARN`, `CLEAR`, `SKIP` or `FAIL` — `reason` on a SKIP only, `fps`, `floor`, `pairs` — each `pair`, `a`, `b`, `declared`, optional `root` (`limb`, `bone`, `parent`) on a proven body-root pair, and `unread` on a pair not read — `animations`, `warnings`, `rows` — each `pair`, `animation`, `status`, `drawn`, `banded`, `opens`, `px`, `max_px`, `under_floor`, and only on new-root rows stock `gapOpen` plus UNDER-owned `ghostA`/`ghostB` cells selected by resolved per-frame draw order gate their summed count against the unchanged strict one-cell floor on the original raw kind boxes (their union when both kinds contribute), never narrowed partition boxes, while `gapCovered` and OVER-owned ghost cells are excluded (issue #711); `cells` retains partition counts, UNDER owner and counted total, `worst` retains frame/count/cell/box, and `roots` retains status, mode `gap-open+under-ghost`, ghost_owner `resolved-draw-order`, pairs, failed, reason and optional unmeasured bindings; eligible candidates whose valid setup bands are all zero retain a named unmeasured root and SKIP bar, including when no pair is selected; measured root FAIL wins over SKIP, while measured PASS plus an unmeasured root remains SKIP; every eligible body drawing with stock setup `banded > 0` is selected, including both when a parent is shared; issue #708 resolves a body slot on its exact generated turn child to the same named carrier only after unique identity-bone/control/per-part-transform proof, without changing pair identity, setup selection or the direct-carrier path; setup-only observation preserves the authored motion and default drawing, root-free inputs add no setup compile/render, and no animation remains SKIP rather than a measured zero; existing internal pair warnings and their exits are unchanged; issue #941 adds optional `required` only under the requirements file's `seam_over_motion.required: true` — `status` (`PASS` or `FAIL`), `mode` `gap-open`, `bar_px` 0, `pairs` (each `pair`, `class` — `body-root`, `internal-joint` or `explicit` — `frames`, `background_frames`, `max_px`) and `failed` — and with it the key is written even when no pair is declared; issue #591 adds optional `worlds` on physics rigs with readable declared pairs and animations: `default` and `still`, each `wind`, `gravity`, `status` (`REPORTED` or `SKIP`), `reason` on SKIP, `dir` only when rendered (relative to check.json: `seam_motion/default` or `seam_motion/still`, the complete retained render with frames.json and each animation's raw seam.json), and `rows` — pair, animation, status, drawn, banded, `gap` and `ghost`, each `max_px` and `worst` only; worst carries `index`, `px`, `cell`, `box`. Per-frame hits stay in the raw sidecars. These raw reference readings add no bar or warning and leave the custom environment reading unchanged), `CLOTH_SETTLES` after it when the rig declares a physics constraint and has an idle (issue #501, a warning and not a bar: `status` — `WARN` or `CLEAR` — `fps`, `frames`, `duration`, `floor_rig_px_per_s`, `floor`, `levers`, `warnings`, `rows` — each `tip`, `root`, `links`, `point`, `settles_at`, `max_rig_px_per_s`, `min_rig_px_per_s`), `PHYSICS_CONTRIBUTES` after it when the rig declares a physics constraint and has an idle and parts (issue #1320, report-only, no bar and no threshold: `status` — `WARN` when a part under physics reads exactly 0, else `CLEAR`; a named `SKIP` writes no key — `off` (what "physics off" means: the same compiled build posed with the poser's physics off, not the spec with its constraints left out), `points`, `world`, `poser`, `fps`, `frames`, `warnings`, `rows` — each `part`, `constraints`, `external_force`, then `vertices`, `frames_read`, `max_rig_px`, `p95_rig_px`, `mean_rig_px`, `max_of_diagonal`, `moves`, or `unmeasured` with its reason), `RECOMPOSITE_HOLES` (its first figure `declared_scene` when `parts.json` declares a scene), `SETUP_POSE_VS_SOURCE`, `WIND_BAND` after it under `--wind-band` only (issue #590, additive: `status` `"REPORTED"`, `spec` `"rig-parts-wind-band/1"`, `path` as given, `sha256`, `steady_wind_only` `true`, `gravity` `[0, 1]`, `min`, `max`, `step`, `steps`, `fps`, `animations`, `max_gap`, `max_ghost`, `holds_from`, `holds_to`, `pairs_holding_all`, and `pairs` — each `pair`, `a`, `b`, `holds_all`, `holds_from`, `holds_to`, `first_break_below`, `first_break_above`, `worst_gap`, `worst_ghost`, `steps`), `skipped`, `config` under `build` only (issue #607, additive: `path` as `--config` was typed, `sha256` of the bytes the build read; `check` and `compose` read no config and write none), a `requirements` block under `--requirements` (or `build`'s `config.requirements`) — `file` first from issue #556, additive: `path` as typed or declared, `sha256`, `keys` — and `PASS`; `check/build/skeleton.json`, `.atlas` and `.png` are the packed artifact rig-c writes, and `check/build-report.json` (`<out>/build-report.json` under standalone `check`) is rig-c's own `build-report/1` (`--report`) for that primary packed compile, written verbatim by `rigc` beside `check/build/` (and listed in `check/build/run.json`'s `outputs[]` as `../build-report.json`) on a failing compile as on a green one (issue #1394; `rig` keeps no compile report because its gate and `--lead-in` compiles are throwaway scratch runs whose outputs are deleted). Missing stock partitions or resolved owner are named refusals, never zero. No whole-box exemption or consumer compositor remains; internal warnings and reference raw readings are unchanged. |
|
|
1175
1175
|
| `part_support_domains.json` | `assemble`, `build` | optional `rig-parts-support-domains/1` independent cut masks and unavailable reasons, with per-domain config-entry provenance and parts/PNG/payload digests; additive beside parts.json, whose bytes and PNGs are unchanged. Legacy output may omit it. `PART_SUPPORT_REPORT` reads pairs in the assembly placement frame and Unowned in actual setup, never as an acceptance gate. |
|
|
1176
1176
|
| `layers.json`, `<index>_<name>.png` | `layers --export` | the wrapper form `layers` reads (issue #359): `width`, `height`, then `layers` — each `name`, `filename`, `left`, `top`, `right`, `bottom`, `depth_median` (the input's own; `null` for a PSD, the manifest's order then being the draw order) — drawn layers in draw order, then the hidden-art layers; a PNG's name is its index and its layer's name, and the manifest, not the file name, says which layer it is |
|
|
1177
1177
|
| the template `.psd` | `layers --template` | one empty layer per name `templateLayerNames` (`src/layers.ts`) holds, bottom first; the same canvas writes the same bytes |
|
|
@@ -1185,10 +1185,10 @@ execution in historical evidence is inferred from a current export.
|
|
|
1185
1185
|
| `input-check.json` | `remesh --record-input-check`, `retune --record-input-check` | spec `rig-parts-input-check/1` (issue #617, additive): `versions` (`parts`, `rigc` — `rigc --version`'s whole output), `options` (`page_edges`, `pack_shape`, `page_size` when `--page-size` is given, `requirements` — null, or `path` as resolved and `sha256`), `rig` and `parts` (`dir` as resolved, `files` — `path`, `bytes`, `sha256` per file: every file under `--rig`; `parts.json` and every file under `parts/`), `check` (the input's check side as `remesh.json` carries it); `--input-check` reads it back, and either command's serves the other |
|
|
1186
1186
|
| composed turn producer inputs | `compose` | issue #1344 intentionally admits previously refused yaw/pitch derive maps, turn deform offsets/transforms, depth-grid generator images, bone inherit modes and producer mesh/fold invariants; every embedded reference is resolved and prefixed except the shared default skin. Mesh-slot ceilings sum and per-mesh triangle ceilings take the maximum, using actual counts only for unbudgeted members. Weighted lengths scale; image-sized depth grids at scale other than 1 are refused by `SCENE_SCALE_EXACT`. Other nested constructs remain refused. Previously passing scene payloads are byte-identical; the existing `check/check.json` requirement is retained, so `rig` plus `rigc build` alone is not a checked character. |
|
|
1187
1187
|
| named scene plates | `compose` | issue #1345 adds optional `plates[]`: required `name`, `image`, `provenance`, `at: [x, y]`; optional `note`, `editor_receipts`, `opaque_backdrop`. `at` is two finite integers for the image top-left in canvas pixels, y down from the top-left origin; negatives/outside allowed, no scale, native image size including oversize. Each bone/slot/attachment uses its declared name, bone under root at `(0,0)`; attachment centre is `stage.x + at[0] + width/2`, `cropToSpineY(at[1] + height/2, canvas.height)`. Each layer's token is required exactly once in draw order, with duplicate/missing/unknown/collision refusals. Names cannot collide with root, legacy plate, shared idle, character ids or prefixed bones/slots/animations; a plate name already refused by `SCENE_PLATE_NAME_FREE` or `SCENE_PLATE_NAME_UNIQUE` does not also draw a cascaded `SCENE_ORDER_COMPLETE` (issue #1350). Only that layer's explicit `opaque_backdrop: true` exempts it from compose alpha checks; an opaque declared backdrop must additionally meet width >= canvas.width AND height >= canvas.height (the rig stage), matching core 3.8.0 A19 size inference; otherwise SCENE_PLATE_BACKDROP_SIZE refuses before emission (placement coverage of the stage is the scene author's, not checked by the tool). Transparent layers have no size floor. rigc A19 remains enabled. Named images use `scene-plate.<index>.png` (atlas region `scene-plate.<index>`, by declaration index) with collision checks. The `[compose]` header line names composed `plates[]` in declaration order (`<N> named plate(s): <name>, ...`) when `plates[]` is non-empty and prints `no plate` only when neither `plate` nor `plates[]` is present (issue #1350). The additive report `plates` array records declaration, native size and PNG hash; absent declaration retains legacy output bytes and fixed first-plate behavior. |
|
|
1188
|
-
| scene named animations | `compose` | issue #1346 adds optional `scene.animations`, a name-to-rigc-MotionAnimation map resolved against final scene bones/groups/easings. New names add clips at their own declared durations; `idle` appends timelines while retaining existing character tracks, deforms, metadata and physics.
|
|
1188
|
+
| scene named animations | `compose` | issue #1346 adds optional `scene.animations`, a name-to-rigc-MotionAnimation map resolved against final scene bones/groups/easings. A scene-authored key on `root` moves the whole scene, including plates and characters. Imported character animations, including `idle`, are refused with `SCENE_ROOT_SHARED` if they key `root` directly or through a group. New names add clips at their own declared durations; `idle` appends timelines while retaining existing character tracks, deforms, metadata and physics. Without `idle_repeats`, idle duration mismatch is `SCENE_DURATION_AGREES`. Issue #1511 adds `characters[].idle_repeats`, a safe integer of at least two requiring an explicit scene idle. Its declared duration equals each source period times its count exactly, with an omitted count playing once. Each repeated source must close at its non-wrapping stored end. Character keys and absolute Bezier time handles repeat on the source clock, with one equivalent key at a shared endpoint and continuous physics across it. Scene timelines append once, prefixed side clips keep their durations, and the gated composed idle also closes at its stored end. `scene.json` retains each source `idle_duration`, adds `idle_repeats` only on opted-in rows, and gives the scene period as top-level `idle_duration`. `compose-run.json` keeps its schema. Imported non-idle names remain reserved. Core owns missing fields, unknown bones/references, duplicate property tracks and bad times. Unknown prefixed bones also name the character ID. Generated names `<id>:yaw_dial`, `<id>:pitch_dial`, and `<id>:<turn.body.slider>` (default `<id>:body_yaw_dial`) are stable; renaming them requires a major version. A dial exists only when generated by its character. Rotation keys use that slider's declared `[from, max]` bounds; out-of-range values are `SCENE_DIAL_KEY_RANGE`, unreadable bounds `SCENE_DIAL_RANGE_DECLARED`, never guessed. Slider-input keys require explicit numeric values; derive inputs are refused as `SCENE_DIAL_KEY_DECLARED`, including derive alongside a raw value. Bounds apply to the matching scalar or paired translate/scale/shear input channel; inherited group names are refused with `CE_COMPILE_ANIMATION_GROUP_UNKNOWN`. Each declared clip's gated posed endpoints at 0 and duration must agree before emission (`SCENE_ANIMATION_LOOP_CLOSES`), with physics simulation left out only for observation. Absent declaration retains stable output bytes at the same paths. Core `check/build/run.json` records fresh `started_at` and `finished_at` clocks; comparisons report these raw differences separately and require all other receipt fields and output bytes to match. |
|
|
1189
1189
|
| scene loop refusal detail | `compose` | Issue #1358 enriches `SCENE_ANIMATION_LOOP_CLOSES` with the first differing bone or slot, channel, start/end values and numeric tolerance 0 (exact equality). The existing exact JSON endpoint comparison is unchanged: bones, slots, draw order, drawn geometry, clipping polygons and clipped geometry remain covered. Selection follows that family order, then producer row and field order; geometry-only differences name the slot and geometry channel. Physics is still excluded only from observation. The refusal code, acceptance, emitted rig/motion and built scene bytes are unchanged. |
|
|
1190
1190
|
| scene canvas framing | `compose` | Issue #1491 adds optional `characters[].canvas_clip` to `spine-parts-scene/1`. Literal `true` requires finite placed bounds, overflow past a canvas edge and an intersection with positive width and height. The respective refusals are `SCENE_CHARACTER_CLIP_BOUNDS`, `SCENE_CHARACTER_CLIP_UNUSED` and `SCENE_CHARACTER_CLIP_EMPTY`. Other explicit values are `SCENE_FIELD_TYPE`. Omitting the key retains the exact containment rule, output bytes and console text. The opted-in character row in `scene.json` adds `canvas_clip: true` and `clipped_bounds` after the original `bounds`. Both boxes are canvas pixels, y down, with exclusive right and bottom edges. The console appends the clipped box only for those rows. The rig-c gate and packed build retain the full art and geometry. For a scene with any opt-in, compose check renders use the stage viewport unless the render specifies its own. Preview size caps and sampling stay in effect. Native-size renders and consumer playback use the authored stage rectangle as described in [Canvas framing for intentional overflow](AUTHORING.md#canvas-framing-for-intentional-overflow-issue-1491). |
|
|
1191
|
-
| scene placement pivot | `compose` | Issue #1498 adds optional literal `true` at `characters[].placement_pivot` in `spine-parts-scene/1`. It emits the identity `<id>:placement` under `root` and requires a scene-authored `translate`, `translatex` or `translatey` key in final scene pixels. The existing placement math stays on the original first-level bones, root regions and root weights. Source root bindings use the unkeyed identity `<id>:root` child when needed. `SCENE_FIELD_TYPE` refuses other explicit values, `SCENE_PIVOT_NAME_FREE` a source bone collision, `SCENE_PIVOT_UNUSED` an unused declaration and `SCENE_PIVOT_TRACK` a forbidden property or carrier key. `SCENE_PLATE_NAME_FREE` still governs named plate collisions. Core's unknown-bone refusal, rig gate, scene clip timing and endpoint closure still apply. `scene.json` adds `placement_pivot` with the generated name after the bounds fields and counts the generated bones for that character. `compose-run.json` binds the declaration through `scene.sha256` with its existing shape and key order. Omitting the declaration preserves default output bytes at the same paths, subject to the existing Core receipt clocks. |
|
|
1191
|
+
| scene placement pivot | `compose` | Issue #1498 adds optional literal `true` at `characters[].placement_pivot` in `spine-parts-scene/1`. It emits the identity `<id>:placement` under `root` and requires a scene-authored `translate`, `translatex` or `translatey` key in final scene pixels. The existing placement math stays on the original first-level bones, root regions and root weights. Source root bindings use the unkeyed identity `<id>:root` child when needed. `SCENE_FIELD_TYPE` refuses other explicit values, `SCENE_PIVOT_NAME_FREE` a source bone collision, `SCENE_PIVOT_DECLARED` an unresolved pivot targeted directly or through a bone group without an opt-in, `SCENE_PIVOT_UNUSED` an unused declaration and `SCENE_PIVOT_TRACK` a forbidden property or carrier key. `SCENE_PLATE_NAME_FREE` still governs named plate collisions. Core's unknown-bone refusal, rig gate, scene clip timing and endpoint closure still apply. `scene.json` adds `placement_pivot` with the generated name after the bounds fields and counts the generated bones for that character. `compose-run.json` binds the declaration through `scene.sha256` with its existing shape and key order. Omitting the declaration preserves default output bytes at the same paths, subject to the existing Core receipt clocks. |
|
|
1192
1192
|
| `compose-run.json` | `compose` | spec `rig-compose-run/1` (issue #1348), separate from `rig-run/1`; a stable contract as of 2.44.0. Written at the `--out` root only after the gate and check are green and no accepted failing character remains, so an `--accept` preview writes none. Fixed keys in order: `spec`, `scene` (`path`, `sha256`), `characters` (each `id`, `build`, `files`, each file `path`, `sha256`, then optional `placement`), `plate` (`path`, `sha256`, or null), `plates` (each `name`, `path`, `sha256`). Scene and plate paths are the supplied and declared paths; character file paths are build-relative. Characters sort by `id`, files by `path`, named plates by `name`, in code-unit order. Each character's files are exactly `check/check.json`, `parts.json`, `rig/rig.json`, `rig/motion.json` and each distinct image the default skin names under `rig/images/`, including a generator's depth image. Every `sha256` is of the raw file bytes compose consumed before the gate. Only a character with `canvas_clip: true` has `placement`, with `canvas_clip: true`, `bounds` and `clipped_bounds` in that order from the scene report. There are no clocks, directory extras, requirements or CLI-option inventory, so identical inputs at identical supplied paths give identical record bytes. Compose owns the name: a file of that name at the `--out` root is deleted at the start of every compose, before stage validation, so a refused rerun leaves none. For scenes without opt-in, legacy outputs retain stable bytes, with the existing nested Core receipt clock comparison described above. |
|
|
1193
1193
|
| the scene report | `compose` | spec `spine-parts-scene-report/1`; the plate block carries `sha256` of the plate PNG's bytes after `size` (issue #1183, additive under *What "stable" means here*: a new report key in a minor version, so the spec stays `/1`); `pack_mode` records `page_size` only when `--page-size <px>` is given (issue #1352, additive; without `--page-size`, rigc's default 2048 px page and padding 2 on each side bound any plate or region side to at most 2044 px before `CE_ATLAS_REGION_EXCEEDS_PAGE`) |
|
|
1194
1194
|
| `idle.png`, `idle-indexed.png`, `idle.gif` | `loop`, `build --loop` | APNG and GIF encodings of the rendered idle |
|
|
@@ -1518,14 +1518,14 @@ prepared-reference implementation, packaged locally with `rig-c` metadata versio
|
|
|
1518
1518
|
Its grid-selection replays bind one exact reference and schedule, then compare each
|
|
1519
1519
|
fresh gated candidate.
|
|
1520
1520
|
The number of candidate probes, gated builds and packed-page checks is
|
|
1521
|
-
unchanged; a changed bound or reference input is refused. In one exclusive
|
|
1521
|
+
unchanged; a changed bound or reference input is refused. In one exclusive remote-pool
|
|
1522
1522
|
WSL ABBA invocation, using the same rig-c tarball in both arms and two runs per
|
|
1523
1523
|
arm, the strict switched `bottomwear` input derived from public `reference-demo` took 56.00–56.28 s
|
|
1524
1524
|
with one-shot comparison and 50.55–51.40 s with preparation included; the similarly switched public
|
|
1525
1525
|
`reference-sample` input took 18.96–20.41 s and 16.39–18.71 s respectively.
|
|
1526
1526
|
The paired differences were 4.59–5.74 s and 1.70–2.57 s. These are observed
|
|
1527
1527
|
wall times for those inputs, not an execution limit or a machine-wide idle
|
|
1528
|
-
measurement; load outside the
|
|
1528
|
+
measurement; load outside the remote job pool was not measured. The prior count
|
|
1529
1529
|
bounds remain the termination guarantee.
|
|
1530
1530
|
|
|
1531
1531
|
## Determinism
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rig-parts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.56.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
|
"exports": {
|
package/src/scene.ts
CHANGED
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
* - **The plate**: a region on the bone `plate` under `root`, its image at
|
|
80
80
|
* canvas (0, 0), the canvas's size exactly. Its `provenance` (`observed`,
|
|
81
81
|
* `generated`, `unknown`) is copied into `scene.json` and nothing reads it.
|
|
82
|
-
* - **The idle**: one `idle` holding every character's tracks
|
|
83
|
-
*
|
|
82
|
+
* - **The idle**: one `idle` holding every character's tracks. It can play
|
|
83
|
+
* whole source periods per character when the scene declares `idle_repeats`.
|
|
84
84
|
* - **A failing bar, by name (issue #203).** A build whose own check is not
|
|
85
85
|
* green is refused (`SCENE_BUILD_GREEN`) unless every bar it failed is named
|
|
86
86
|
* in `compose --accept` or the character's `accept` — the two lists are
|
|
@@ -118,7 +118,8 @@ import { clearComposeRun, COMPOSE_RUN_FILE, COMPOSE_RUN_SPEC, type ComposeRun, t
|
|
|
118
118
|
import { readRequirements, type RequirementsFile } from './requirements.ts';
|
|
119
119
|
import { OFFSET_PLACES, rigJsonText, type RigSpec } from './rig.ts';
|
|
120
120
|
import { pyRound } from './round.ts';
|
|
121
|
-
import { mergeSceneAnimations, readSceneAnimations, sceneBoneContext, sceneClipLoopProblems, type SceneAnimations, type ScenePlacementPivot } from './sceneclips.ts';
|
|
121
|
+
import { mergeSceneAnimations, readSceneAnimations, sceneBoneContext, sceneClipLoopProblems, sceneRepeatSourceLoopProblems, type SceneAnimations, type ScenePlacementPivot } from './sceneclips.ts';
|
|
122
|
+
import { repeatSceneKeys } from './scenerepeat.ts';
|
|
122
123
|
|
|
123
124
|
/** The scene file's `spec`. */
|
|
124
125
|
export const SCENE_SPEC = 'spine-parts-scene/1';
|
|
@@ -174,6 +175,8 @@ export interface SceneCharacter {
|
|
|
174
175
|
canvas_clip?: true;
|
|
175
176
|
/** Add a character-local translation target for scene-authored motion. */
|
|
176
177
|
placement_pivot?: true;
|
|
178
|
+
/** Total number of source idle periods within the declared scene idle. */
|
|
179
|
+
idle_repeats?: number;
|
|
177
180
|
/** The bars this character's own check may have failed and still be taken (issue #203), as the file lists them; empty when it lists none. */
|
|
178
181
|
accept: string[];
|
|
179
182
|
}
|
|
@@ -376,6 +379,7 @@ export function loadScene(path: string): SceneFile {
|
|
|
376
379
|
}
|
|
377
380
|
const keys = ['id', 'build', 'offset', 'scale', 'accept', 'canvas_clip'];
|
|
378
381
|
if ('placement_pivot' in c) keys.push('placement_pivot'); // Keep the default unknown-key diagnostic byte-stable.
|
|
382
|
+
if ('idle_repeats' in c) keys.push('idle_repeats');
|
|
379
383
|
known(c, where, keys);
|
|
380
384
|
let ok = true;
|
|
381
385
|
for (const k of ['id', 'build', 'offset']) {
|
|
@@ -422,6 +426,11 @@ export function loadScene(path: string): SceneFile {
|
|
|
422
426
|
fail('SCENE_FIELD_TYPE', `${where}.placement_pivot`, `is ${show(c.placement_pivot)}. Literal true is required when the key is present`);
|
|
423
427
|
ok = false;
|
|
424
428
|
}
|
|
429
|
+
const repeats = c.idle_repeats;
|
|
430
|
+
if ('idle_repeats' in c && !(typeof repeats === 'number' && Number.isSafeInteger(repeats) && repeats >= 2)) {
|
|
431
|
+
fail('SCENE_REPEAT_COUNT', `${where}.idle_repeats`, `is ${show(repeats)}. Declare a safe integer of 2 or more, or omit the field to use one source period`);
|
|
432
|
+
ok = false;
|
|
433
|
+
}
|
|
425
434
|
const acc = c.accept;
|
|
426
435
|
if ('accept' in c) {
|
|
427
436
|
if (!(Array.isArray(acc) && acc.every((v) => typeof v === 'string'))) {
|
|
@@ -442,6 +451,7 @@ export function loadScene(path: string): SceneFile {
|
|
|
442
451
|
accept: 'accept' in c ? [...(acc as string[])] : [],
|
|
443
452
|
...(c.canvas_clip === true ? { canvas_clip: true } : {}),
|
|
444
453
|
...(c.placement_pivot === true ? { placement_pivot: true } : {}),
|
|
454
|
+
...(typeof repeats === 'number' ? { idle_repeats: repeats } : {}),
|
|
445
455
|
});
|
|
446
456
|
});
|
|
447
457
|
}
|
|
@@ -464,6 +474,11 @@ export function loadScene(path: string): SceneFile {
|
|
|
464
474
|
problems.push(...err.problems);
|
|
465
475
|
}
|
|
466
476
|
}
|
|
477
|
+
if (!(isRecord(o.animations) && Object.hasOwn(o.animations, 'idle'))) {
|
|
478
|
+
for (const c of characters) if (c.idle_repeats !== undefined) {
|
|
479
|
+
fail('SCENE_REPEAT_IDLE_REQUIRED', 'scene.animations.idle', `is absent for character ${show(c.id)} with idle_repeats ${c.idle_repeats}. Declare the scene idle and its duration`);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
467
482
|
refuseIfAny(problems);
|
|
468
483
|
return { path: at, sha256, canvas, plate, ...('plates' in o ? { plates } : {}), ...(animations === undefined ? {} : { animations }), characters, order };
|
|
469
484
|
}
|
|
@@ -486,6 +501,8 @@ export interface CharacterBuild {
|
|
|
486
501
|
images: Array<[string, Uint8Array]>;
|
|
487
502
|
/** Build-relative paths and hashes of the JSON and image bytes consumed here. */
|
|
488
503
|
files: RunStampFileEntry[];
|
|
504
|
+
/** Exact parsed input texts for the opted-in pre-emission source gate. */
|
|
505
|
+
repeatSource?: Array<[string, string]>;
|
|
489
506
|
/** The bars its own check failed that were accepted (issue #203), in check's order; empty for a green build. */
|
|
490
507
|
accepted: string[];
|
|
491
508
|
}
|
|
@@ -506,7 +523,7 @@ const DERIVE_KEYS = ['kind', 'degrees', 'depth', 'carried', 'about', 'narrowing'
|
|
|
506
523
|
const DEFORM_KEYS = ['skin', 'slot', 'attachment', 'keys'];
|
|
507
524
|
const DEFORM_KEY_KEYS = ['t', 'vertices', 'transform'];
|
|
508
525
|
const TURN_TRANSFORM_KEYS = ['kind', 'degrees', 'depth', 'narrowing'];
|
|
509
|
-
type SceneDeform = { skin?: string; slot: string; attachment: string; keys: Array<Record<string, unknown>> };
|
|
526
|
+
type SceneDeform = { skin?: string; slot: string; attachment: string; keys: Array<{ t: number } & Record<string, unknown>> };
|
|
510
527
|
|
|
511
528
|
/** One animation of a motion.json: the idle, or one beside it as the file `motion.animations_from` named it (issue #183). */
|
|
512
529
|
type SceneAnimation = { duration: number; loop?: boolean; note?: string; tracks: MotionSpec['animations']['idle']['tracks']; deform?: SceneDeform[] };
|
|
@@ -569,8 +586,15 @@ export function readCharacterBuild(c: SceneCharacter, problems: Problem[], accep
|
|
|
569
586
|
const dir = c.buildDir;
|
|
570
587
|
const who = `character "${c.id}" (${c.build})`;
|
|
571
588
|
const files: RunStampFileEntry[] = [];
|
|
589
|
+
const repeatSource: Array<[string, string]> = [];
|
|
590
|
+
const repeating = c.idle_repeats !== undefined;
|
|
572
591
|
const consumed = (path: string, bytes: Uint8Array): void => {
|
|
573
592
|
files.push({ path, sha256: createHash('sha256').update(bytes).digest('hex') });
|
|
593
|
+
if (repeating && (path === 'rig/rig.json' || path === 'rig/motion.json')) {
|
|
594
|
+
const text = Buffer.from(bytes).toString('utf8');
|
|
595
|
+
if (!Buffer.from(text).equals(bytes)) problems.push({ code: 'SCENE_BUILD_FIELD_KNOWN', object: `${who} ${path}`, detail: 'is not UTF-8; the source gate must read the exact input bytes' });
|
|
596
|
+
repeatSource.push([path.slice('rig/'.length), text]);
|
|
597
|
+
}
|
|
574
598
|
};
|
|
575
599
|
const json = (path: string, what: string): unknown => readJson(join(dir, path), what, problems, bytes => consumed(path, bytes));
|
|
576
600
|
if (!existsSync(dir) || !statSync(dir).isDirectory()) {
|
|
@@ -766,10 +790,10 @@ export function readCharacterBuild(c: SceneCharacter, problems: Problem[], accep
|
|
|
766
790
|
}
|
|
767
791
|
if (isRecord(anims.idle)) {
|
|
768
792
|
unknown('motion.json animations.idle', anims.idle, IDLE_KEYS);
|
|
769
|
-
if (anims.idle.loop !== true) problems.push({ code: 'SCENE_BUILD_FIELD_KNOWN', object: `${who} motion.json animations.idle.loop`, detail: `is ${show(anims.idle.loop)}; the rig stage writes true` });
|
|
793
|
+
if (anims.idle.loop !== true && !repeating) problems.push({ code: 'SCENE_BUILD_FIELD_KNOWN', object: `${who} motion.json animations.idle.loop`, detail: `is ${show(anims.idle.loop)}; the rig stage writes true` });
|
|
770
794
|
const tracks = Array.isArray(anims.idle.tracks) ? anims.idle.tracks : [];
|
|
771
795
|
tracks.forEach((t, i) => {
|
|
772
|
-
unknown(`motion.json animations.idle.tracks[${i}]`, t, TRACK_KEYS);
|
|
796
|
+
unknown(`motion.json animations.idle.tracks[${i}]`, t, repeating ? [...TRACK_KEYS, 'lag', 'stagger'] : TRACK_KEYS);
|
|
773
797
|
const keys = isRecord(t) && Array.isArray(t.keys) ? t.keys : [];
|
|
774
798
|
keys.forEach((k, j) => unknown(`motion.json animations.idle.tracks[${i}].keys[${j}]`, k, KEY_KEYS));
|
|
775
799
|
});
|
|
@@ -811,7 +835,7 @@ export function readCharacterBuild(c: SceneCharacter, problems: Problem[], accep
|
|
|
811
835
|
if (!Array.isArray(deform.keys)) { shape(`${where}.keys`, `is ${show(deform.keys)}; a list of turn deform keys is required`); continue; }
|
|
812
836
|
for (const [j, key] of deform.keys.entries()) {
|
|
813
837
|
const keyAt = `${where}.keys[${j}]`;
|
|
814
|
-
unknown(keyAt, key, DEFORM_KEY_KEYS);
|
|
838
|
+
unknown(keyAt, key, repeating && name === 'idle' ? [...DEFORM_KEY_KEYS, 'ease', 'curve'] : DEFORM_KEY_KEYS);
|
|
815
839
|
if (!isRecord(key)) continue;
|
|
816
840
|
if (!finite(key.t)) shape(`${keyAt}.t`, `is ${show(key.t)}; a finite time is required`);
|
|
817
841
|
if ('vertices' in key && !(Array.isArray(key.vertices) && key.vertices.every(finite))) shape(`${keyAt}.vertices`, `is ${show(key.vertices)}; finite offset pairs are required`);
|
|
@@ -823,7 +847,7 @@ export function readCharacterBuild(c: SceneCharacter, problems: Problem[], accep
|
|
|
823
847
|
}
|
|
824
848
|
if (problems.length > before) return null;
|
|
825
849
|
files.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
826
|
-
return { id: c.id, dir, rig: rigRaw as RigSpec, motion: motionRaw as MotionSpec, rigSize, rigScale, artBox, images, files, accepted };
|
|
850
|
+
return { id: c.id, dir, rig: rigRaw as RigSpec, motion: motionRaw as MotionSpec, rigSize, rigScale, artBox, images, files, accepted, ...(repeating ? { repeatSource } : {}) };
|
|
827
851
|
}
|
|
828
852
|
|
|
829
853
|
// ---------------------------------------------------------------------------
|
|
@@ -1106,6 +1130,7 @@ export interface SceneCharacterReport {
|
|
|
1106
1130
|
tracks: number;
|
|
1107
1131
|
constraints: number;
|
|
1108
1132
|
idle_duration: number;
|
|
1133
|
+
idle_repeats?: number;
|
|
1109
1134
|
/** The bars the character's own check failed that `--accept` or its `accept` took (issue #203); written only when there are any, so a scene of green builds writes the bytes it wrote before the field existed. */
|
|
1110
1135
|
accepted?: string[];
|
|
1111
1136
|
}
|
|
@@ -1159,6 +1184,7 @@ export function composeScene(
|
|
|
1159
1184
|
mode: PackMode = { pageEdges: DEFAULT_PAGE_EDGES, packShape: DEFAULT_PACK_SHAPE },
|
|
1160
1185
|
requirements: RequirementsFile | null = null,
|
|
1161
1186
|
plateLayers: ReadonlyArray<PlateImage | null> = [],
|
|
1187
|
+
verifyRepeatSource?: (build: CharacterBuild, object: string) => void,
|
|
1162
1188
|
): ComposedScene {
|
|
1163
1189
|
const pageSize = parsePageSize(mode.pageSize);
|
|
1164
1190
|
const fail = (code: string, object: string, detail: string): void => {
|
|
@@ -1228,13 +1254,32 @@ export function composeScene(
|
|
|
1228
1254
|
}
|
|
1229
1255
|
});
|
|
1230
1256
|
|
|
1231
|
-
// ---- one rig_scale, one idle
|
|
1257
|
+
// ---- one rig_scale, one scene idle clock ---------------------------------
|
|
1232
1258
|
const scales = ready.map((b) => `"${b.id}" ${b.rigScale}`);
|
|
1233
1259
|
if (new Set(ready.map((b) => b.rigScale)).size > 1) {
|
|
1234
1260
|
fail('SCENE_RIG_SCALE_AGREES', 'scene.characters', `were built at assemble.rig_scale ${scales.join(', ')} (parts.json's scale_rig_per_source); one rig_scale is required — offsets are canvas px and a character's rig px are canvas px at scale 1, and a character's scale (characters[].scale) sizes it on the canvas but does not make two rig_scales one`);
|
|
1235
1261
|
}
|
|
1236
1262
|
const durations = ready.map((b) => b.motion.animations.idle.duration);
|
|
1237
|
-
|
|
1263
|
+
const hasRepeats = scene.characters.some(c => c.idle_repeats !== undefined);
|
|
1264
|
+
const clip = scene.animations?.idle;
|
|
1265
|
+
const idleDuration = hasRepeats ? clip?.duration ?? 0 : durations[0];
|
|
1266
|
+
if (hasRepeats) scene.characters.forEach((c, i) => {
|
|
1267
|
+
if (clip === undefined) {
|
|
1268
|
+
if (c.idle_repeats !== undefined) fail('SCENE_REPEAT_IDLE_REQUIRED', 'scene.animations.idle', `is absent for character ${show(c.id)} with idle_repeats ${c.idle_repeats}. Declare the scene idle and its duration`);
|
|
1269
|
+
return;
|
|
1270
|
+
}
|
|
1271
|
+
const idle = byId.get(c.id)?.motion.animations.idle;
|
|
1272
|
+
if (idle === undefined) return;
|
|
1273
|
+
const count = c.idle_repeats ?? 1;
|
|
1274
|
+
const period = idle.duration;
|
|
1275
|
+
if (!Number.isFinite(period) || period <= 0 || !Number.isFinite(idleDuration) || idleDuration <= 0 || idleDuration !== count * period) {
|
|
1276
|
+
fail('SCENE_REPEAT_DURATION', 'scene.animations.idle.duration', `is ${idleDuration} s for character ${show(c.id)}. Its ${period} s idle repeated ${count} times requires exactly ${count * period} s (tolerance 0 s)`);
|
|
1277
|
+
}
|
|
1278
|
+
if (c.idle_repeats !== undefined && idle.loop !== true) {
|
|
1279
|
+
fail('SCENE_REPEAT_SOURCE_LOOP_CLOSES', `scene.characters[${i}] motion.json animations.idle`, `loop is ${show(idle.loop)}; repeating requires a closed source idle with loop: true`);
|
|
1280
|
+
}
|
|
1281
|
+
});
|
|
1282
|
+
else if (new Set(durations).size > 1) {
|
|
1238
1283
|
fail('SCENE_DURATION_AGREES', 'scene.characters', `have idles of ${ready.map((b, i) => `"${b.id}" ${durations[i]} s`).join(', ')}; one idle holds every character's tracks, so one duration is required — rebuild with one motion.duration`);
|
|
1239
1284
|
}
|
|
1240
1285
|
|
|
@@ -1297,6 +1342,7 @@ export function composeScene(
|
|
|
1297
1342
|
tracks: b.motion.animations.idle.tracks.length,
|
|
1298
1343
|
constraints: b.rig.constraints?.length ?? 0,
|
|
1299
1344
|
idle_duration: b.motion.animations.idle.duration,
|
|
1345
|
+
...(c.idle_repeats === undefined ? {} : { idle_repeats: c.idle_repeats }),
|
|
1300
1346
|
...(b.accepted.length === 0 ? {} : { accepted: [...b.accepted] }),
|
|
1301
1347
|
});
|
|
1302
1348
|
});
|
|
@@ -1690,12 +1736,12 @@ export function composeScene(
|
|
|
1690
1736
|
// prefixed as the idle's are and nothing else changed: the scene plays the idle, and schedules none of these.
|
|
1691
1737
|
const beside: Record<string, SceneAnimation> = {};
|
|
1692
1738
|
const notes = new Set(ready.map((b) => b.motion.animations.idle.note));
|
|
1693
|
-
for (const c of scene.characters) {
|
|
1739
|
+
for (const [i, c] of scene.characters.entries()) {
|
|
1694
1740
|
const b = byId.get(c.id) as CharacterBuild;
|
|
1695
1741
|
const id = c.id;
|
|
1696
1742
|
for (const [k, v] of Object.entries(b.motion.easings)) easings[prefixed(id, k)] = v;
|
|
1697
1743
|
for (const [k, v] of Object.entries(b.motion.groups)) groups[prefixed(id, k)] = v.map((n) => P(id, n));
|
|
1698
|
-
const prefixTrack = (t: MotionSpec['animations']['idle']['tracks'][number]): MotionSpec['animations']['idle']['tracks'][number] => {
|
|
1744
|
+
const prefixTrack = (t: MotionSpec['animations']['idle']['tracks'][number], repeatedIdle = false): MotionSpec['animations']['idle']['tracks'][number] => {
|
|
1699
1745
|
const tr = { ...t } as Record<string, unknown>;
|
|
1700
1746
|
if (typeof tr.bone === 'string') tr.bone = P(id, tr.bone);
|
|
1701
1747
|
if (typeof tr.group === 'string') tr.group = prefixed(id, tr.group);
|
|
@@ -1703,24 +1749,56 @@ export function composeScene(
|
|
|
1703
1749
|
const memberMap = (v: Record<string, unknown>): Record<string, unknown> => Object.fromEntries(Object.entries(v).map(([n, value]) => [P(id, n), value]));
|
|
1704
1750
|
tr.keys = (t.keys as unknown as Array<Record<string, unknown>>).map((k) => ({
|
|
1705
1751
|
...k,
|
|
1706
|
-
...(typeof k.ease === 'string' ? { ease: prefixed(id, k.ease) } : {}),
|
|
1752
|
+
...(typeof k.ease === 'string' && !(repeatedIdle && k.ease === 'stepped') ? { ease: prefixed(id, k.ease) } : {}),
|
|
1707
1753
|
...(isRecord(k.v) ? { v: memberMap(k.v) } : {}),
|
|
1708
1754
|
...(isRecord(k.derive) ? { derive: { ...k.derive, ...(isRecord(k.derive.depth) ? { depth: memberMap(k.derive.depth) } : {}) } } : {}),
|
|
1709
1755
|
}));
|
|
1710
1756
|
return tr as unknown as MotionSpec['animations']['idle']['tracks'][number];
|
|
1711
1757
|
};
|
|
1712
|
-
|
|
1713
|
-
const deforms = (a: SceneAnimation): { deform?: SceneDeform[] } => a.deform === undefined ? {} : { deform: a.deform.map((d) => ({
|
|
1758
|
+
const deforms = (a: SceneAnimation, repeatedIdle = false): { deform?: SceneDeform[] } => a.deform === undefined ? {} : { deform: a.deform.map((d) => ({
|
|
1714
1759
|
...d, slot: prefixed(id, d.slot), attachment: prefixed(id, d.attachment),
|
|
1715
1760
|
// default is the one shared skin, not a per-character name.
|
|
1716
|
-
keys: d.keys.map((k) => ({ ...k,
|
|
1761
|
+
keys: d.keys.map((k) => ({ ...k,
|
|
1762
|
+
...(repeatedIdle && typeof k.ease === 'string' && k.ease !== 'stepped' ? { ease: prefixed(id, k.ease) } : {}),
|
|
1763
|
+
...(Array.isArray(k.vertices) && c.scale !== 1 ? { vertices: k.vertices.map((v) => scaledBy(v as number, c.scale)) } : {}),
|
|
1764
|
+
})),
|
|
1717
1765
|
})) };
|
|
1718
|
-
|
|
1719
|
-
|
|
1766
|
+
const animations = animationsOf(b.motion);
|
|
1767
|
+
let idle = animations.idle;
|
|
1768
|
+
const repeats = c.idle_repeats;
|
|
1769
|
+
if (repeats !== undefined) {
|
|
1770
|
+
const object = `scene.characters[${i}] motion.json animations.idle`;
|
|
1771
|
+
verifyRepeatSource?.(b, object);
|
|
1772
|
+
idle = repeatSceneKeys(idle, repeats, idleDuration, b.motion.groups, object);
|
|
1773
|
+
}
|
|
1774
|
+
for (const t of idle.tracks) tracks.push(scaledTrack(prefixTrack(t, repeats !== undefined), c.scale));
|
|
1775
|
+
idleDeform.push(...(deforms(idle, repeats !== undefined).deform ?? []));
|
|
1776
|
+
for (const [n, a] of Object.entries(animations)) if (n !== 'idle') beside[prefixed(id, n)] = { ...a, tracks: a.tracks.map((t) => scaledTrack(prefixTrack(t), c.scale)), ...deforms(a) };
|
|
1720
1777
|
}
|
|
1721
1778
|
const note = notes.size === 1 ? [...notes][0] : ready.map((b) => `${b.id}: ${b.motion.animations.idle.note}`).join(' | ');
|
|
1722
|
-
const motion: MotionSpec = { spec: 'rigc-motion/1', archetype: name, cut: name, easings, groups, animations: { idle: { duration:
|
|
1723
|
-
|
|
1779
|
+
const motion: MotionSpec = { spec: 'rigc-motion/1', archetype: name, cut: name, easings, groups, animations: { idle: { duration: idleDuration, loop: true, note, tracks, ...(idleDeform.length === 0 ? {} : { deform: idleDeform }) }, ...beside } };
|
|
1780
|
+
|
|
1781
|
+
if (scene.animations !== undefined) {
|
|
1782
|
+
const declaredBones = new Set(rig.bones.map(bone => bone.name));
|
|
1783
|
+
const undeclaredPivots = new Map<string, string>();
|
|
1784
|
+
for (const c of scene.characters) {
|
|
1785
|
+
const bone = prefixed(c.id, PLACEMENT_BONE);
|
|
1786
|
+
if (c.placement_pivot !== true && !declaredBones.has(bone)) undeclaredPivots.set(bone, c.id);
|
|
1787
|
+
}
|
|
1788
|
+
for (const [animation, clip] of Object.entries(scene.animations)) for (const [i, track] of clip.tracks.entries()) {
|
|
1789
|
+
const group = track.group;
|
|
1790
|
+
const members = group !== undefined && isBoneProperty(track.property) && Object.hasOwn(groups, group) ? groups[group] : [];
|
|
1791
|
+
const targets = track.bone === undefined ? members : [track.bone];
|
|
1792
|
+
for (const bone of new Set(targets)) {
|
|
1793
|
+
const id = undeclaredPivots.get(bone);
|
|
1794
|
+
if (id === undefined) continue;
|
|
1795
|
+
const via = group === undefined ? '' : ` through group ${show(group)}`;
|
|
1796
|
+
fail('SCENE_PIVOT_DECLARED', `scene.animations.${animation}.tracks[${i}]`,
|
|
1797
|
+
`keys bone ${show(bone)}${via}; declare "placement_pivot": true on character ${show(id)}`);
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
refuseIfAny(problems);
|
|
1801
|
+
}
|
|
1724
1802
|
if (scene.animations !== undefined || pivots.size > 0) mergeSceneAnimations(rig, motion, scene.animations ?? {}, [...pivots.values()]);
|
|
1725
1803
|
|
|
1726
1804
|
const report: SceneReport = {
|
|
@@ -1736,7 +1814,7 @@ export function composeScene(
|
|
|
1736
1814
|
}) }),
|
|
1737
1815
|
characters: rows,
|
|
1738
1816
|
order: { declared: [...scene.order], slots: slots.map((s) => s.name), judged_by: 'nothing' },
|
|
1739
|
-
idle_duration:
|
|
1817
|
+
idle_duration: idleDuration,
|
|
1740
1818
|
};
|
|
1741
1819
|
return { rig, motion, images, report, ...(scene.animations === undefined ? {} : { sceneAnimations: scene.animations }) };
|
|
1742
1820
|
}
|
|
@@ -1898,7 +1976,7 @@ export function unprefixedNames(rig: RigSpec, motion: MotionSpec, ids: readonly
|
|
|
1898
1976
|
* {@link composeScene} — one refusal naming every problem the
|
|
1899
1977
|
* files hold. Pure but for the reads.
|
|
1900
1978
|
*/
|
|
1901
|
-
export function composeFromFiles(scenePath: string, requirementsPath?: string, mode: PackMode = { pageEdges: DEFAULT_PAGE_EDGES, packShape: DEFAULT_PACK_SHAPE }, accept: readonly string[] = []): ComposedScene & { runRecord: ComposeRun } {
|
|
1979
|
+
export function composeFromFiles(scenePath: string, requirementsPath?: string, mode: PackMode = { pageEdges: DEFAULT_PAGE_EDGES, packShape: DEFAULT_PACK_SHAPE }, accept: readonly string[] = [], verifyRepeatSource?: (build: CharacterBuild, object: string) => void): ComposedScene & { runRecord: ComposeRun } {
|
|
1902
1980
|
const scene = loadScene(scenePath);
|
|
1903
1981
|
const problems: Problem[] = acceptProblems(accept, '--accept');
|
|
1904
1982
|
const builds = scene.characters.map((c) => readCharacterBuild(c, problems, accept));
|
|
@@ -1947,7 +2025,7 @@ export function composeFromFiles(scenePath: string, requirementsPath?: string, m
|
|
|
1947
2025
|
problems.push(...err.problems);
|
|
1948
2026
|
}
|
|
1949
2027
|
}
|
|
1950
|
-
const composed = composeScene(scene, builds, plate, problems, mode, req, plateLayers);
|
|
2028
|
+
const composed = composeScene(scene, builds, plate, problems, mode, req, plateLayers, verifyRepeatSource);
|
|
1951
2029
|
const runRecord: ComposeRun = {
|
|
1952
2030
|
spec: COMPOSE_RUN_SPEC,
|
|
1953
2031
|
scene: { path: scenePath, sha256: scene.sha256 },
|
|
@@ -2021,7 +2099,16 @@ export function composeStage(input: ComposeInput, run: ComposeRunners, log: Log)
|
|
|
2021
2099
|
log(`rig-parts compose: ${input.scene} -> ${input.out}, page edges ${mode.pageEdges}, pack shape ${mode.packShape}`);
|
|
2022
2100
|
let composed: ReturnType<typeof composeFromFiles>;
|
|
2023
2101
|
try {
|
|
2024
|
-
composed = composeFromFiles(input.scene, input.requirements, mode, input.accept ?? [])
|
|
2102
|
+
composed = composeFromFiles(input.scene, input.requirements, mode, input.accept ?? [], (b, object) => {
|
|
2103
|
+
if (b.repeatSource === undefined) throw new Error(`${object}: missing source gate inputs`);
|
|
2104
|
+
const [source] = gateThroughRigc(b.images, b.repeatSource, run.rig, run.scratch, null, build => {
|
|
2105
|
+
refuseIfAny(sceneRepeatSourceLoopProblems(readFileSync(join(build, 'skeleton.model.json'), 'utf8'), object));
|
|
2106
|
+
});
|
|
2107
|
+
if (source.status !== 0) refuseIfAny([{
|
|
2108
|
+
code: 'COMPOSE_RIGC_GREEN', object,
|
|
2109
|
+
detail: `rigc source ${source.label} exited ${source.status}${source.lines.length > 0 ? `: ${source.lines.map(line => line.trim()).join(' | ')}` : ', and it printed nothing'}; exit 0 is required before anything is written, and nothing was`,
|
|
2110
|
+
}]);
|
|
2111
|
+
});
|
|
2025
2112
|
} catch (err) {
|
|
2026
2113
|
return refused('compose', err);
|
|
2027
2114
|
}
|
|
@@ -2050,7 +2137,7 @@ export function composeStage(input: ComposeInput, run: ComposeRunners, log: Log)
|
|
|
2050
2137
|
try {
|
|
2051
2138
|
const clips = composed.sceneAnimations;
|
|
2052
2139
|
gate = gateThroughRigc(composed.images, texts, run.rig, run.scratch, mode, clips === undefined ? undefined : build => {
|
|
2053
|
-
refuseIfAny(sceneClipLoopProblems(readFileSync(join(build, 'skeleton.model.json'), 'utf8'), clips));
|
|
2140
|
+
refuseIfAny(sceneClipLoopProblems(readFileSync(join(build, 'skeleton.model.json'), 'utf8'), clips, r.characters.some(c => c.idle_repeats !== undefined)));
|
|
2054
2141
|
});
|
|
2055
2142
|
} catch (err) { return refused('compose', err); }
|
|
2056
2143
|
if (composed.sceneAnimations !== undefined) for (const g of gate) {
|
package/src/sceneclips.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Scene-authored clips use final names and Core's motion parser and poser. */
|
|
2
2
|
import { CompileError } from '@rig-c/core/errors';
|
|
3
3
|
import { parseMotionSpec, type MotionSpec as CoreMotion } from '@rig-c/core/motion';
|
|
4
|
-
import { CoreInputError, poseRawAnimation, readModel, type RawPose } from '@rig-c/core/core';
|
|
4
|
+
import { bezierPolyline, CoreInputError, poseRawAnimation, readModel, type RawPose } from '@rig-c/core/core';
|
|
5
5
|
import { PartsError, refuseIfAny, type Problem } from './errors.ts';
|
|
6
6
|
import type { MotionSpec } from './motion.ts';
|
|
7
7
|
import type { RigSpec } from './rig.ts';
|
|
@@ -212,11 +212,89 @@ export function sceneKeyedModel(modelText: string) {
|
|
|
212
212
|
return { doc, physics };
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
/** Check at the runtime's stored end, which need not equal the declared double.
|
|
216
|
+
* Keep that clock on the observation view even if a removed physics key set it.
|
|
217
|
+
*/
|
|
218
|
+
function storedIdleLoopDifference(modelText: string): { difference: string | null; duration: number } {
|
|
219
|
+
const full = readModel(modelText, 'gated idle model');
|
|
220
|
+
const idle = full.animations.find(a => a.name === 'idle');
|
|
221
|
+
const { doc } = sceneKeyedModel(modelText);
|
|
222
|
+
const keyed = doc.animations.find(a => a.name === 'idle');
|
|
223
|
+
if (idle === undefined || keyed === undefined) return { difference: 'gated model has no idle', duration: 0 };
|
|
224
|
+
const { duration, declared } = idle.timelines;
|
|
225
|
+
const clock = `declared duration ${declared} s, stored end ${duration} s`;
|
|
226
|
+
if (!(duration > 0)) return { difference: `idle has no positive playback period (${clock})`, duration };
|
|
227
|
+
keyed.timelines.duration = duration;
|
|
228
|
+
const [start, end] = poseRawAnimation(doc, 'idle', [duration]);
|
|
229
|
+
if (start?.animationTime !== 0 || end?.trackTime !== duration || end.animationTime !== duration) {
|
|
230
|
+
return { difference: `non-wrapping sample phases are ${start?.animationTime} s and ${end?.animationTime} s (${clock})`, duration };
|
|
231
|
+
}
|
|
232
|
+
return { difference: scenePoseState(start) === scenePoseState(end) ? null : `${poseDifferenceDetail(start, end)} (${clock})`, duration };
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface StoredCurveKey { time: number; curve?: number[] | 'stepped' }
|
|
236
|
+
interface StoredTrackTarget { name: string; timelines: Array<{ name: string; keys: StoredCurveKey[] }> }
|
|
237
|
+
|
|
238
|
+
/** At a splice, Core's sampled Bezier must reach the closing key from the left.
|
|
239
|
+
* Check the stored polyline, including curves generated from named easings.
|
|
240
|
+
*/
|
|
241
|
+
function sourceCurveSeamProblems(modelText: string, duration: number, object: string): Problem[] {
|
|
242
|
+
const { animations } = JSON.parse(modelText) as { animations: Array<{
|
|
243
|
+
name: string;
|
|
244
|
+
bones: StoredTrackTarget[];
|
|
245
|
+
slots: StoredTrackTarget[];
|
|
246
|
+
constraints: { physics: StoredTrackTarget[] };
|
|
247
|
+
attachments: Array<{ name: string; slots: Array<{ name: string; attachments: Array<{ name: string; deform?: StoredCurveKey[] }> }> }>;
|
|
248
|
+
}> };
|
|
249
|
+
const idle = animations.find(a => a.name === 'idle');
|
|
250
|
+
if (idle === undefined) return [];
|
|
251
|
+
const problems: Problem[] = [];
|
|
252
|
+
const check = (keys: StoredCurveKey[], timeline: string, deform = false): void => {
|
|
253
|
+
const before = keys.at(-2), end = keys.at(-1);
|
|
254
|
+
if (end === undefined || Math.fround(end.time) !== duration || !Array.isArray(before?.curve)) return;
|
|
255
|
+
const curve = before.curve;
|
|
256
|
+
for (let i = 0; i < curve.length; i += 4) {
|
|
257
|
+
// Only the time axis is needed. Core's deform polyline uses the stored
|
|
258
|
+
// float for the leading key time; bone and physics curves use its name.
|
|
259
|
+
const points = bezierPolyline(deform ? Math.fround(before.time) : before.time, 0, curve[i], 0, curve[i + 2], 0, end.time, 0);
|
|
260
|
+
const overlap = points.find((n, j) => j % 2 === 0 && n >= duration);
|
|
261
|
+
if (overlap === undefined) continue;
|
|
262
|
+
problems.push({ code: 'SCENE_REPEAT_KEY_SEAM', object: `${object}.${timeline}`,
|
|
263
|
+
detail: `Bezier channel ${i / 4} has a stored time sample ${overlap} s at or past the closing key ${duration} s. The source channel must splice without changing its keyed motion` });
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
for (const [family, targets] of [['bone', idle.bones], ['slot', idle.slots], ['physics', idle.constraints.physics]] as const) {
|
|
268
|
+
for (const target of targets) for (const track of target.timelines) check(track.keys, `${family} ${JSON.stringify(target.name)} ${track.name}`);
|
|
269
|
+
}
|
|
270
|
+
for (const skin of idle.attachments) for (const slot of skin.slots) for (const attachment of slot.attachments) {
|
|
271
|
+
if (attachment.deform !== undefined) check(attachment.deform, `deform ${skin.name}/${slot.name}/${attachment.name}`, true);
|
|
272
|
+
}
|
|
273
|
+
return problems;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export function sceneRepeatSourceLoopProblems(modelText: string, object: string): Problem[] {
|
|
277
|
+
let difference: string | null;
|
|
278
|
+
try {
|
|
279
|
+
const result = storedIdleLoopDifference(modelText);
|
|
280
|
+
difference = result.difference;
|
|
281
|
+
if (difference === null) return sourceCurveSeamProblems(modelText, result.duration, object);
|
|
282
|
+
}
|
|
283
|
+
catch (err) {
|
|
284
|
+
if (!(err instanceof CoreInputError)) throw err;
|
|
285
|
+
difference = err.message;
|
|
286
|
+
}
|
|
287
|
+
return [{
|
|
288
|
+
code: 'SCENE_REPEAT_SOURCE_LOOP_CLOSES', object,
|
|
289
|
+
detail: `${difference}; repeating requires a closed source idle`,
|
|
290
|
+
}];
|
|
291
|
+
}
|
|
292
|
+
|
|
215
293
|
/** Measure the actual gated poses at both endpoints, without wrapping duration to zero.
|
|
216
294
|
* Physics is omitted only from this observation, as in check's keyed-loop bar;
|
|
217
295
|
* the gated/emitted motion and physics constraints are never edited.
|
|
218
296
|
*/
|
|
219
|
-
export function sceneClipLoopProblems(modelText: string, clips: SceneAnimations): Problem[] {
|
|
297
|
+
export function sceneClipLoopProblems(modelText: string, clips: SceneAnimations, repeatedIdle = false): Problem[] {
|
|
220
298
|
try {
|
|
221
299
|
const { doc, physics } = sceneKeyedModel(modelText);
|
|
222
300
|
const problems: Problem[] = [];
|
|
@@ -229,6 +307,9 @@ export function sceneClipLoopProblems(modelText: string, clips: SceneAnimations)
|
|
|
229
307
|
? `pose sample clocks start ${poses[0].animationTime}, end ${poses[1].trackTime}; required 0 and ${clip.duration}; tolerance 0 (exact equality)`
|
|
230
308
|
: poseDifferenceDetail(poses[0], poses[1]);
|
|
231
309
|
problems.push({ code: 'SCENE_ANIMATION_LOOP_CLOSES', object: `scene.animations.${name}`, detail: `${difference}; identical endpoint poses are required (physics left out: ${physics.join(', ') || 'none'})` });
|
|
310
|
+
} else if (name === 'idle' && repeatedIdle) {
|
|
311
|
+
const { difference } = storedIdleLoopDifference(modelText);
|
|
312
|
+
if (difference !== null) problems.push({ code: 'SCENE_ANIMATION_LOOP_CLOSES', object: 'scene.animations.idle', detail: `${difference}; identical endpoint poses are required (physics left out: ${physics.join(', ') || 'none'})` });
|
|
232
313
|
}
|
|
233
314
|
}
|
|
234
315
|
return problems;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/** Periodic splicing for the imported character idle only. */
|
|
2
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
3
|
+
import { PartsError } from './errors.ts';
|
|
4
|
+
|
|
5
|
+
interface Key {
|
|
6
|
+
t: number;
|
|
7
|
+
curve?: unknown;
|
|
8
|
+
ease?: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface Idle {
|
|
12
|
+
duration: number;
|
|
13
|
+
tracks: Array<{ property: string; bone?: string; group?: string; physics?: string; lag?: number; stagger?: number; keys: Key[] }>;
|
|
14
|
+
deform?: Array<{ slot: string; attachment: string; keys: Key[] }>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function refuse(object: string, detail: string): never {
|
|
18
|
+
throw new PartsError([{ code: 'SCENE_REPEAT_KEY_SEAM', object, detail: `${detail}. The source channel must splice without changing its keyed motion or introducing a physics reset` }]);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** A key's outgoing interpolation is separate from the state it supplies. */
|
|
22
|
+
function state({ t: _time, curve: _curve, ease: _ease, ...payload }: Key): unknown {
|
|
23
|
+
// With no authored offset, an omitted or trailing zero deform run names setup coordinates.
|
|
24
|
+
if ('vertices' in payload) {
|
|
25
|
+
if (!Array.isArray(payload.vertices)) delete payload.vertices;
|
|
26
|
+
else {
|
|
27
|
+
const run = payload.vertices.slice();
|
|
28
|
+
while (run.length > 0 && run[run.length - 1] === 0) run.pop();
|
|
29
|
+
if (run.length === 0) delete payload.vertices;
|
|
30
|
+
else payload.vertices = run;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return payload;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function atOffset<K extends Key>(key: K, offset: number, time = key.t + offset): K {
|
|
37
|
+
if (offset === 0) return key;
|
|
38
|
+
const curve = key.curve;
|
|
39
|
+
return { ...key, t: time, ...(Array.isArray(curve) ? {
|
|
40
|
+
curve: curve.map((n: number, i) => i % 2 === 0 ? n + offset : n),
|
|
41
|
+
} : {}) };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function repeatTimeline<K extends Key>(keys: K[], count: number, period: number, duration: number, object: string,
|
|
45
|
+
clocks: ReadonlyArray<{ target: string; shift: number }>, property?: string): K[] {
|
|
46
|
+
const first = keys[0], last = keys[keys.length - 1], before = keys[keys.length - 2];
|
|
47
|
+
if (first === undefined) refuse(object, 'has no source keys');
|
|
48
|
+
const startState = state(first), endState = state(last);
|
|
49
|
+
let sharesKey = false;
|
|
50
|
+
for (const { target, shift } of clocks) {
|
|
51
|
+
const start = first.t + shift, end = last.t + shift;
|
|
52
|
+
const clock = `${target} effective first/last key times ${start}/${end} s (lag/stagger ${shift} s, source period ${period} s)`;
|
|
53
|
+
if (property === 'reset') {
|
|
54
|
+
if (!(start > 0 && end < period)) refuse(object, `${clock}; a reset at or outside the boundary cannot be copied across the splice`);
|
|
55
|
+
// A reset is an event, never a state key to coalesce. A float32 collision
|
|
56
|
+
// at either end would move an interior event onto the splice.
|
|
57
|
+
const offset = (count - 1) * period;
|
|
58
|
+
if (Math.fround(offset + start) === Math.fround(offset) || Math.fround(offset + end) === Math.fround(offset + period)) {
|
|
59
|
+
refuse(object, `${clock}; an interior reset reaches the boundary on the float32 clock of the last copy`);
|
|
60
|
+
}
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (start !== 0 || !(end <= period)) refuse(object, `${clock}; a splice needs an explicit start at 0 s and no keys past the source period`);
|
|
64
|
+
if (!isDeepStrictEqual(startState, endState)) {
|
|
65
|
+
refuse(object, `${clock}; the held end ${JSON.stringify(endState)} differs from the start ${JSON.stringify(startState)}`);
|
|
66
|
+
}
|
|
67
|
+
if (end !== period) continue; // The closed state holds through the gap to the next copy.
|
|
68
|
+
sharesKey = true;
|
|
69
|
+
if (before !== undefined && (property === 'inherit' || property === 'attachment' || before.curve === 'stepped' || before.ease === 'stepped') &&
|
|
70
|
+
!isDeepStrictEqual(state(before), endState)) {
|
|
71
|
+
refuse(object, `${clock}; the left limit ${JSON.stringify(state(before))} differs from the boundary key ${JSON.stringify(endState)}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const stride = keys.length - (sharesKey ? 1 : 0);
|
|
75
|
+
if (stride * count + (sharesKey ? 1 : 0) > 0xffffffff) refuse(object, `requires more keys than an array can hold for ${count} copies`);
|
|
76
|
+
const out: K[] = [];
|
|
77
|
+
for (let k = 0; k < count; k++) {
|
|
78
|
+
// The shared key comes from the next copy so its outgoing easing survives.
|
|
79
|
+
// The previous distinct key still carries its own arrival segment.
|
|
80
|
+
const final = k === count - 1;
|
|
81
|
+
const length = final ? keys.length : stride;
|
|
82
|
+
for (let j = 0; j < length; j++) {
|
|
83
|
+
// D + (N - 1) * D can differ from N * D in double arithmetic.
|
|
84
|
+
const terminal = final && sharesKey && j === length - 1 ? duration - clocks[0].shift : undefined;
|
|
85
|
+
out.push(atOffset(keys[j], k * period, terminal));
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return out;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function repeatSceneKeys<T extends Idle>(idle: T, count: number, duration: number, groups: Readonly<Record<string, string[]>>, object: string): T {
|
|
92
|
+
const period = idle.duration;
|
|
93
|
+
if (!Number.isFinite(Math.fround(duration)) || Math.fround(period) === 0 || Math.fround((count - 1) * period) === Math.fround(duration)) {
|
|
94
|
+
refuse(object, `the source period ${period} s cannot separate ${count} copies on the float32 playback clock at ${duration} s`);
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
...idle,
|
|
98
|
+
duration,
|
|
99
|
+
tracks: idle.tracks.map((track, i) => {
|
|
100
|
+
const where = `${object}.tracks[${i}]`;
|
|
101
|
+
const targets = track.group === undefined ? [track.bone ?? track.physics ?? track.property] : Object.hasOwn(groups, track.group) ? groups[track.group] : [];
|
|
102
|
+
if (targets.length === 0) refuse(where, `group ${JSON.stringify(track.group)} has no resolved members`);
|
|
103
|
+
const clocks = targets.map((target, index) => ({ target: JSON.stringify(target), shift: (track.lag ?? 0) + (track.stagger ?? 0) * index }));
|
|
104
|
+
return { ...track, keys: repeatTimeline(track.keys, count, period, duration, where, clocks, track.property) };
|
|
105
|
+
}),
|
|
106
|
+
...(idle.deform === undefined ? {} : { deform: idle.deform.map((deform, i) => ({
|
|
107
|
+
...deform,
|
|
108
|
+
keys: repeatTimeline(deform.keys, count, period, duration, `${object}.deform[${i}]`, [{ target: `${deform.slot}/${deform.attachment}`, shift: 0 }]),
|
|
109
|
+
})) }),
|
|
110
|
+
};
|
|
111
|
+
}
|