rig-parts 2.66.0 → 2.67.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/cli.ts +24 -2
- package/docs/AUTHORING.md +66 -11
- package/docs/STABILITY.md +82 -12
- package/package.json +1 -1
- package/src/build.ts +6 -1
- package/src/check.ts +22 -12
- package/src/clipstretch.ts +97 -0
- package/src/scene.ts +46 -22
- package/src/sceneclips.ts +163 -2
package/cli.ts
CHANGED
|
@@ -31,6 +31,7 @@ import { proposeNeck } from './tools/neck-propose.ts';
|
|
|
31
31
|
import { parseAltArg } from './tools/alternate-cli.ts';
|
|
32
32
|
import { type AlternateCliInput, assembleStage, build, BUILD_OWNS, BUILD_OWNS_FILES, checkStage, checkWrote, emitFillMasksStage, ERROR_MAP_FILE, loopStage, readRuns, readSource, rigStage, suppliedCheckFlag } from './src/build.ts';
|
|
33
33
|
import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, LOOP_SEAM_BAR_UNMET, type LoopSeamRequest, PACK_PAGE_SIZE, PACK_SHAPES, rigcRunnerAt, type PackShape, PAGE_EDGES, type PageEdges, parsePageSize, PARTS_HOME_SENTENCE, RIGC_GEOMETRY_VERSION, rigcRanClause, type RigcRunner, NO_PARTS_SENTENCE, SEAM_MEAN_BAR, SOURCE_SENTENCE, SEAM_PX_BAR, SEAM_PX_LEVEL, SPINEBOY_YARDSTICK, TEXTURE_STRETCH_CEILING } from './src/check.ts';
|
|
34
|
+
import { checkClipStretch } from './src/clipstretch.ts';
|
|
34
35
|
import { ComfyClient, resolveHost, runBackground, runMatte, runPainting, runSeeThrough } from './src/comfy/index.ts';
|
|
35
36
|
import { coreCfg, DEFAULT_GROW_PX, runForeground } from './src/plate.ts';
|
|
36
37
|
import { type CharacterConfig, loadClothConfig, loadConfig, loadEarlyConfig, loadPaintConfig } from './src/config.ts';
|
|
@@ -646,6 +647,9 @@ usage:
|
|
|
646
647
|
[--set <name> | --all-sets] [--environment <schedule.json>]
|
|
647
648
|
[--wind-band <spec.json>] [--json]
|
|
648
649
|
[--loop-seam-bar <channel-delta,pixels> --loop-seam-cap <loops>]
|
|
650
|
+
Diagnostic form: rig-parts check --clip-stretch <scene.json>
|
|
651
|
+
Measures each retained side clip alone and the declared scene idle.
|
|
652
|
+
This form takes only the scene path and prints a text diagnostic.
|
|
649
653
|
--json prints the completed check.json object only, with unchanged exit codes.
|
|
650
654
|
The loop seam flags together require a positive idle period. Core selects
|
|
651
655
|
the first whole-loop warm-up from 0 through the cap whose idle wrap meets
|
|
@@ -1303,7 +1307,7 @@ const TAKES = {
|
|
|
1303
1307
|
rig: { valued: ['--config', '--parts', '--out', '--idle-keys', '--page-edges', '--pack-shape', '--page-size'], switches: ['--help'] },
|
|
1304
1308
|
propose: { valued: ['--parts', '--source', '--out', '--from-config', '--compare', '--full', '--head', '--canvas', '--keypoints', '--person', '--wrist-snap', '--grid-rule', '--cloth', '--write-config', '--from', '--bust-landmarks', '--no-bust'], switches: ['--head-box', '--no-back-hair', '--only-missing', '--help'] },
|
|
1305
1309
|
compare: { valued: ['--left', '--right', '--map'], switches: ['--help'] },
|
|
1306
|
-
check: { valued: ['--rig', '--out', '--parts', '--source', '--page-edges', '--pack-shape', '--page-size', '--requirements', '--set', '--environment', '--wind-band', '--loop-seam-bar', '--loop-seam-cap'], switches: ['--seam-pairs', '--keep-stills', '--all-sets', '--no-extremes', '--json', '--help'] },
|
|
1310
|
+
check: { valued: ['--rig', '--out', '--parts', '--source', '--page-edges', '--pack-shape', '--page-size', '--requirements', '--set', '--environment', '--wind-band', '--loop-seam-bar', '--loop-seam-cap', '--clip-stretch'], switches: ['--seam-pairs', '--keep-stills', '--all-sets', '--no-extremes', '--json', '--help'] },
|
|
1307
1311
|
loop: { valued: ['--frames', '--out'], switches: ['--palette', '--help'] },
|
|
1308
1312
|
assemble: { valued: ['--source', '--full', '--head', '--config', '--out', '--emit-fill-masks', '--seam', '--project', '--alt', '--write-config', '--requirements'], switches: ['--propose-plan', '--help'] },
|
|
1309
1313
|
'comfy seethrough': { valued: ['--image', '--out', '--resolution', '--steps', '--seed', '--prefix', '--host', '--wait', '--timeout', '--poll', '--config', '--depth-run'], switches: ['--offload', '--no-offload', '--lama', '--nf4', '--help'] },
|
|
@@ -1715,9 +1719,27 @@ function cmdCheck(args: string[]): number {
|
|
|
1715
1719
|
const f = flags(
|
|
1716
1720
|
args.filter((a) => a !== '--seam-pairs' && a !== '--keep-stills' && a !== '--all-sets' && a !== '--no-extremes' && a !== '--json'),
|
|
1717
1721
|
'check',
|
|
1718
|
-
[
|
|
1722
|
+
[],
|
|
1719
1723
|
);
|
|
1720
1724
|
if (typeof f === 'string') return usage(f);
|
|
1725
|
+
const clipScene = f.get('--clip-stretch');
|
|
1726
|
+
if (clipScene !== undefined) {
|
|
1727
|
+
if (clipScene === '' || clipScene.startsWith('--')) return usage('--clip-stretch needs a scene path');
|
|
1728
|
+
if (args.length !== 2) return usage('--clip-stretch <scene.json> takes no other check flags');
|
|
1729
|
+
try {
|
|
1730
|
+
const bin = findRigc(import.meta.dir, process.env.PATH ?? '');
|
|
1731
|
+
const scratch = mkdtempSync(join(tmpdir(), 'rig-parts-clip-stretch-'));
|
|
1732
|
+
try {
|
|
1733
|
+
return checkClipStretch(clipScene, scratch, rigcRunner(bin), console.log) ? EXIT_OK : EXIT_REFUSED;
|
|
1734
|
+
} finally {
|
|
1735
|
+
rmSync(scratch, { recursive: true, force: true });
|
|
1736
|
+
}
|
|
1737
|
+
} catch (err) {
|
|
1738
|
+
return printRefusal(err);
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
if (!f.has('--rig')) return usage('check needs --rig <value>');
|
|
1742
|
+
if (!f.has('--out')) return usage('check needs --out <value>');
|
|
1721
1743
|
if (allSets === 1 && f.has('--set')) return usage('--set and --all-sets are two modes; give one');
|
|
1722
1744
|
const loopSeam = parseLoopSeamFlags(f);
|
|
1723
1745
|
if (typeof loopSeam === 'string') return usage(loopSeam);
|
package/docs/AUTHORING.md
CHANGED
|
@@ -7020,6 +7020,7 @@ outside the consumed inputs.
|
|
|
7020
7020
|
| Below-floor cloth travel (unmeasured) | a link's larger unrounded carrier-frame root/tip travel is below the unchanged 0.5 rig px floor, after the zero guard. The diagnostic gives actual root and tip travel in rig px, the 0.5 rig px floor, and `measured_driver`: the nearest world-moving bone (including the carrier), `"none"` when measured still, or `"unavailable"` for missing or unusable geometry. This observes movement, not causal key attribution. The reading stays UNMEASURED under the existing SKIP policy; a separately declared requirement for measurable movement is not satisfied | drive the carrier so the cloth has measurable motion, or remove the requirement for this cloth to move on idle if that motion is not required |
|
|
7021
7021
|
| <a id="CHECK_TIP_OVER_ROOT"></a>`CHECK_TIP_OVER_ROOT` | a `handwear`/`bottomwear` part's art in the lower half of its box travels less than 1.4725 times as far as in the upper half, measured from the idle's posed geometry against the bone the part hangs from (issue #987; rig px quoted, the world reading beside it) | the chain track's `amps` (grow toward the tip), or the mesh's `segments` (the chain must be among them), or its mode: on `scarf`'s short skirt the proposal's lattice read 1.207 and the same part in `contour` mode 1.738 with the same segments and idle (issue #118) — both carried the `chest` segment #262 removed, after which the lattice reads 3.487. When the detail says `the root travels with the breath (x px of y px): it is carried by \`<bone>\`` (issue #262) the chain is not the cause: a bone an idle `translate` track moves (the breath) moves the root more than the tip, and with that translate held still (the part posed again without it, in proportion to each vertex's weight on the bone and those under it) the ratio passes — the row adds `carried_by`, `breath_rig_px`, `root_without_breath_rig_px` and `tip_without_breath_rig_px`; take that bone's segment off the mesh, or bind the root to the bone the part hangs from, which the detail names. Since issue #987 only a breath keyed under that bone is read: one at or above it is in the frame the halves are read in and carries nothing. When the bone named is a link of the chain the part hangs on, its segment stays, and the detail says to key the translate on the bone the part hangs from or above it. `nothing in it moves against \`<bone>\`` is a part that rides the bone it hangs from whole — a rigid sleeve, whose world ratio is 1. Since issue #995 a lone swing counts as a link too — a rotate-keyed bone with no child bone, or whose only child is its control twin (a one-link chain's control) — so a skirt bound to the one bone that swings it is read against the bone above, where its swing shows. A rotate-keyed body segment other bones hang under (a pelvis carrying the legs) is not one: a part bound whole to it reads `nothing in it moves against` that bone and fails, its world ratio passing only through the lever arm. Hang swinging cloth on its own bone under the body segment; a fitted garment the rig holds rigid on purpose (shorts on the pelvis) is declared in the scene file's `not_swinging` (§7), and the line then reads it SKIP with the reason. A part the scene file declares `rests` (issue #245) is held the other way, its tip half's travel at most its root half's (ratio ≤ 1); the detail then reads `the scene file's rests declares its tip at rest, so a ratio <= 1 is required`, and for it the fix is the chain's `amps` (shrinking toward the tip) or the mesh's tip weighted to a bone the idle does not swing |
|
|
7022
7022
|
| <a id="CHECK_STILL_REGIONS_DARK"></a>`CHECK_STILL_REGIONS_DARK` | a slot of the face's still set (the `face` slots and every slot drawn over the face that the head bone alone carries) moves relative to the bone the face's slot rides, or a `footwear` slot moves on the screen, by more than the arithmetic's own rounding — measured from the idle's posed geometry (the slot, its largest displacement in rig px, the idle frame and the tolerance quoted) | on the face: a face mesh with a weight on a bone other than the head (`segments`), or one deformed by another bone; on the feet: a mesh weighted to a swinging bone, or a region on the wrong bone. A bang swinging over the face is not this line's failure: its depth is reported (`crossing`), with no bar |
|
|
7023
|
+
| <a id="CHECK_CLIP_STRETCH"></a>`CHECK_CLIP_STRETCH` | `check --clip-stretch` refused the scratch candidate or found a take with a zero-length rest edge, no measurable edge, or a peak over the Parts stretch bar | read the named take, peak and edge influences. Change one input and rerun [the clip diagnostic](#physics-clips-and-scene-repeats-issue-1615) on the actual scene declaration. If Core refused, follow the relayed Core gate lines |
|
|
7023
7024
|
| <a id="CHECK_TEXTURE_STRETCH"></a>`CHECK_TEXTURE_STRETCH` | a mesh triangle's edge, in some idle frame, is more than 1.926544 times its rest length or less than 1/1.926544 of it (the mesh, triangle, its three vertices, the edge and the frame are named, and — issue #314 — the bones the edge's two vertices hang on: each vertex's two largest weights from `rig.json`, `vertex <i> is weighted to "<bone>" <w>, …`, then `on the idle's chains, the chain from "<first link>" carries "<bone>", …` — each chain `CHAIN_LAG` reads named once, by its first link — with a bone on no chain said, or `none of these bones hangs on a chain of the idle`); or a rest edge has length 0 A differing bone set on the failing edge or triangle names the bone and both shares. Cut attribution requires a matching config replay; otherwise the influence-cut remedy is conditional ("The weight cut"). When a vertex of the failing edge lies inside a declared contour band or at its cutoff, the detail also names the governing contour band — its region, its target bone, its declared width (`band`), and each vertex's band position and share — and says that the band's falloff governs the edge (issue #1598). The clause needs the config: on `build`, the one it ran with; on a standalone `check --rig`, the one `<rig>/run.json` (`rig-run/1`, from `rig`) names, used only when the stamp's `rig.json` and config SHA-256 both match the files on disk. Without a verified config, or when an edge vertex does not rebuild onto the contour grid, the clause is left out and the rest of the line is unchanged. | the chain tracks' `amps` on the bones that mesh is weighted to (the stretch grows with them), or the mesh's `segments` — a vertex blending two bones that swing against each other. Two chains named, with opposed amplitudes: give both one sign, or drop one — `propose --from-config` measures the pair before a build (§3, *Two chains on one lattice*). An edge whose two ends disagree on whether a bone's small share survives the 0.03 cut (one vertex keeps the bone at a few hundredths, the next drops it — read the two vertices' weights the line quotes): declare `influences: {floor: "continuous"}` on that mesh first, `rule: "heat"` second; the weight `exponent` moves the figure without removing the cut (issue #115, `reference-demo` `hair_back` as contour at tolerance 1, rig-c 2.47.1: 2.535 as drafted; continuous floor 1.422, heat 1.816, both PASS; exponent 1.5 / 3 / 4 / 6 read 2.564 / 1.902 / 2.119 / 4.816, the one pass on the same cut at another edge). When the detail names a governing contour band (an edge with a vertex inside a declared contour band or at its cutoff), go to that band's width (`meshes.<part>.contour.regions[].band`, or `meshes.<part>.contour.bust` for a derived bust band), not `meshes.<part>.influences` or mesh density: the reach is not monotonic in the band's width, so sweep it on your own rig and read both yaw directions |
|
|
7024
7025
|
| <a id="CHECK_ANIMATIONS_DO_NOT_FOLD"></a>`CHECK_ANIMATIONS_DO_NOT_FOLD` | an animation, the idle included, turns a mesh triangle over against the setup pose on some frame, read by `rigc render --folds` over the build with its physics on — and with its physics constraints left out beside it when the rig declares any, so each row reports `physics_on` and `physics_off` side by side (issues #320, #333, #363); the object names the animation and the mesh, the detail quotes rigc's line — the frames, the worst frame, which triangles, their world box and setup-pose area — and when the fold appears only with physics on, names the physics constraint(s) on the mesh's bones and the worst frame. After rigc's line it names what the worst frame's folded triangles hang on (issue #567), in `TEXTURE_STRETCH`'s words: each vertex's dominant bone is its largest weight in `rig.json`, the triangles whose vertices share one set of dominant bones are one group (the set in `rig.json`'s bone order), and each group lists its first 6 triangles (`triangles 63, 78, 79 dominated by "knee_r", "knee_l"`, past 6 `… and N more`) and spells out its first triangle's vertices — the largest two weights of each, and the idle chains those bones hang on; 3 groups are written and the rest counted (`; … and N more group(s), M triangle(s)`). An attachment the skin does not hold, or a triangle its table does not reach, is said, not guessed. Or a `may_fold` entry of the `--requirements` file names a slot and animation that does not fold: an exception that excepts nothing A differing bone set on the failing edge or triangle names the bone and both shares. Cut attribution requires a matching config replay; otherwise the influence-cut remedy is conditional ("The weight cut"). | the physics constraint(s) the line names (lower `inertia`, raise `strength`, or lower `damping`), the clip's keys on the bones the line names (a bend past what the weights carry, two bones turned toward each other until the rows between them pass, a translate that carries one row of vertices past the next), or the mesh's `segments`; to look, `rigc inspect --candidate <out>/check/build --show art,folds,mesh --animation <name> --at <the worst frame's time> --zoom folds`. A fold the art means (a sleeve behind the body) is declared, `"may_fold": [{ "slot": …, "animation": …, "why": … }]` (§7, *Declared requirements*); a stale entry is taken out |
|
|
7025
7026
|
| <a id="CHECK_FEET_STAY_LEVEL"></a>`CHECK_FEET_STAY_LEVEL` | a `footwear` part riding a bone that hangs from another turns more than ±10 degrees from its setup pose on a frame where a bone above that bone is turned (issue #348) — the bar is HQ's line (rig-c/parts#347 ruling 4), not a figure measured here; the object names the part, its bone and the bone it hangs from, the detail the animation, frame and time, the turned bone and its turn, the drawing's turn, and every bone the turn came through with its `inherit` | config.bones' `inherit` on the foot's bone (§3, `bones`): a mode that does not take the parent's rotation (`noRotationOrReflection`, `onlyTranslation`) keeps the drawing at its setup angle; which mode is the author's. Or the clip's keys on the foot's own bone, which turn the shoe whatever its mode |
|
|
@@ -7254,6 +7255,8 @@ and stay absent).
|
|
|
7254
7255
|
| <a id="SCENE_ORDER_RESOLVES"></a>`SCENE_ORDER_RESOLVES` | an order entry names no character, or `<id>:<slot>` names a slot that character does not have (its slots listed) | the entry |
|
|
7255
7256
|
| <a id="SCENE_ORDER_ONCE"></a><a id="SCENE_ORDER_COMPLETE"></a>`SCENE_ORDER_ONCE`, `SCENE_ORDER_COMPLETE` | a slot is drawn twice (a slot entry repeated, or an id listed twice), or never (the character's id is absent and some of its slots are named nowhere — they are listed) | name each slot once, or the id for the slots not named elsewhere |
|
|
7256
7257
|
| <a id="SCENE_NAME_PREFIXED"></a><a id="SCENE_NAME_RESOLVES"></a>`SCENE_NAME_PREFIXED`, `SCENE_NAME_RESOLVES` | a build's constraint, `stops` entry, `invariants.detached` or physics track names a bone or physics constraint its own character does not declare — one another character does (`…_PREFIXED`, naming the prefixed names it could have meant) or none does (`…_RESOLVES`); or a `--requirements` name (bone, target bone, constraint, slot, attachment, seam part) is a bare name some character holds, which the composed rig holds only prefixed | a bone or physics constraint of the same character; in a requirements file, `<id>:<name>` |
|
|
7258
|
+
| <a id="SCENE_BONE_PROPERTY_UNKNOWN"></a>`SCENE_BONE_PROPERTY_UNKNOWN` | the scene channel audit cannot resolve a bone track's property to a supported Spine timeline | set the named scene track's `property` to the intended timeline from the diagnostic's list and adjust its key values to match |
|
|
7259
|
+
| <a id="SCENE_CHANNEL_SHARED"></a>`SCENE_CHANNEL_SHARED` | the scene and character key the same bone axis through distinct properties in one take, or a character constraint writes a scene-keyed bone | apply the edit for the named conflict in [Scene-driven timelines](#scene-driven-timelines) |
|
|
7257
7260
|
| <a id="SCENE_ROOT_SHARED"></a>`SCENE_ROOT_SHARED` | a character's idle keys `root` (a track, or a group holding it), or one of its constraints or `stops` entries names `root`: the root is every character's, so either would move or reach them all | key, constrain or stop a bone of the character's own |
|
|
7258
7261
|
| <a id="SCENE_INVARIANT_AGREES"></a>`SCENE_INVARIANT_AGREES` | two characters declare `invariants.idleDrivesMeshes` with different `why`s | rebuild with this package's `--idle-keys direct`, whose `why` is one sentence |
|
|
7259
7262
|
| <a id="SCENE_IMAGE_NAME_FREE"></a>`SCENE_IMAGE_NAME_FREE` | two images compose to one file name (`<id>.<file>`: an id `x` with an image `y.cloth.png`, and an id `x.y` with `cloth.png`) | another id |
|
|
@@ -8079,7 +8082,7 @@ the composed idle under `<out>/check/`, at the viewport used for the shipped fra
|
|
|
8079
8082
|
| `characters[].with_idle` | map from each source physics-only clip beside `idle` to a safe integer of at least 1 or literal `false` (issue #1615). A count requires character scale 1 and folds whole periods into the played idle. `false` leaves that clip out of the idle at any character scale. Both retain the prefixed side clip, which must pass the character's scale checks. See [Physics clips and scene repeats](#physics-clips-and-scene-repeats-issue-1615) |
|
|
8080
8083
|
| `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 |
|
|
8081
8084
|
| `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 the resulting tracks and timelines 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`). See `repeats` for period-authored tracks and deforms |
|
|
8082
|
-
| `repeats` | optional map from authored take names to safe integers of at least 2 (issue #1615). Repeats the scene-authored tracks, deforms and camera keys on a single period clock. `animations.<take>.duration` is the whole take duration. `scene.json` echoes the map in declared order as its final top-level key
|
|
8085
|
+
| `repeats` | optional map from authored take names to safe integers of at least 2 (issue #1615). Repeats the scene-authored tracks, deforms and camera keys on a single period clock. `animations.<take>.duration` is the whole take duration. `scene.json` echoes the map in declared order as its final top-level key and omits it when absent. See [Physics clips and scene repeats](#physics-clips-and-scene-repeats-issue-1615) |
|
|
8083
8086
|
| `camera` | optional keyed view over composed animation names. See [Keyed scene camera](#keyed-scene-camera-issue-1596) for the camera clock, coverage requirements and opt-in report version |
|
|
8084
8087
|
| `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` |
|
|
8085
8088
|
|
|
@@ -8098,8 +8101,8 @@ Each named plate's bone is under `root` at `(0, 0)`. Its attachment centre is
|
|
|
8098
8101
|
Thus a canvas-sized named plate at `[0, 0]` has the same bone/attachment numbers
|
|
8099
8102
|
as legacy `plate`. The optional report `plates` array records each name, source
|
|
8100
8103
|
image, provenance, note, `at`, `opaque_backdrop`, bone, slot, native size and PNG
|
|
8101
|
-
SHA-256, with `judged_by: "nothing"` for the pixel-origin declaration.
|
|
8102
|
-
`plates`
|
|
8104
|
+
SHA-256, with `judged_by: "nothing"` for the pixel-origin declaration. The
|
|
8105
|
+
report includes the `plates` array only when the scene declares it. Plate motion
|
|
8103
8106
|
and depth-derived parallax are not introduced by this declaration.
|
|
8104
8107
|
|
|
8105
8108
|
Scene animation values use rigc's motion units: translations are offsets in the
|
|
@@ -8336,7 +8339,7 @@ What is composed:
|
|
|
8336
8339
|
(`CHAIN_LAG`, a `range` in degrees) does not move with it, while a requirement's
|
|
8337
8340
|
px figures and its px bar are canvas px — a character composed at 0.5 shows half
|
|
8338
8341
|
the px its own `build` measured.
|
|
8339
|
-
- **`scene.json`** (`spine-parts-scene-report/1
|
|
8342
|
+
- **`scene.json`** (`spine-parts-scene-report/1` or `/2` with a keyed camera, written at `<out>/scene.json` —
|
|
8340
8343
|
**the same filename as a typical input `--scene scene.json` file**, so write `--out`
|
|
8341
8344
|
to a separate output directory rather than the directory holding the input scene
|
|
8342
8345
|
file): the scene file's path as given,
|
|
@@ -8352,6 +8355,8 @@ What is composed:
|
|
|
8352
8355
|
(the failing bars of its own check that an accept list took, only when there are any), and the
|
|
8353
8356
|
order —
|
|
8354
8357
|
as declared and as the slot list it expands to, `judged_by: "nothing"`.
|
|
8358
|
+
After the scene's `idle_duration`, the report writes [`scene_driven`](#scene-driven-timelines),
|
|
8359
|
+
then `camera` if present and `repeats` if declared.
|
|
8355
8360
|
|
|
8356
8361
|
A default scene of one character at offset (0, 0) on a canvas of its own size,
|
|
8357
8362
|
with no plate, composes to that character's own build renamed only: on both public
|
|
@@ -8421,6 +8426,26 @@ prefix. Literal `false` plays the idle without that clip. The standalone
|
|
|
8421
8426
|
echoes the declaration. A single-animation player plays the folded keys by
|
|
8422
8427
|
selecting `idle`.
|
|
8423
8428
|
|
|
8429
|
+
Before composing, run `rig-parts check --clip-stretch <scene.json>` with the
|
|
8430
|
+
actual scene declaration. The scene's `build` paths must hold the assemble
|
|
8431
|
+
record and `rig/` outputs. This diagnostic can run before the character
|
|
8432
|
+
checks. It gates a temporary packed candidate and measures each retained
|
|
8433
|
+
named take on its own, then the declared scene idle with character repeats,
|
|
8434
|
+
`with_idle` and scene-authored tracks applied. Each take starts from reset
|
|
8435
|
+
physics and measures all the scene's meshes as posed in that take. A clip declared `false` still has its
|
|
8436
|
+
own reading. Other clips and the idle are not playing during that reading.
|
|
8437
|
+
|
|
8438
|
+
Read `CHECK_CLIP_STRETCH` for the worst mesh edge, its frame and time at
|
|
8439
|
+
12 fps, and the vertices' influences where available. The raw peak prints
|
|
8440
|
+
to six decimals. The Parts bar compares the three-decimal severity with
|
|
8441
|
+
`1.926544`, as in [`CHECK_TEXTURE_STRETCH`](#CHECK_TEXTURE_STRETCH).
|
|
8442
|
+
If a clip passes alone but the idle fails, change one input, such as the
|
|
8443
|
+
wind key's peak, and rerun the same command on the edited build and scene.
|
|
8444
|
+
Read both lines before running the regular character check and `compose`,
|
|
8445
|
+
which still makes the shipping decision. The diagnostic prints only text.
|
|
8446
|
+
Exit 0 means every take was measured and passed. Exit 1 means a failure,
|
|
8447
|
+
refusal or missing reading. Exit 2 means a usage error.
|
|
8448
|
+
|
|
8424
8449
|
Literal `false` is accepted at any character scale. The side clip still passes
|
|
8425
8450
|
through the character's scale checks, which refuse nonzero `wind` or `gravity`
|
|
8426
8451
|
at scales other than 1. A numeric declaration requires character scale 1 and
|
|
@@ -8587,8 +8612,39 @@ pixels. The model hash names the exact packed
|
|
|
8587
8612
|
`<out>/check/build/skeleton.model.json` whose poses were measured.
|
|
8588
8613
|
|
|
8589
8614
|
Backdrop raster coverage and figure framing are computed in memory. The
|
|
8590
|
-
compose input record keeps `rig-compose-run/1`.
|
|
8591
|
-
|
|
8615
|
+
compose input record keeps `rig-compose-run/1`. Scenes without a camera
|
|
8616
|
+
write report /1.
|
|
8617
|
+
|
|
8618
|
+
#### Scene-driven timelines
|
|
8619
|
+
|
|
8620
|
+
Compose writes `scene_driven` for every model take. Each take has a `view`
|
|
8621
|
+
flag that is true exactly when `scene.camera.tracks` keys that take.
|
|
8622
|
+
`timelines` lists the scene-authored model timelines after repeat splicing,
|
|
8623
|
+
including keys on placement pivots and dials. Character idle, `with_idle`
|
|
8624
|
+
folds, imported `animations_from` clips, and events are excluded. Compose
|
|
8625
|
+
lists scene-authored `drawOrder` and refuses character clips that key
|
|
8626
|
+
`drawOrder` when reading the character's build. A take with neither camera
|
|
8627
|
+
keys nor scene-authored pose timelines carries
|
|
8628
|
+
`{ "view": false, "timelines": [] }`. See the
|
|
8629
|
+
[report contract and address grammar](STABILITY.md#scene-driven-timeline-addresses).
|
|
8630
|
+
|
|
8631
|
+
A player can hold the listed timelines and the keyed view together while
|
|
8632
|
+
the character's own motion keeps playing. The player chooses the hold time
|
|
8633
|
+
on its playback clock. Use the presence of `scene_driven` to identify
|
|
8634
|
+
reports that carry the declaration. Keep the existing playback behavior
|
|
8635
|
+
for older reports with the field absent.
|
|
8636
|
+
|
|
8637
|
+
Compose refuses ambiguous writes as [`SCENE_CHANNEL_SHARED`](#SCENE_CHANNEL_SHARED)
|
|
8638
|
+
even on takes without a keyed camera.
|
|
8639
|
+
|
|
8640
|
+
| Shared write | Repair |
|
|
8641
|
+
| --- | --- |
|
|
8642
|
+
| The character keys `translate` and the scene keys `translatey` on the same bone in one take. | Remove the scene's `translatey` track to leave the Y axis to the character. |
|
|
8643
|
+
| A character constraint writes a scene-keyed bone. | Remove the scene track from the constraint's output bone and key its separate input bone where the rig exposes one. |
|
|
8644
|
+
|
|
8645
|
+
A character's life can animate a child of a scene-keyed parent. A constraint
|
|
8646
|
+
can also read a scene-keyed input, as a slider does when the scene keys its
|
|
8647
|
+
dial.
|
|
8592
8648
|
|
|
8593
8649
|
#### Animate a character's placement (issue #1498)
|
|
8594
8650
|
|
|
@@ -8658,10 +8714,9 @@ every character in the declared draw order.
|
|
|
8658
8714
|
A fully green compose writes `compose-run.json` at the `--out` root, beside
|
|
8659
8715
|
`scene.json`, with spec `rig-compose-run/1`. It removes a previous record before
|
|
8660
8716
|
the stage begins, including before stage option validation; a refused input,
|
|
8661
|
-
rig-c gate, check or accepted failing character leaves no record.
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
`check/build/run.json` retains its own clocks.
|
|
8717
|
+
rig-c gate, check or accepted failing character leaves no record. Compose
|
|
8718
|
+
uses this path across diagnostic profiles and placement options. Core's
|
|
8719
|
+
separate `check/build/run.json` retains its own clocks.
|
|
8665
8720
|
|
|
8666
8721
|
The fixed top-level key order is `spec`, `scene`, `characters`, `plate`, `plates`,
|
|
8667
8722
|
then `output_profile` when selected.
|
|
@@ -10982,7 +11037,7 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
|
|
|
10982
11037
|
| `STRESS_OFF_CHAIN.per_part` | `STRESS_OFF_CHAIN.per_part` | 'part' | finding when poses.some(p => typeof p.reading === 'number' && p.reading > STRESS_RIGID); otherwise evidence | [r.part] | [check.ts:4287](../src/check.ts#L4287) |
|
|
10983
11038
|
| `STRESS_OFF_CHAIN.per_part[].off_chain` | `STRESS_OFF_CHAIN.per_part[].off_chain` | 'part' | evidence | [r.part] | [check.ts:4287](../src/check.ts#L4287) |
|
|
10984
11039
|
| `STRESS_OFF_CHAIN.per_part[].poses` | `STRESS_OFF_CHAIN.per_part[].poses` | 'part' | evidence; finding when shown > STRESS_RIGID; otherwise evidence | [r.part] | [check.ts:4255](../src/check.ts#L4255), [check.ts:4273](../src/check.ts#L4273) |
|
|
10985
|
-
| `TEXTURE_STRETCH.per_mesh` | `TEXTURE_STRETCH.per_mesh` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when
|
|
11040
|
+
| `TEXTURE_STRETCH.per_mesh` | `TEXTURE_STRETCH.per_mesh` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when exceeds; otherwise evidence | resolved piece for m.slot; otherwise [] | [check.ts:10317](../src/check.ts#L10317), [check.ts:10324](../src/check.ts#L10324) |
|
|
10986
11041
|
| `TIP_OVER_ROOT.parts` | `TIP_OVER_ROOT.parts` | 'part' | evidence; finding when !ok && !(!rigid && hanging.onLink && Math.max(c.root, c.tip) < TIP_TRAVEL_FLOOR); otherwise evidence | [p.name] | [check.ts:8912](../src/check.ts#L8912), [check.ts:8917](../src/check.ts#L8917), [check.ts:8938](../src/check.ts#L8938), [check.ts:8949](../src/check.ts#L8949) |
|
|
10987
11042
|
| `WIND_BAND.pairs` | `WIND_BAND.pairs` | 'pair' | finding when !holdsAll; otherwise evidence | [p.a, p.b] | [check.ts:6833](../src/check.ts#L6833) |
|
|
10988
11043
|
| `WIND_BAND.pairs[].steps` | `WIND_BAND.pairs[].steps` | 'pair' | finding when !s.holds; otherwise evidence | [p.a, p.b] | [check.ts:6844](../src/check.ts#L6844) |
|
package/docs/STABILITY.md
CHANGED
|
@@ -615,7 +615,7 @@ and do not certify visibility. See the
|
|
|
615
615
|
| `compare` | `--left`, `--right`; optional `--map`, `--help` (`-h`) |
|
|
616
616
|
| `rig` | `--config`, `--parts`, `--out`; optional `--idle-keys` (ctl, direct), `--page-edges` (pot, free), `--pack-shape` (rect, polygon), `--page-size`, `--help` (`-h`) |
|
|
617
617
|
| `check-parts` | `--parts`, `--out`; optional `--json`, `--help` (`-h`) |
|
|
618
|
-
| `check` | `--rig`, `--out`; optional `--parts`, `--source`, `--page-edges`, `--pack-shape`, `--page-size`, `--requirements`, `--seam-pairs`, `--keep-stills`, `--no-extremes` (issue #829), `--set` or `--all-sets` (issue #454), `--environment` (issue #538, additive), `--wind-band` (issue #590, additive), paired `--loop-seam-bar` and `--loop-seam-cap` (issue #1590), `--json` (issue #904), `--help` (`-h`) |
|
|
618
|
+
| `check` | `--rig`, `--out`; optional `--parts`, `--source`, `--page-edges`, `--pack-shape`, `--page-size`, `--requirements`, `--seam-pairs`, `--keep-stills`, `--no-extremes` (issue #829), `--set` or `--all-sets` (issue #454), `--environment` (issue #538, additive), `--wind-band` (issue #590, additive), paired `--loop-seam-bar` and `--loop-seam-cap` (issue #1590), `--json` (issue #904), `--help` (`-h`). Standalone `--clip-stretch` takes one scene path and prints only text (issue #1623). |
|
|
619
619
|
| `loop` | `--frames`, `--out`; optional `--palette`, `--help` (`-h`) |
|
|
620
620
|
| `build` | `--config`, `--source`, `--full`, `--out`; optional `--head` (as for `assemble`), `--seam`, `--project`, `--page-edges`, `--pack-shape`, `--page-size`, `--loop`, `--lead-in`, `--requirements`, `--idle-keys`, `--seam-pairs`, `--keep-stills`, `--no-extremes` (issue #829), `--alt` (as for `assemble`, issue #454), `--set` or `--all-sets` (as for `check`, issue #454), `--environment` (as for `check`, issue #538, additive), `--wind-band` (as for `check`, issue #590, additive), `--help` (`-h`) |
|
|
621
621
|
| `compose` | `--scene`, `--out`; optional `--requirements`, `--accept`, `--page-size`, paired `--loop-seam-bar` and `--loop-seam-cap` (issue #1590), `--output-profile` (`preview`) and `--no-extremes` (issue #1610), `--help` (`-h`) |
|
|
@@ -1205,15 +1205,17 @@ execution in historical evidence is inferred from a current export.
|
|
|
1205
1205
|
| `rig.json`, `motion.json`, `mesh_report.json`, `images/`, `retune.json` | `retune` | the input revision's files, `rig.json` with `constraints` and `invariants.detached` replaced and `motion.json` with `animations.idle` replaced by the config's build, every other file byte for byte; `retune.json` is spec `rig-parts-retune/1`: `request` (`idle_keys`, `page_edges`, `pack_shape`), `versions` (`parts`, `rigc`), `input` (`rig` — `path`, `bytes`, `sha256` per file — `config_sha256`, `parts_json_sha256`), `held` (`compared`, `not_compared`), `changed` (`constraints` — each `name`, `type`, `fields` — `added`, `removed`, `idle`: `tracks_changed`, `duration` as before and after), `preserved` (`identical`, `spliced`), `revision` (per file as `input.rig`), `check` (`input`, `revision`: `pass`, `measured`, `not_met`, `skipped`, `physics`, then `line` and `status` — issue #541, additive, the spec stays `rig-parts-retune/1`: `line` is the last line `check` prints on that tree, byte for byte, and `status` every block's status as that tree's `check.json` records it, by name in the file's order — `gate`, `loop` and `seam` read from their figures, every other block its own `status`, a block the file does not write absent; `scope`) |
|
|
1206
1206
|
| `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 |
|
|
1207
1207
|
| 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. |
|
|
1208
|
-
| 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
|
|
1209
|
-
| 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 endpoint values at 0 and duration with physics omitted must agree before emission (`SCENE_ANIMATION_LOOP_CLOSES`); physics-on frames are not measured by this check.
|
|
1208
|
+
| 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 report includes its additive `plates` array with declaration, native size and PNG hash when named plates are declared. Omitting the declaration retains fixed first-plate behavior. |
|
|
1209
|
+
| 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 endpoint values at 0 and duration with physics omitted must agree before emission (`SCENE_ANIMATION_LOOP_CLOSES`); physics-on frames are not measured by this check. Core `check/build/run.json` records fresh `started_at` and `finished_at` clocks. |
|
|
1210
1210
|
| 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), and issue #1590 states in the detail that it checks posed endpoint values with physics omitted and does not measure physics-on frames. 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 omitted from this posed-value comparison, and the refusal code, acceptance, emitted rig/motion and built scene bytes are unchanged. |
|
|
1211
|
-
| 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
|
|
1212
|
-
| 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
|
|
1211
|
+
| 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 and console text for that character. 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). |
|
|
1212
|
+
| 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 retains shared-root placement. |
|
|
1213
1213
|
| `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. 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`), then optional `output_profile` (`"preview"` or `"no-extremes"`, issue #1610). 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. Identical inputs at identical supplied paths with the same output profile give identical record bytes. The receipt inventories the listed inputs and selected profile, without clocks. 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. |
|
|
1214
|
-
| compose output profiles | `compose` | Issue #1610 adds `--no-extremes` to omit only the extremes diagnostic renders, and `--output-profile preview` to also omit `check/idle_frames/`, `check/contact.png` and `check/motion_heat.png`. Preview takes precedence when both flags are given. Preview uses the stock idle render and existing readers. Before preview success, Parts removes the idle render directory, including Core's temporary contact sheet, skips copying the sheet to the check root, and skips generating heat. Each omission has a diagnostic `SKIP` line naming its selected flag. The gate, camera binding and check requirements still apply. Success prints `compose: PREVIEW — checks met; …` or `compose: NO EXTREMES — checks met; …`, respectively, and writes `output_profile` as `"preview"` or `"no-extremes"`. Default compose
|
|
1215
|
-
| 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`). `scene.json`
|
|
1216
|
-
|
|
|
1214
|
+
| compose output profiles | `compose` | Issue #1610 adds `--no-extremes` to omit only the extremes diagnostic renders, and `--output-profile preview` to also omit `check/idle_frames/`, `check/contact.png` and `check/motion_heat.png`. Preview takes precedence when both flags are given. Preview uses the stock idle render and existing readers. Before preview success, Parts removes the idle render directory, including Core's temporary contact sheet, skips copying the sheet to the check root, and skips generating heat. Each omission has a diagnostic `SKIP` line naming its selected flag. The gate, camera binding and check requirements still apply. Success prints `compose: PREVIEW — checks met; …` or `compose: NO EXTREMES — checks met; …`, respectively, and writes `output_profile` as `"preview"` or `"no-extremes"`. Default compose retains the complete diagnostics and the `compose: PASS — …` line. `COMPOSE_PREVIEW_REQUIRED_CHECK` refuses a valid loop seam pair in preview with `found=preview, required=default or no-extremes`, because the `loop_seam` record in `check.json` binds the paths and hashes of first and wrap PNGs that must remain under `check/idle_frames/`. Compose clears its owned outputs before this refusal. See [Compose output profiles](AUTHORING.md#compose-output-profiles-issue-1610). |
|
|
1215
|
+
| 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`). `scene.json` writes [`scene_driven`](#scene-driven-timeline-addresses) immediately after `idle_duration`, then `camera` when present, then the optional `repeats` map in declared order as the final top-level key. |
|
|
1216
|
+
| `scene_driven` | `compose` | Per-take view flag and scene-authored timeline addresses in `scene.json`. See [Scene-driven timeline addresses](#scene-driven-timeline-addresses). |
|
|
1217
|
+
| `SCENE_CHANNEL_SHARED` | `compose` | Refuses shared bone-axis writes and character constraints that write scene-keyed bones. See [Scene-driven timeline addresses](#scene-driven-timeline-addresses). |
|
|
1218
|
+
| keyed scene camera | `compose` | optional `camera` in `spine-parts-scene/1` (issue #1596). A camera scene writes `spine-parts-scene-report/2` at the existing `scene.json` path with its keyed camera, sampled coverage and framing verdict, and packed model SHA-256. Scenes without a camera write report /1. Both report specs include `scene_driven` on new writes. The camera path uses Core animation easing and the posed backdrop at each sampled frame. Rig, motion and stock check outputs retain their existing semantics. The compose input receipt stays `rig-compose-run/1`. See [Keyed scene camera](AUTHORING.md#keyed-scene-camera-issue-1596) |
|
|
1217
1219
|
| physics clips and scene repeats | `compose` | Issue #1615 adds `characters[].with_idle` and top-level `repeats` to `spine-parts-scene/1`. Each physics-only side clip requires literal `false` at any character scale or a safe integer count of at least 1 at scale 1. Numeric declarations fold whole periods into `idle` with exact duration equality. Both values retain `<id>:<clip>` subject to the character's scale checks, and the character report row echoes `with_idle` when declared. A scene repeat count is a safe integer of at least 2 on an authored take. Its duration remains the whole take length. Its tracks, deforms and camera keys use the exact duration divided by the count as their period. Repeated camera keys are expanded in report /2, with coverage on the full take clock and per-frame figure measurements. See [Physics clips and scene repeats](AUTHORING.md#physics-clips-and-scene-repeats-issue-1615) |
|
|
1218
1220
|
| `idle.png`, `idle-indexed.png`, `idle.gif` | `loop`, `build --loop` | APNG and GIF encodings of the rendered idle |
|
|
1219
1221
|
| `run.json` | `rig`, `assemble` | spec `rig-run/1` (issue #1165, additive): `spec`, `package` (`name`, `version`), `command` (`"rig"` or `"assemble"`), `started_at` and `finished_at` (UTC ISO-8601 millisecond timestamps ending in `Z`, read in the CLI layer), `config` (`path` relative to `--out`, `sha256` of the config file on disk), `inputs` on `assemble` (issues #1316, #1554, additive: one `{role, path, sha256}` entry for each of `--source`, `--full` and `--head` that was given, in that order, with `path` relative to `--out` by the per-platform link rule — naming `<dir>/layers.json` when given a directory — and `sha256` of the file `path` names), and `outputs` (`path` relative to `--out`, `sha256` of each written output file on disk, sorted by `path` in code-unit order and excluding `run.json` itself); written only after the command's gate is green |
|
|
@@ -1325,8 +1327,77 @@ Files authors write for this package, each with a spec id the reader holds:
|
|
|
1325
1327
|
name on purpose: they name a file format, not the tool, and a file written before
|
|
1326
1328
|
the rename still reads. They do not change at 1.0.
|
|
1327
1329
|
|
|
1330
|
+
### Scene-driven timeline addresses
|
|
1331
|
+
|
|
1332
|
+
Issue #1621 adds `scene_driven` to every new compose `scene.json` report.
|
|
1333
|
+
This is an additive report field under the existing
|
|
1334
|
+
`spine-parts-scene-report/1` and `spine-parts-scene-report/2` specs.
|
|
1335
|
+
For a scene accepted before and after this change, the packed model bytes
|
|
1336
|
+
are identical. Older reports omit the key. Readers can check for its
|
|
1337
|
+
presence while continuing to accept both report specs.
|
|
1338
|
+
|
|
1339
|
+
The map has one entry for every take in the model, keyed by its take name.
|
|
1340
|
+
Each entry contains exactly `view` (boolean) and `timelines` (array of
|
|
1341
|
+
strings), in that order. `view` is true exactly when
|
|
1342
|
+
`scene.camera.tracks` keys that take. The name `scene_driven` identifies
|
|
1343
|
+
the source of the model timelines. Camera keys supply the report's view,
|
|
1344
|
+
and `scene.animations` supplies the model timelines for this declaration.
|
|
1345
|
+
Compose derives the field from those inputs. Playback chooses its own
|
|
1346
|
+
hold time and sampling.
|
|
1347
|
+
|
|
1348
|
+
`timelines` lists the addresses of scene-authored pose timelines after
|
|
1349
|
+
`scene.repeats` splicing, using final model names. A group track contributes
|
|
1350
|
+
an ordinary address for each member Core resolves in its family (`bone`,
|
|
1351
|
+
`slot` or `physics`). Keys on a placement pivot or a dial contribute ordinary
|
|
1352
|
+
addresses. The list excludes character idle,
|
|
1353
|
+
`with_idle` folds, imported `animations_from` clips, and events. A take
|
|
1354
|
+
with neither camera keys nor scene-authored pose timelines has
|
|
1355
|
+
`{ "view": false, "timelines": [] }`.
|
|
1356
|
+
|
|
1357
|
+
| Timeline | Address |
|
|
1358
|
+
| --- | --- |
|
|
1359
|
+
| Bone property | `bone <bone>.<prop>` |
|
|
1360
|
+
| Slot property | `slot <slot>.<prop>` |
|
|
1361
|
+
| Physics, slider or path constraint property | `<family> <constraint>.<prop>` |
|
|
1362
|
+
| IK or transform constraint | `<family> <constraint>` |
|
|
1363
|
+
| Deform | `deform <skin>/<slot>/<attachment>` |
|
|
1364
|
+
| Sequence | `sequence <skin>/<slot>/<attachment>` |
|
|
1365
|
+
| Draw order | `drawOrder` |
|
|
1366
|
+
|
|
1367
|
+
The constraint family token is lower-case (`physics`, `slider`, `path`,
|
|
1368
|
+
`ik` or `transform`). Properties use their motion spec spelling. Deform and
|
|
1369
|
+
sequence both use `default` for the default skin. Each separator space, dot and
|
|
1370
|
+
slash shown in the table is literal. Within a name component, escape
|
|
1371
|
+
`%` as `%25`, space as `%20`, dot as `%2E` and slash as `%2F`.
|
|
1372
|
+
Use the uppercase escape spelling and copy every other character, including
|
|
1373
|
+
colons, verbatim. Split the address on its literal separators, then decode
|
|
1374
|
+
each name component exactly once. Sort the complete encoded addresses by
|
|
1375
|
+
JavaScript UTF-16 code-unit order.
|
|
1376
|
+
|
|
1377
|
+
For example, the default skin, slot `front left.edge` and attachment
|
|
1378
|
+
`clip/%2F` yield `sequence default/front%20left%2Eedge/clip%2F%252F`.
|
|
1379
|
+
Splitting and decoding once recovers `default`, `front left.edge` and
|
|
1380
|
+
`clip/%2F`.
|
|
1381
|
+
|
|
1382
|
+
Compose accepts existing group and sequence inputs that satisfy its
|
|
1383
|
+
validation rules, including the shared-write check below. Scene-authored
|
|
1384
|
+
`drawOrder` appears in the list. Compose refuses character clips that key
|
|
1385
|
+
`drawOrder` when reading the character's build.
|
|
1386
|
+
|
|
1387
|
+
Compose refuses `SCENE_CHANNEL_SHARED` when the scene and character
|
|
1388
|
+
producers key the same bone axis through distinct properties in one take
|
|
1389
|
+
or when a character constraint writes a scene-keyed bone. A life bone can
|
|
1390
|
+
inherit a scene-keyed parent, and a constraint can read a scene-keyed input. See the
|
|
1391
|
+
[repair examples](AUTHORING.md#scene-driven-timelines).
|
|
1392
|
+
|
|
1328
1393
|
### Check report (`rig-parts-check/1`)
|
|
1329
1394
|
|
|
1395
|
+
`check --clip-stretch <scene.json>` has its own text and exit status. It exits
|
|
1396
|
+
0 when every take has a measurable passing peak, 1 on a refusal, failing bar
|
|
1397
|
+
or missing reading, and 2 on usage errors. It writes no `check.json`,
|
|
1398
|
+
`check-run.json`, or scene output. The ordinary check report, verdict and
|
|
1399
|
+
compose admission retain their existing meanings.
|
|
1400
|
+
|
|
1330
1401
|
Spec `rig-parts-check/1` (issues #1372, #1378) is a stable contract as of
|
|
1331
1402
|
2.45.0, the first version that writes it.
|
|
1332
1403
|
|
|
@@ -2223,10 +2294,9 @@ verified even without `required`; when required, the plate needs a verified
|
|
|
2223
2294
|
receipt matching its bytes. Receipt refusals occur before compose writes new
|
|
2224
2295
|
artifacts. As before, compose creates `--out` and clears its owned outputs,
|
|
2225
2296
|
including an earlier `rig/` and `scene.json`, before input validation, so a
|
|
2226
|
-
refused re-run can remove earlier artifacts.
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
verifies file identity and records the author's edit declaration.
|
|
2297
|
+
refused re-run can remove earlier artifacts. The receipt checks apply when
|
|
2298
|
+
the field is declared. The required `provenance` field declares pixel origin.
|
|
2299
|
+
The receipt verifies file identity and records the author's edit declaration.
|
|
2230
2300
|
|
|
2231
2301
|
### Editor receipts
|
|
2232
2302
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rig-parts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.67.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/build.ts
CHANGED
|
@@ -2094,7 +2094,8 @@ export function rigStage(input: RigStageInput, rigc: RigcRunner, scratch: string
|
|
|
2094
2094
|
log(
|
|
2095
2095
|
` bones ${rig.rig.bones.length} (${rig.controls.length} control) slots ${rig.rig.slots.length} meshes ${rig.meshReport.length} regions ${regions} vertices ${vertices}; idle ${rig.motion.animations.idle.duration} s, ${tracks.length} track(s), ${keys} key(s)`,
|
|
2096
2096
|
);
|
|
2097
|
-
|
|
2097
|
+
const importedClipNames = from === null ? [] : Object.keys(from.table);
|
|
2098
|
+
if (from !== null) log(` animations beside the idle, from ${from.file} as written: ${importedClipNames.join(', ') || 'none'}`);
|
|
2098
2099
|
log(faceAxisLine(rig.faceAxis));
|
|
2099
2100
|
if (rig.turn !== null) log(turnLine(rig.turn));
|
|
2100
2101
|
for (const w of rig.turnWarnings ?? []) log(` WARN ${w.code}: ${w.object} — ${w.detail}`);
|
|
@@ -2154,6 +2155,9 @@ export function rigStage(input: RigStageInput, rigc: RigcRunner, scratch: string
|
|
|
2154
2155
|
for (const [file, img] of rig.images) writePng(join(input.out, 'images', file), img);
|
|
2155
2156
|
for (const [file, text] of texts) writeFileSync(join(input.out, file), text);
|
|
2156
2157
|
if (layout !== undefined) writeFileSync(join(input.out, LAYOUT_FILE), rigJsonText(layout));
|
|
2158
|
+
if (importedClipNames.length > 0 || Object.keys(rig.motion.animations).some(name => name !== 'idle')) {
|
|
2159
|
+
log(' Side clips have not been measured for texture stretch. Run rig-parts check --clip-stretch <scene.json> to measure them.');
|
|
2160
|
+
}
|
|
2157
2161
|
log(`rig-parts rig: wrote ${join(input.out, 'rig.json')}, motion.json, mesh_report.json and ${rig.images.length} image(s) under ${join(input.out, 'images')}`);
|
|
2158
2162
|
return rig;
|
|
2159
2163
|
}
|
|
@@ -2890,6 +2894,7 @@ export const CHECK_FLAGS_IN_BUILD: Readonly<Record<string, CheckFlagInBuild>> =
|
|
|
2890
2894
|
'--wind-band': { as: 'forwarded' },
|
|
2891
2895
|
'--loop-seam-bar': { as: 'supplied', why: 'run check or compose with --loop-seam-bar and --loop-seam-cap to measure the shipped idle' },
|
|
2892
2896
|
'--loop-seam-cap': { as: 'supplied', why: 'run check or compose with --loop-seam-bar and --loop-seam-cap to measure the shipped idle' },
|
|
2897
|
+
'--clip-stretch': { as: 'supplied', why: 'run check --clip-stretch <scene.json> to measure the scene declaration' },
|
|
2893
2898
|
'--json': { as: 'supplied', why: 'build supplies its multi-stage text report; run check --rig <out>/rig --parts <out> --out <dir> --json for the completed check object' },
|
|
2894
2899
|
};
|
|
2895
2900
|
|
package/src/check.ts
CHANGED
|
@@ -10271,6 +10271,19 @@ export function edgeBonesText(rig: Record<string, unknown>, motion: Record<strin
|
|
|
10271
10271
|
return `${parts.join(' and ')}; ${chains}`;
|
|
10272
10272
|
}
|
|
10273
10273
|
|
|
10274
|
+
/** The stock bar and the clip diagnostic use the same ratios, peak per mesh, rounding and limit. */
|
|
10275
|
+
export function measureTextureStretch(meshes: readonly MeshRest[], frames: readonly GeometryPose[]) {
|
|
10276
|
+
return stretchFigures(meshes, frames).map(mesh => {
|
|
10277
|
+
if (mesh.max === null || mesh.min === null) return { mesh, peak: null };
|
|
10278
|
+
const sMax = stretchSeverity(mesh.max.ratio);
|
|
10279
|
+
const sMin = stretchSeverity(mesh.min.ratio);
|
|
10280
|
+
const at = sMin > sMax ? mesh.min : mesh.max;
|
|
10281
|
+
const raw = Math.max(sMax, sMin);
|
|
10282
|
+
const rounded = round3(raw);
|
|
10283
|
+
return { mesh, peak: { at, raw, rounded, exceeds: rounded > TEXTURE_STRETCH_CEILING } };
|
|
10284
|
+
});
|
|
10285
|
+
}
|
|
10286
|
+
|
|
10274
10287
|
/**
|
|
10275
10288
|
* (6) No visible texture stretch: for every mesh triangle, each edge's length
|
|
10276
10289
|
* in each idle frame over its rest length (the setup pose's bones, no deform —
|
|
@@ -10285,13 +10298,13 @@ export function edgeBonesText(rig: Record<string, unknown>, motion: Record<strin
|
|
|
10285
10298
|
export function stretchLine(geo: IdleGeometry | null, path: string, problems: Problem[], bound?: Pick<CheckInputs, 'rig' | 'motion'> & WeightStepContext, slotParts?: ReadonlyMap<string, string>, skipped: ReadingSkip<'TEXTURE_STRETCH'> = skip): JudgementLine {
|
|
10286
10299
|
if (geo === null) return skipped(`${path} does not exist; \`rigc render --geometry\` (rig-c ${RIGC_GEOMETRY_VERSION} or later) writes it, and the skinned mesh vertices are read from it`, 'no-reading');
|
|
10287
10300
|
if (geo.meshes.length === 0) return skipped('the rig draws no mesh attachment (every slot is a region), so there is no triangle to stretch', 'no-meshes');
|
|
10288
|
-
const figures =
|
|
10301
|
+
const figures = measureTextureStretch(geo.meshes, geo.frames);
|
|
10289
10302
|
const rows: Array<Record<string, unknown>> = [];
|
|
10290
|
-
let worst: { mesh: (typeof figures)[number]; at:
|
|
10303
|
+
let worst: { mesh: (typeof figures)[number]['mesh']; at: StretchAt; severity: number } | null = null;
|
|
10291
10304
|
let maxAll: number | null = null;
|
|
10292
10305
|
let minAll: number | null = null;
|
|
10293
10306
|
let failed = false;
|
|
10294
|
-
for (const m of figures) {
|
|
10307
|
+
for (const { mesh: m, peak } of figures) {
|
|
10295
10308
|
if (m.degenerate.length > 0) {
|
|
10296
10309
|
failed = true;
|
|
10297
10310
|
problems.push({
|
|
@@ -10300,19 +10313,16 @@ export function stretchLine(geo: IdleGeometry | null, path: string, problems: Pr
|
|
|
10300
10313
|
detail: `${m.degenerate.length} rest edge(s) of length 0, the first triangle ${m.degenerate[0].triangle} edge ${m.degenerate[0].edge.join('-')}; no stretch ratio can be read off an edge with no rest length — two of the mesh's vertices coincide at the setup pose`,
|
|
10301
10314
|
});
|
|
10302
10315
|
}
|
|
10303
|
-
if (m.max === null || m.min === null) {
|
|
10316
|
+
if (peak === null || m.max === null || m.min === null) {
|
|
10304
10317
|
rows.push({ ...checkSlotRow('TEXTURE_STRETCH.per_mesh', false, m.slot, slotParts), slot: m.slot, triangles: m.triangles, unmeasured: 'no idle frame shows this attachment' });
|
|
10305
10318
|
continue;
|
|
10306
10319
|
}
|
|
10307
|
-
const
|
|
10308
|
-
const sMin = stretchSeverity(m.min.ratio);
|
|
10309
|
-
const at = sMin > sMax ? m.min : m.max;
|
|
10310
|
-
const severity = round3(Math.max(sMax, sMin));
|
|
10320
|
+
const { at, rounded: severity, exceeds } = peak;
|
|
10311
10321
|
if (worst === null || severity > worst.severity) worst = { mesh: m, at, severity };
|
|
10312
10322
|
maxAll = maxAll === null ? m.max.ratio : Math.max(maxAll, m.max.ratio);
|
|
10313
10323
|
minAll = minAll === null ? m.min.ratio : Math.min(minAll, m.min.ratio);
|
|
10314
|
-
rows.push({ ...checkSlotRow('TEXTURE_STRETCH.per_mesh',
|
|
10315
|
-
if (
|
|
10324
|
+
rows.push({ ...checkSlotRow('TEXTURE_STRETCH.per_mesh', exceeds, m.slot, slotParts), slot: m.slot, triangles: m.triangles, max_ratio: round3(m.max.ratio), max_at: stretchAtText(m.max), min_ratio: round3(m.min.ratio), min_at: stretchAtText(m.min), severity });
|
|
10325
|
+
if (exceeds) {
|
|
10316
10326
|
failed = true;
|
|
10317
10327
|
const step = bound === undefined ? '' : weightStepText(bound.rig, m.slot, m.attachment, at.edge, bound);
|
|
10318
10328
|
const band = bound === undefined ? '' : contourBandText(bound.rig, m.slot, m.attachment, at.edge, bound, slotParts);
|
|
@@ -10323,11 +10333,11 @@ export function stretchLine(geo: IdleGeometry | null, path: string, problems: Pr
|
|
|
10323
10333
|
});
|
|
10324
10334
|
}
|
|
10325
10335
|
}
|
|
10326
|
-
if (worst === null) return skipped(`no idle frame shows any of the rig's ${figures.length} mesh(es): ${figures.map((
|
|
10336
|
+
if (worst === null) return skipped(`no idle frame shows any of the rig's ${figures.length} mesh(es): ${figures.map(({ mesh }) => `"${mesh.slot}"`).join(', ')}`, 'no-visible-meshes');
|
|
10327
10337
|
return {
|
|
10328
10338
|
status: failed ? 'FAIL' : 'PASS',
|
|
10329
10339
|
meshes: figures.length,
|
|
10330
|
-
triangles: figures.reduce((n, m) => n + m.triangles, 0),
|
|
10340
|
+
triangles: figures.reduce((n, m) => n + m.mesh.triangles, 0),
|
|
10331
10341
|
frames: geo.frames.length,
|
|
10332
10342
|
severity: worst.severity,
|
|
10333
10343
|
severity_ceiling: TEXTURE_STRETCH_CEILING,
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import type { AttachmentRest, Frame } from '@rig-c/core/render-shared';
|
|
4
|
+
import { gateThroughRigc, type Log } from './build.ts';
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, edgeBonesText, measureTextureStretch, officialRenderer, rigcRanClause,
|
|
7
|
+
TEXTURE_STRETCH_CEILING, type RigcRunner,
|
|
8
|
+
} from './check.ts';
|
|
9
|
+
import { failLine, PartsError } from './errors.ts';
|
|
10
|
+
import { IDLE_FPS } from './motion.ts';
|
|
11
|
+
import { rigJsonText } from './rig.ts';
|
|
12
|
+
import { readSceneForClipStretch } from './scene.ts';
|
|
13
|
+
|
|
14
|
+
const CODE = 'CHECK_CLIP_STRETCH';
|
|
15
|
+
|
|
16
|
+
/** Read one take using the same Parts metric as CHECK_TEXTURE_STRETCH. */
|
|
17
|
+
export function clipStretchReading(
|
|
18
|
+
take: string,
|
|
19
|
+
rest: readonly AttachmentRest[],
|
|
20
|
+
frames: readonly Frame[],
|
|
21
|
+
rig: Record<string, unknown>,
|
|
22
|
+
motion: Record<string, unknown>,
|
|
23
|
+
log: Log,
|
|
24
|
+
): boolean {
|
|
25
|
+
const meshes = rest.filter(mesh => mesh.kind === 'mesh');
|
|
26
|
+
const poses = frames.map(({ index, attachments }) => {
|
|
27
|
+
if (attachments === undefined) throw new PartsError([{ code: CODE, object: take, detail: `frame ${index} has no attachment geometry` }]);
|
|
28
|
+
return { index, attachments };
|
|
29
|
+
});
|
|
30
|
+
const figures = measureTextureStretch(meshes, poses);
|
|
31
|
+
type Peak = NonNullable<(typeof figures)[number]['peak']>;
|
|
32
|
+
let worst: (Peak & { mesh: (typeof figures)[number]['mesh'] }) | undefined;
|
|
33
|
+
let failed = false;
|
|
34
|
+
for (const { mesh, peak } of figures) {
|
|
35
|
+
const first = mesh.degenerate[0];
|
|
36
|
+
if (first !== undefined) {
|
|
37
|
+
failed = true;
|
|
38
|
+
log(failLine({ code: CODE, object: take,
|
|
39
|
+
detail: `mesh ${JSON.stringify(mesh.slot)} attachment ${JSON.stringify(mesh.attachment)} has ${mesh.degenerate.length} rest edge(s) of length 0. First is triangle ${first.triangle}, edge ${first.edge.join('-')}, with no stretch ratio` }));
|
|
40
|
+
}
|
|
41
|
+
if (peak === null) continue;
|
|
42
|
+
if (worst === undefined || peak.raw > worst.raw) worst = { ...peak, mesh };
|
|
43
|
+
if (peak.exceeds) failed = true;
|
|
44
|
+
}
|
|
45
|
+
if (worst === undefined) {
|
|
46
|
+
if (!failed) log(` SKIP ${CODE}: ${take} — no sampled frame shows a measurable mesh triangle edge`);
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const { at, raw, rounded, mesh } = worst;
|
|
50
|
+
const time = frames.find(frame => frame.index === at.frame)!.time;
|
|
51
|
+
const detail = `peak ${raw.toFixed(6)}x (gate ${rounded.toFixed(3)}x, limit ${TEXTURE_STRETCH_CEILING}x), ${frames.length} frame${frames.length === 1 ? '' : 's'} at ${IDLE_FPS} fps, ` +
|
|
52
|
+
`mesh ${JSON.stringify(mesh.slot)} attachment ${JSON.stringify(mesh.attachment)}, triangle ${at.triangle} (vertices ${at.vertices.join(' ')}), ` +
|
|
53
|
+
`edge ${at.edge.join('-')}, frame ${at.frame} at ${time.toFixed(6)} s; ${edgeBonesText(rig, motion, mesh.slot, mesh.attachment, at.edge)}`;
|
|
54
|
+
log(failed ? failLine({ code: CODE, object: take, detail }) : ` PASS ${CODE}: ${take} — ${detail}`);
|
|
55
|
+
return !failed;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Compose in scratch, gate once, then sample each retained take without rasterizing or emitting a report. */
|
|
59
|
+
export function checkClipStretch(scene: string, scratch: string, rigc: RigcRunner, log: Log): boolean {
|
|
60
|
+
const mode = { pageEdges: DEFAULT_PAGE_EDGES, packShape: DEFAULT_PACK_SHAPE };
|
|
61
|
+
const { rig, motion, images } = readSceneForClipStretch(scene, mode);
|
|
62
|
+
let passed = true;
|
|
63
|
+
const [gate] = gateThroughRigc(images, [['rig.json', rigJsonText(rig)], ['motion.json', rigJsonText(motion)]], rigc, scratch, mode, build => {
|
|
64
|
+
const api = officialRenderer();
|
|
65
|
+
const skeleton = join(build, 'skeleton.json');
|
|
66
|
+
const atlas = join(build, 'skeleton.atlas');
|
|
67
|
+
const sceneObject = `scene ${JSON.stringify(scene)}`;
|
|
68
|
+
let object = sceneObject;
|
|
69
|
+
try {
|
|
70
|
+
const candidate = api.loadCandidate({ skeletonText: readFileSync(skeleton, 'utf8'), atlasText: readFileSync(atlas, 'utf8'), atlasDir: build, label: sceneObject }, { skeleton, atlas }, undefined);
|
|
71
|
+
const sides = Object.keys(motion.animations).filter(name => name !== 'idle');
|
|
72
|
+
for (const name of [...sides, 'idle']) {
|
|
73
|
+
object = `${name === 'idle' ? 'declared idle' : 'side clip'} ${JSON.stringify(name)}`;
|
|
74
|
+
const { value } = api.throughPoser(candidate.choice, poser => {
|
|
75
|
+
if (!poser.animations.some(animation => animation.name === name)) {
|
|
76
|
+
return { passed: false, lines: [` SKIP ${CODE}: ${object} — the gated model retained no animation by that name`] };
|
|
77
|
+
}
|
|
78
|
+
const setup = api.sampleSetupPose(poser, { geometry: true })[0];
|
|
79
|
+
const frames = api.sampleAnimation(poser, name, IDLE_FPS, { geometry: true });
|
|
80
|
+
const rest = poser.rest(undefined, [setup, ...frames].map(frame => frame.attachments ?? []));
|
|
81
|
+
const lines: string[] = [];
|
|
82
|
+
const passed = clipStretchReading(object, rest, frames, { ...rig }, { ...motion }, line => lines.push(line));
|
|
83
|
+
return { passed, lines };
|
|
84
|
+
});
|
|
85
|
+
for (const line of value.lines) log(line);
|
|
86
|
+
if (!value.passed) passed = false;
|
|
87
|
+
}
|
|
88
|
+
} catch (err) {
|
|
89
|
+
if (!(err instanceof api.CandidateAtlasError || err instanceof api.CandidatePairError || err instanceof api.CoreInputError ||
|
|
90
|
+
err instanceof api.PoserChoiceError || err instanceof api.SpineRuntimeError)) throw err;
|
|
91
|
+
throw new PartsError([{ code: CODE, object, detail: err.message }]);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
if (gate.status !== 0) throw new PartsError([{ code: CODE, object: `scene ${JSON.stringify(scene)}`,
|
|
95
|
+
detail: `rigc ${gate.label} exited ${gate.status}${rigcRanClause(gate)}${gate.lines.length === 0 ? '' : `: ${gate.lines.map(line => line.trim()).join(' | ')}`}` }]);
|
|
96
|
+
return passed;
|
|
97
|
+
}
|
package/src/scene.ts
CHANGED
|
@@ -127,7 +127,13 @@ import { clearComposeRun, COMPOSE_RUN_FILE, COMPOSE_RUN_SPEC, type ComposeRun, t
|
|
|
127
127
|
import { readRequirements, type RequirementsFile } from './requirements.ts';
|
|
128
128
|
import { OFFSET_PLACES, rigJsonText, type RigSpec } from './rig.ts';
|
|
129
129
|
import { pyRound } from './round.ts';
|
|
130
|
-
import {
|
|
130
|
+
import {
|
|
131
|
+
FORCE_PHYSICS_TRACK_PROPERTIES, isSceneBoneProperty, mergeSceneAnimations, readSceneAnimations, readSceneCamera, repeatSceneAnimations, resolveSceneCamera,
|
|
132
|
+
sceneBoneContext, sceneClipLoopProblems, sceneDrivenTakes, sceneRepeatCurveProblems, sceneRepeatSourceLoopProblems,
|
|
133
|
+
UNSCALED_PHYSICS_TRACK_PROPERTIES,
|
|
134
|
+
type ResolvedSceneCamera, type ResolvedSceneCameraTrack, type SceneAnimations, type SceneCamera, type SceneCameraSample,
|
|
135
|
+
type SceneChannelAudit, type SceneDrivenTake, type ScenePlacementPivot,
|
|
136
|
+
} from './sceneclips.ts';
|
|
131
137
|
import { repeatSceneKeys, type SceneRepeatSeam } from './scenerepeat.ts';
|
|
132
138
|
|
|
133
139
|
/** The scene file's `spec`. */
|
|
@@ -679,7 +685,7 @@ export function checkBarsFailed(ck: Readonly<Record<string, unknown>>): string[]
|
|
|
679
685
|
* from {@link barsNotMet}. Without an accept list the refusal reads as it
|
|
680
686
|
* always did.
|
|
681
687
|
*/
|
|
682
|
-
export function readCharacterBuild(c: SceneCharacter, problems: Problem[], accept: readonly string[] = []): CharacterBuild | null {
|
|
688
|
+
export function readCharacterBuild(c: SceneCharacter, problems: Problem[], accept: readonly string[] = [], checkBuild = true): CharacterBuild | null {
|
|
683
689
|
const before = problems.length;
|
|
684
690
|
const dir = c.buildDir;
|
|
685
691
|
const who = `character "${c.id}" (${c.build})`;
|
|
@@ -696,10 +702,11 @@ export function readCharacterBuild(c: SceneCharacter, problems: Problem[], accep
|
|
|
696
702
|
};
|
|
697
703
|
const json = (path: string, what: string): unknown => readJson(join(dir, path), what, problems, bytes => consumed(path, bytes));
|
|
698
704
|
if (!existsSync(dir) || !statSync(dir).isDirectory()) {
|
|
699
|
-
|
|
705
|
+
const required = checkBuild ? 'the --out of a green `rig-parts build`' : 'a directory holding parts.json and rig/';
|
|
706
|
+
problems.push({ code: 'SCENE_BUILD_PRESENT', object: who, detail: `${dir} is not a directory; ${required} is required` });
|
|
700
707
|
return null;
|
|
701
708
|
}
|
|
702
|
-
const check = json('check/check.json', "the build's own check; a build that ran its check writes it");
|
|
709
|
+
const check = checkBuild ? json('check/check.json', "the build's own check; a build that ran its check writes it") : undefined;
|
|
703
710
|
const joined = new Set([...accept, ...c.accept]);
|
|
704
711
|
let accepted: string[] = [];
|
|
705
712
|
if (check !== undefined) {
|
|
@@ -1008,8 +1015,7 @@ export const UNSCALED_TRACK_PROPERTIES: readonly string[] = ['rotate', 'scale',
|
|
|
1008
1015
|
* character cannot be reproduced by a single timeline value when the constraint drives
|
|
1009
1016
|
* both or when `referenceScale` is shared across characters (issue #1485; see {@link physicsForce}).
|
|
1010
1017
|
*/
|
|
1011
|
-
export
|
|
1012
|
-
export const FORCE_PHYSICS_TRACK_PROPERTIES: readonly string[] = ['wind', 'gravity'];
|
|
1018
|
+
export { UNSCALED_PHYSICS_TRACK_PROPERTIES, FORCE_PHYSICS_TRACK_PROPERTIES };
|
|
1013
1019
|
|
|
1014
1020
|
/** The two properties a transform constraint or a slider reads or drives in length (`propertyScale` in `SkeletonJson.js`). */
|
|
1015
1021
|
function lengthProperty(name: string): boolean {
|
|
@@ -1395,6 +1401,7 @@ interface SceneReportV1 {
|
|
|
1395
1401
|
characters: SceneCharacterReport[];
|
|
1396
1402
|
order: { declared: string[]; slots: string[]; judged_by: 'nothing' };
|
|
1397
1403
|
idle_duration: number;
|
|
1404
|
+
scene_driven: Record<string, SceneDrivenTake>;
|
|
1398
1405
|
repeats?: Record<string, number>;
|
|
1399
1406
|
}
|
|
1400
1407
|
|
|
@@ -1411,6 +1418,8 @@ export interface ComposedScene {
|
|
|
1411
1418
|
report: SceneReport;
|
|
1412
1419
|
/** Opt-in declaration retained for pre-emission pose measurement; never serialized. */
|
|
1413
1420
|
sceneAnimations?: SceneAnimations;
|
|
1421
|
+
/** Ownership verdict awaiting Core's validation. */
|
|
1422
|
+
sceneChannels?: SceneChannelAudit;
|
|
1414
1423
|
/** Compiled timeline addresses checked at the final gate; never serialized. */
|
|
1415
1424
|
repeatSeams: SceneRepeatSeam[];
|
|
1416
1425
|
sceneCamera?: ResolvedSceneCamera;
|
|
@@ -1935,10 +1944,9 @@ export function composeScene(
|
|
|
1935
1944
|
};
|
|
1936
1945
|
// A generated pivot must not resolve an undeclared source bone reference.
|
|
1937
1946
|
// Group members can also be slots or physics constraints, depending on the property.
|
|
1938
|
-
const isBoneProperty = (property: string): boolean => SCALED_TRACK_PROPERTIES.includes(property) || UNSCALED_TRACK_PROPERTIES.includes(property);
|
|
1939
1947
|
const sceneBoneGroups = new Set<string>();
|
|
1940
1948
|
if (pivots.size > 0) for (const clip of Object.values(scene.animations ?? {})) for (const track of clip.tracks) {
|
|
1941
|
-
if (track.group !== undefined &&
|
|
1949
|
+
if (track.group !== undefined && isSceneBoneProperty(track.property)) sceneBoneGroups.add(track.group);
|
|
1942
1950
|
}
|
|
1943
1951
|
for (const b of ready) if (pivots.has(b.id) && !bonesOf.get(b.id)?.has(PLACEMENT_BONE)) {
|
|
1944
1952
|
const check = (name: unknown, where: string): void => {
|
|
@@ -1954,7 +1962,7 @@ export function composeScene(
|
|
|
1954
1962
|
const boneGroups = new Set(Object.keys(b.motion.groups).filter(group => sceneBoneGroups.has(prefixed(b.id, group))));
|
|
1955
1963
|
for (const [name, anim] of Object.entries(animationsOf(b.motion))) for (const [i, track] of anim.tracks.entries()) {
|
|
1956
1964
|
check(track.bone, `motion.json animations.${name}.tracks[${i}].bone`);
|
|
1957
|
-
if (track.group !== undefined &&
|
|
1965
|
+
if (track.group !== undefined && isSceneBoneProperty(track.property)) boneGroups.add(track.group);
|
|
1958
1966
|
}
|
|
1959
1967
|
for (const group of boneGroups) {
|
|
1960
1968
|
if (b.motion.groups[group]?.includes(PLACEMENT_BONE)) check(PLACEMENT_BONE, `motion.json groups.${group}`);
|
|
@@ -2312,7 +2320,7 @@ export function composeScene(
|
|
|
2312
2320
|
}
|
|
2313
2321
|
for (const [animation, clip] of Object.entries(scene.animations)) for (const [i, track] of clip.tracks.entries()) {
|
|
2314
2322
|
const group = track.group;
|
|
2315
|
-
const members = group !== undefined &&
|
|
2323
|
+
const members = group !== undefined && isSceneBoneProperty(track.property) && Object.hasOwn(groups, group) ? groups[group] : [];
|
|
2316
2324
|
const targets = track.bone === undefined ? members : [track.bone];
|
|
2317
2325
|
for (const bone of new Set(targets)) {
|
|
2318
2326
|
const id = undeclaredPivots.get(bone);
|
|
@@ -2326,12 +2334,13 @@ export function composeScene(
|
|
|
2326
2334
|
}
|
|
2327
2335
|
let sceneAnimations = scene.animations;
|
|
2328
2336
|
let sceneCamera: ResolvedSceneCamera | undefined;
|
|
2337
|
+
let sceneChannels: SceneChannelAudit | undefined;
|
|
2329
2338
|
try {
|
|
2330
2339
|
if (scene.repeats !== undefined) {
|
|
2331
2340
|
const repeated = repeatSceneAnimations(scene.animations, motion.groups, scene.repeats, repeatSeams);
|
|
2332
2341
|
if (scene.animations !== undefined) sceneAnimations = repeated;
|
|
2333
2342
|
}
|
|
2334
|
-
if (sceneAnimations !== undefined || pivots.size > 0) mergeSceneAnimations(rig, motion, sceneAnimations ?? {}, [...pivots.values()]);
|
|
2343
|
+
if (sceneAnimations !== undefined || pivots.size > 0) sceneChannels = mergeSceneAnimations(rig, motion, sceneAnimations ?? {}, [...pivots.values()]);
|
|
2335
2344
|
if (scene.camera !== undefined) sceneCamera = resolveSceneCamera(scene.camera, motion, scene.repeats);
|
|
2336
2345
|
} catch (err) {
|
|
2337
2346
|
if (!(err instanceof PartsError) || sceneIdleRepeat === undefined || idleClockFields.length === 0) throw err;
|
|
@@ -2363,9 +2372,15 @@ export function composeScene(
|
|
|
2363
2372
|
characters: rows,
|
|
2364
2373
|
order: { declared: [...scene.order], slots: slots.map((s) => s.name), judged_by: 'nothing' },
|
|
2365
2374
|
idle_duration: idleDuration,
|
|
2375
|
+
scene_driven: sceneDrivenTakes(motion, sceneAnimations, sceneCamera),
|
|
2366
2376
|
...(scene.repeats === undefined ? {} : { repeats: { ...scene.repeats } }),
|
|
2367
2377
|
};
|
|
2368
|
-
return {
|
|
2378
|
+
return {
|
|
2379
|
+
rig, motion, images, report, repeatSeams,
|
|
2380
|
+
...(sceneAnimations === undefined ? {} : { sceneAnimations }),
|
|
2381
|
+
...(sceneCamera === undefined ? {} : { sceneCamera }),
|
|
2382
|
+
...(sceneChannels === undefined ? {} : { sceneChannels }),
|
|
2383
|
+
};
|
|
2369
2384
|
}
|
|
2370
2385
|
|
|
2371
2386
|
// ---------------------------------------------------------------------------
|
|
@@ -2522,17 +2537,10 @@ export function unprefixedNames(rig: RigSpec, motion: MotionSpec, ids: readonly
|
|
|
2522
2537
|
// the stage
|
|
2523
2538
|
// ---------------------------------------------------------------------------
|
|
2524
2539
|
|
|
2525
|
-
|
|
2526
|
-
* Everything before the gate, from the files: the scene, every character's
|
|
2527
|
-
* build (with `accept`, `compose --accept`, issue #203), the plate and the
|
|
2528
|
-
* `--requirements` file, each read with its problems collected, then
|
|
2529
|
-
* {@link composeScene} — one refusal naming every problem the
|
|
2530
|
-
* files hold. Pure but for the reads.
|
|
2531
|
-
*/
|
|
2532
|
-
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 } {
|
|
2540
|
+
function readSceneComposition(scenePath: string, mode: PackMode, accept: readonly string[], checkBuilds: boolean, requirementsPath?: string, verifyRepeatSource?: (build: CharacterBuild, object: string) => void) {
|
|
2533
2541
|
const scene = loadScene(scenePath);
|
|
2534
2542
|
const problems: Problem[] = acceptProblems(accept, '--accept');
|
|
2535
|
-
const builds = scene.characters.map((c) => readCharacterBuild(c, problems, accept));
|
|
2543
|
+
const builds = scene.characters.map((c) => readCharacterBuild(c, problems, accept, checkBuilds));
|
|
2536
2544
|
let plate: PlateImage | null = null;
|
|
2537
2545
|
if (scene.plate !== null) {
|
|
2538
2546
|
const ledger = readEditorReceipts(scene.plate.editor_receipts, scene.path, 'scene.plate.editor_receipts', 'scene file');
|
|
@@ -2579,6 +2587,21 @@ export function composeFromFiles(scenePath: string, requirementsPath?: string, m
|
|
|
2579
2587
|
}
|
|
2580
2588
|
}
|
|
2581
2589
|
const composed = composeScene(scene, builds, plate, problems, mode, req, plateLayers, verifyRepeatSource);
|
|
2590
|
+
return { scene, builds, plate, plateLayers, composed };
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
/** Read the declared composition before character checks. The diagnostic gates its own scratch candidate. */
|
|
2594
|
+
export function readSceneForClipStretch(scenePath: string, mode: PackMode): Pick<ComposedScene, 'rig' | 'motion' | 'images'> {
|
|
2595
|
+
return readSceneComposition(scenePath, mode, [], false).composed;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
/**
|
|
2599
|
+
* Everything before the compose gate: read the scene, every character's
|
|
2600
|
+
* checked build (with `compose --accept`, issue #203), plates and requirements,
|
|
2601
|
+
* then compose the scene and bind the inputs in the run record.
|
|
2602
|
+
*/
|
|
2603
|
+
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 } {
|
|
2604
|
+
const { scene, builds, plate, plateLayers, composed } = readSceneComposition(scenePath, mode, accept, true, requirementsPath, verifyRepeatSource);
|
|
2582
2605
|
const runRecord: ComposeRun = {
|
|
2583
2606
|
spec: COMPOSE_RUN_SPEC,
|
|
2584
2607
|
scene: { path: scenePath, sha256: scene.sha256 },
|
|
@@ -2716,8 +2739,9 @@ export function composeStage(input: ComposeInput, run: ComposeRunners, log: Log)
|
|
|
2716
2739
|
const gated: { camera?: CameraEvidence } = {};
|
|
2717
2740
|
let gate: ReturnType<typeof gateThroughRigc>;
|
|
2718
2741
|
try {
|
|
2719
|
-
const { sceneAnimations: clips, repeatSeams } = composed;
|
|
2742
|
+
const { sceneAnimations: clips, repeatSeams, sceneChannels } = composed;
|
|
2720
2743
|
const checkMotion = (build: string): void => {
|
|
2744
|
+
refuseIfAny(sceneChannels?.problems ?? []);
|
|
2721
2745
|
if (clips === undefined && repeatSeams.length === 0) return;
|
|
2722
2746
|
const modelText = readFileSync(join(build, CAMERA_MODEL), 'utf8');
|
|
2723
2747
|
refuseIfAny(sceneRepeatCurveProblems(modelText, repeatSeams));
|
package/src/sceneclips.ts
CHANGED
|
@@ -43,6 +43,79 @@ export interface ResolvedSceneCamera {
|
|
|
43
43
|
tracks: ReadonlyMap<string, ResolvedSceneCameraTrack>;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
export interface SceneDrivenTake {
|
|
47
|
+
view: boolean;
|
|
48
|
+
timelines: string[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Local bone axes written by each Spine 4.x timeline property. */
|
|
52
|
+
export const SCENE_BONE_AXES: Readonly<Record<string, readonly string[]>> = {
|
|
53
|
+
translate: ['x', 'y'],
|
|
54
|
+
translatex: ['x'],
|
|
55
|
+
translatey: ['y'],
|
|
56
|
+
scale: ['scaleX', 'scaleY'],
|
|
57
|
+
scalex: ['scaleX'],
|
|
58
|
+
scaley: ['scaleY'],
|
|
59
|
+
shear: ['shearX', 'shearY'],
|
|
60
|
+
shearx: ['shearX'],
|
|
61
|
+
sheary: ['shearY'],
|
|
62
|
+
rotate: ['rotation'],
|
|
63
|
+
inherit: ['inherit'],
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export function isSceneBoneProperty(property: string): boolean {
|
|
67
|
+
return Object.hasOwn(SCENE_BONE_AXES, property);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
type SceneTrack = SceneAnimations[string]['tracks'][number];
|
|
71
|
+
|
|
72
|
+
export const UNSCALED_PHYSICS_TRACK_PROPERTIES: readonly string[] = ['inertia', 'strength', 'damping', 'mass', 'mix', 'reset'];
|
|
73
|
+
export const FORCE_PHYSICS_TRACK_PROPERTIES: readonly string[] = ['wind', 'gravity'];
|
|
74
|
+
|
|
75
|
+
function trackTargets(track: SceneTrack, groups: MotionSpec['groups']): string[] {
|
|
76
|
+
const direct = track.bone ?? track.slot ?? track.physics ?? track.path ?? track.slider;
|
|
77
|
+
if (direct !== undefined) return [direct];
|
|
78
|
+
return track.group !== undefined && Object.hasOwn(groups, track.group) ? groups[track.group] : [];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function trackFamily(track: SceneTrack): 'bone' | 'slot' | 'physics' | 'path' | 'slider' {
|
|
82
|
+
if (track.physics !== undefined) return 'physics';
|
|
83
|
+
if (track.path !== undefined) return 'path';
|
|
84
|
+
if (track.slider !== undefined) return 'slider';
|
|
85
|
+
if (track.group !== undefined && (UNSCALED_PHYSICS_TRACK_PROPERTIES.includes(track.property) ||
|
|
86
|
+
FORCE_PHYSICS_TRACK_PROPERTIES.includes(track.property))) return 'physics';
|
|
87
|
+
if (track.bone !== undefined) return 'bone';
|
|
88
|
+
if (isSceneBoneProperty(track.property)) return 'bone';
|
|
89
|
+
return 'slot'; // Core validates that the property belongs to this family.
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function timelineName(name: string): string {
|
|
93
|
+
return name.replaceAll('%', '%25').replaceAll(' ', '%20').replaceAll('.', '%2E').replaceAll('/', '%2F');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Report authored scene addresses on the composed clock. Core validates the targets at the gate. */
|
|
97
|
+
export function sceneDrivenTakes(motion: MotionSpec, clips?: SceneAnimations, camera?: ResolvedSceneCamera): Record<string, SceneDrivenTake> {
|
|
98
|
+
return Object.fromEntries(Object.keys(motion.animations).sort().map(name => {
|
|
99
|
+
const clip = clips !== undefined && Object.hasOwn(clips, name) ? clips[name] : undefined;
|
|
100
|
+
const timelines: string[] = [];
|
|
101
|
+
for (const track of clip?.tracks ?? []) {
|
|
102
|
+
const family = trackFamily(track);
|
|
103
|
+
for (const target of trackTargets(track, motion.groups)) timelines.push(`${family} ${timelineName(target)}.${track.property}`);
|
|
104
|
+
}
|
|
105
|
+
for (const family of ['ik', 'transform'] as const) {
|
|
106
|
+
for (const track of clip?.[family] ?? []) timelines.push(`${family} ${timelineName(track.constraint)}`);
|
|
107
|
+
}
|
|
108
|
+
for (const family of ['deform', 'sequence'] as const) {
|
|
109
|
+
for (const track of clip?.[family] ?? []) {
|
|
110
|
+
const target = [track.skin ?? 'default', track.slot, track.attachment].map(timelineName).join('/');
|
|
111
|
+
timelines.push(`${family} ${target}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (clip?.drawOrder?.length) timelines.push('drawOrder');
|
|
115
|
+
return [name, { view: camera?.tracks.has(name) ?? false, timelines: timelines.sort() }];
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
|
|
46
119
|
const CAMERA_TRACK = 'SCENE_CAMERA_TRACK';
|
|
47
120
|
const CAMERA_LOOP = 'SCENE_CAMERA_LOOP_CLOSES';
|
|
48
121
|
const CAMERA_PAN_CURVE_LENGTH = 8;
|
|
@@ -445,8 +518,9 @@ function sliderInputChannel(source: unknown, property: string): number | null {
|
|
|
445
518
|
}
|
|
446
519
|
|
|
447
520
|
/** Append timelines without changing existing idle payloads or character physics. */
|
|
448
|
-
export function mergeSceneAnimations(rig: RigSpec, motion: MotionSpec, clips: SceneAnimations, pivots: readonly ScenePlacementPivot[] = []):
|
|
521
|
+
export function mergeSceneAnimations(rig: RigSpec, motion: MotionSpec, clips: SceneAnimations, pivots: readonly ScenePlacementPivot[] = []): SceneChannelAudit {
|
|
449
522
|
const problems = placementTrackProblems(clips, pivots);
|
|
523
|
+
const audit: SceneChannelAudit = { problems: [] };
|
|
450
524
|
const animations = motion.animations as unknown as SceneAnimations;
|
|
451
525
|
for (const [name, clip] of Object.entries(clips)) {
|
|
452
526
|
const existing = Object.hasOwn(animations, name) ? animations[name] : undefined;
|
|
@@ -466,7 +540,7 @@ export function mergeSceneAnimations(rig: RigSpec, motion: MotionSpec, clips: Sc
|
|
|
466
540
|
detail: `animation "${name}": unknown group "${track.group}"; an own declared group is required` });
|
|
467
541
|
continue;
|
|
468
542
|
}
|
|
469
|
-
const targets = track
|
|
543
|
+
const targets = trackFamily(track) === 'bone' ? trackTargets(track, motion.groups) : [];
|
|
470
544
|
for (const bone of targets) for (const slider of rig.constraints ?? []) {
|
|
471
545
|
if (slider.type !== 'slider' || slider.bone !== bone) continue;
|
|
472
546
|
const channel = sliderInputChannel(slider.property, track.property);
|
|
@@ -492,6 +566,7 @@ export function mergeSceneAnimations(rig: RigSpec, motion: MotionSpec, clips: Sc
|
|
|
492
566
|
}
|
|
493
567
|
}
|
|
494
568
|
}
|
|
569
|
+
audit.problems.push(...sharedBoneAxes(name, clip, existing, motion.groups));
|
|
495
570
|
if (existing === undefined) Object.defineProperty(animations, name, { value: structuredClone(clip), enumerable: true, configurable: true, writable: true });
|
|
496
571
|
else {
|
|
497
572
|
// Core rejects overlapping property claims after expansion, including group/bone collisions.
|
|
@@ -503,6 +578,92 @@ export function mergeSceneAnimations(rig: RigSpec, motion: MotionSpec, clips: Sc
|
|
|
503
578
|
}
|
|
504
579
|
}
|
|
505
580
|
refuseIfAny(problems);
|
|
581
|
+
const writers = characterConstraintWriters(rig, motion.groups, animations);
|
|
582
|
+
for (const [name, clip] of Object.entries(clips)) {
|
|
583
|
+
const bones = boneProperties(clip, motion.groups);
|
|
584
|
+
for (const [bone, properties] of bones) for (const constraint of writers.get(bone) ?? []) {
|
|
585
|
+
const keys = [...properties].map(p => JSON.stringify(p)).join(', ');
|
|
586
|
+
audit.problems.push({
|
|
587
|
+
code: 'SCENE_CHANNEL_SHARED', object: `scene.animations.${name} bone ${JSON.stringify(bone)}`,
|
|
588
|
+
detail: `the scene producer keys ${keys}; the character producer's ${constraint} writes this bone`,
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
return audit;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/** Check after Core's gate so its existing property and input refusals take precedence. */
|
|
596
|
+
export interface SceneChannelAudit {
|
|
597
|
+
problems: Problem[];
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
function boneProperties(clip: SceneAnimations[string] | undefined, groups: MotionSpec['groups']): Map<string, Set<string>> {
|
|
601
|
+
const bones = new Map<string, Set<string>>();
|
|
602
|
+
for (const track of clip?.tracks ?? []) {
|
|
603
|
+
if (trackFamily(track) !== 'bone') continue;
|
|
604
|
+
for (const bone of trackTargets(track, groups)) {
|
|
605
|
+
const properties = bones.get(bone) ?? new Set<string>();
|
|
606
|
+
properties.add(track.property);
|
|
607
|
+
bones.set(bone, properties);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
return bones;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
function sharedBoneAxes(name: string, clip: SceneAnimations[string], existing: SceneAnimations[string] | undefined,
|
|
614
|
+
groups: MotionSpec['groups']): Problem[] {
|
|
615
|
+
const problems: Problem[] = [];
|
|
616
|
+
const character = boneProperties(existing, groups);
|
|
617
|
+
for (const [bone, properties] of boneProperties(clip, groups)) {
|
|
618
|
+
const object = `scene.animations.${name} bone ${JSON.stringify(bone)}`;
|
|
619
|
+
for (const scene of properties) {
|
|
620
|
+
if (!isSceneBoneProperty(scene)) {
|
|
621
|
+
problems.push({ code: 'SCENE_BONE_PROPERTY_UNKNOWN', object,
|
|
622
|
+
detail: `the scene producer keys ${JSON.stringify(scene)}; the Spine 4.x axes table covers ${Object.keys(SCENE_BONE_AXES).join(', ')}` });
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
for (const other of character.get(bone) ?? []) {
|
|
626
|
+
if (scene === other || !isSceneBoneProperty(other)) continue;
|
|
627
|
+
const axes = SCENE_BONE_AXES[scene].filter(axis => SCENE_BONE_AXES[other].includes(axis));
|
|
628
|
+
if (axes.length > 0) problems.push({
|
|
629
|
+
code: 'SCENE_CHANNEL_SHARED', object,
|
|
630
|
+
detail: `the scene producer's ${JSON.stringify(scene)} and the character producer's ${JSON.stringify(other)} both key ${axes.join(', ')}`,
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
return problems;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
function characterConstraintWriters(rig: RigSpec, groups: MotionSpec['groups'], animations: SceneAnimations): Map<string, string[]> {
|
|
639
|
+
const writers = new Map<string, string[]>();
|
|
640
|
+
const register = (family: string, name: unknown, bones: readonly unknown[]): void => {
|
|
641
|
+
for (const bone of bones) {
|
|
642
|
+
if (typeof bone !== 'string') continue;
|
|
643
|
+
const constraints = writers.get(bone) ?? [];
|
|
644
|
+
constraints.push(`${family} constraint ${JSON.stringify(name)}`);
|
|
645
|
+
writers.set(bone, constraints);
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
for (const constraint of rig.constraints ?? []) {
|
|
649
|
+
switch (constraint.type) {
|
|
650
|
+
case 'ik': case 'transform': case 'path':
|
|
651
|
+
if (Array.isArray(constraint.bones)) register(constraint.type, constraint.name, constraint.bones);
|
|
652
|
+
break;
|
|
653
|
+
case 'physics':
|
|
654
|
+
register('physics', constraint.name, [constraint.bone]);
|
|
655
|
+
break;
|
|
656
|
+
case 'slider': {
|
|
657
|
+
// The dial is an input. The slider writes the bones keyed by its referenced animation.
|
|
658
|
+
const name = constraint.animation;
|
|
659
|
+
if (typeof name === 'string' && Object.hasOwn(animations, name)) {
|
|
660
|
+
register('slider', constraint.name, [...boneProperties(animations[name], groups).keys()]);
|
|
661
|
+
}
|
|
662
|
+
break;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
return writers;
|
|
506
667
|
}
|
|
507
668
|
|
|
508
669
|
/** Add character context to Core's existing unknown-bone sentence, without changing its code. */
|