rig-parts 2.65.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 +89 -14
- package/docs/STABILITY.md +98 -12
- package/package.json +2 -1
- package/src/build.ts +6 -1
- package/src/check.ts +22 -12
- package/src/clipstretch.ts +97 -0
- package/src/physics-clips.ts +50 -0
- package/src/scene.ts +76 -45
- 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 |
|
|
@@ -7227,7 +7228,8 @@ and stay absent).
|
|
|
7227
7228
|
| <a id="SCENE_REPEAT_DURATION"></a>`SCENE_REPEAT_DURATION` | the declared idle duration disagrees with a character’s source period times its playback count, or `scene.repeats` names a take without a positive authored duration or with animation keys ending off the period clock | use the exact finite, positive product for every character. Declare the whole take duration and make the latest effective scene animation key end exactly at duration divided by the scene repeat count |
|
|
7228
7229
|
| <a id="SCENE_PHYSICS_CLIP_DECLARED"></a>`SCENE_PHYSICS_CLIP_DECLARED` | a character’s physics-only clip beside `idle` lacks a declaration. The refusal names the character, clip and distinct keyed constraint count | declare literal `false` in `with_idle` at any scale, or declare a whole-period count at scale 1 |
|
|
7229
7230
|
| <a id="SCENE_PHYSICS_CLIP_ONLY"></a>`SCENE_PHYSICS_CLIP_ONLY` | a `with_idle` entry names `idle`, an absent clip, a clip with no physics keys or a clip with other timelines | use the source name of a physics-only clip beside `idle`. This applies to counts and to `false` |
|
|
7230
|
-
| <a id="
|
|
7231
|
+
| <a id="PHYSICS_CLIPS_MOTION"></a>`PHYSICS_CLIPS_MOTION` | `physicsOnlyClips` receives an invalid motion document | parse the source `motion.json` and supply a valid `rigc-motion/1` document |
|
|
7232
|
+
| <a id="SCENE_WITH_IDLE_DURATION"></a>`SCENE_WITH_IDLE_DURATION` | a numeric `with_idle` entry implies a duration different from the played idle. The refusal names the clip and the conflicting lengths. The diagnostic searches up to 10,000 copies of each source. Acceptance depends on exact duration equality regardless of that search bound | use the suggested whole-period counts when available. The diagnostic can also suggest a scene repeat count, total idle duration and camera terminal key when it knows the scene period. Otherwise determine the scene period before setting `scene.repeats.idle`. You can also retime the source clip supplied through `motion.animations_from`, adjust the source idle with `motion.duration`, or declare `false` |
|
|
7231
7233
|
| <a id="SCENE_REPEAT_SOURCE_LOOP_CLOSES"></a>`SCENE_REPEAT_SOURCE_LOOP_CLOSES` | a repeated source idle has a loop flag other than `true`, or its original gated keyed poses at the start and stored end do not close or cannot be read | use a closed source idle with `loop: true` and correct the named pose channel |
|
|
7232
7234
|
| <a id="SCENE_REPEAT_KEY_SEAM"></a>`SCENE_REPEAT_KEY_SEAM` | a repeated source timeline cannot be spliced on its effective key clock, for example because of a setup gap, an unequal boundary state or left limit, a reset at the boundary or a period that collapses on the playback clock. Repeated scene animations also refuse timeline families without a defined splice | author a state timeline that starts at effective time zero and closes continuously, with any explicit reset strictly inside the source period and separate on Core's playback clock |
|
|
7233
7235
|
| <a id="CE_COMPILE_ANIMATION_GROUP_UNKNOWN"></a>`CE_COMPILE_ANIMATION_GROUP_UNKNOWN` | a scene track names no own declared group, including inherited object names such as `constructor` | name an explicitly declared final group; prototype properties are not groups |
|
|
@@ -7253,6 +7255,8 @@ and stay absent).
|
|
|
7253
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 |
|
|
7254
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 |
|
|
7255
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) |
|
|
7256
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 |
|
|
7257
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 |
|
|
7258
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 |
|
|
@@ -8078,7 +8082,7 @@ the composed idle under `<out>/check/`, at the viewport used for the shipped fra
|
|
|
8078
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) |
|
|
8079
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 |
|
|
8080
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 |
|
|
8081
|
-
| `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. See [Physics clips and scene repeats](#physics-clips-and-scene-repeats-issue-1615) |
|
|
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) |
|
|
8082
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 |
|
|
8083
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` |
|
|
8084
8088
|
|
|
@@ -8097,8 +8101,8 @@ Each named plate's bone is under `root` at `(0, 0)`. Its attachment centre is
|
|
|
8097
8101
|
Thus a canvas-sized named plate at `[0, 0]` has the same bone/attachment numbers
|
|
8098
8102
|
as legacy `plate`. The optional report `plates` array records each name, source
|
|
8099
8103
|
image, provenance, note, `at`, `opaque_backdrop`, bone, slot, native size and PNG
|
|
8100
|
-
SHA-256, with `judged_by: "nothing"` for the pixel-origin declaration.
|
|
8101
|
-
`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
|
|
8102
8106
|
and depth-derived parallax are not introduced by this declaration.
|
|
8103
8107
|
|
|
8104
8108
|
Scene animation values use rigc's motion units: translations are offsets in the
|
|
@@ -8335,7 +8339,7 @@ What is composed:
|
|
|
8335
8339
|
(`CHAIN_LAG`, a `range` in degrees) does not move with it, while a requirement's
|
|
8336
8340
|
px figures and its px bar are canvas px — a character composed at 0.5 shows half
|
|
8337
8341
|
the px its own `build` measured.
|
|
8338
|
-
- **`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` —
|
|
8339
8343
|
**the same filename as a typical input `--scene scene.json` file**, so write `--out`
|
|
8340
8344
|
to a separate output directory rather than the directory holding the input scene
|
|
8341
8345
|
file): the scene file's path as given,
|
|
@@ -8351,6 +8355,8 @@ What is composed:
|
|
|
8351
8355
|
(the failing bars of its own check that an accept list took, only when there are any), and the
|
|
8352
8356
|
order —
|
|
8353
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.
|
|
8354
8360
|
|
|
8355
8361
|
A default scene of one character at offset (0, 0) on a canvas of its own size,
|
|
8356
8362
|
with no plate, composes to that character's own build renamed only: on both public
|
|
@@ -8402,8 +8408,17 @@ seam evidence after the run. This refusal clears `rig/`, `check/`, `scene.json`
|
|
|
8402
8408
|
#### Physics clips and scene repeats (issue #1615)
|
|
8403
8409
|
|
|
8404
8410
|
A physics-only side clip typically enters a character build through
|
|
8405
|
-
`motion.animations_from`. It has at least one track, every track targets
|
|
8406
|
-
physics constraint
|
|
8411
|
+
`motion.animations_from`. It has at least one track, every track targets only
|
|
8412
|
+
a named physics constraint, and every other animation payload is empty or
|
|
8413
|
+
absent. Clip metadata such as `loop` and `note` is allowed.
|
|
8414
|
+
|
|
8415
|
+
To discover the source clip names for `with_idle`, import `physicsOnlyClips`
|
|
8416
|
+
from `@rig-c/parts/physics-clips` and pass the parsed `rigc-motion/1` value from
|
|
8417
|
+
the character's `motion.json`. `compose` uses the same export. It returns
|
|
8418
|
+
`{ name, duration, constraints }` rows in source animation order, excluding
|
|
8419
|
+
`idle`. Constraint names are distinct and follow first-keyed order. If no clips
|
|
8420
|
+
match, it returns `[]`. Invalid motion raises [`PHYSICS_CLIPS_MOTION`](#PHYSICS_CLIPS_MOTION).
|
|
8421
|
+
|
|
8407
8422
|
Declare each such clip by its source name in `characters[].with_idle`. A count
|
|
8408
8423
|
copies that many whole periods into the composed `idle` with the character's
|
|
8409
8424
|
prefix. Literal `false` plays the idle without that clip. The standalone
|
|
@@ -8411,6 +8426,26 @@ prefix. Literal `false` plays the idle without that clip. The standalone
|
|
|
8411
8426
|
echoes the declaration. A single-animation player plays the folded keys by
|
|
8412
8427
|
selecting `idle`.
|
|
8413
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
|
+
|
|
8414
8449
|
Literal `false` is accepted at any character scale. The side clip still passes
|
|
8415
8450
|
through the character's scale checks, which refuse nonzero `wind` or `gravity`
|
|
8416
8451
|
at scales other than 1. A numeric declaration requires character scale 1 and
|
|
@@ -8421,6 +8456,16 @@ Use `idle_repeats` and an explicit scene idle duration when the character idle
|
|
|
8421
8456
|
also needs to fill multiple periods. The counts for the idle and the physics
|
|
8422
8457
|
clip may differ as long as their products agree exactly.
|
|
8423
8458
|
|
|
8459
|
+
For example, when the diagnostic finds a shared 3 s duration and the scene's
|
|
8460
|
+
own period also fits, it can advise `idle_repeats: 3`, `with_idle.wind: 2`,
|
|
8461
|
+
`scene.repeats.idle: 3`, and `scene.animations.idle.duration: 3`. The composed
|
|
8462
|
+
camera ends at 3 s and its authored terminal key stays at 1 s. When the
|
|
8463
|
+
scene's period is undeclared, the advice gives
|
|
8464
|
+
`idle_repeats: 3` and `with_idle.wind: 2` (3 s) and explains that a
|
|
8465
|
+
`scene.repeats` count requires the scene's own period. When one source idle
|
|
8466
|
+
period is enough, omit `idle_repeats`. For a matching untiled scene, also
|
|
8467
|
+
omit `scene.repeats.idle` and keep the current scene duration and camera end.
|
|
8468
|
+
|
|
8424
8469
|
Set `scene.repeats.<take>` to author the scene animation and any camera track
|
|
8425
8470
|
for that take over a shared period. Give `scene.animations.<take>.duration`
|
|
8426
8471
|
the positive whole take length and divide it by the scene repeat count to get
|
|
@@ -8567,8 +8612,39 @@ pixels. The model hash names the exact packed
|
|
|
8567
8612
|
`<out>/check/build/skeleton.model.json` whose poses were measured.
|
|
8568
8613
|
|
|
8569
8614
|
Backdrop raster coverage and figure framing are computed in memory. The
|
|
8570
|
-
compose input record keeps `rig-compose-run/1`.
|
|
8571
|
-
|
|
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.
|
|
8572
8648
|
|
|
8573
8649
|
#### Animate a character's placement (issue #1498)
|
|
8574
8650
|
|
|
@@ -8638,10 +8714,9 @@ every character in the declared draw order.
|
|
|
8638
8714
|
A fully green compose writes `compose-run.json` at the `--out` root, beside
|
|
8639
8715
|
`scene.json`, with spec `rig-compose-run/1`. It removes a previous record before
|
|
8640
8716
|
the stage begins, including before stage option validation; a refused input,
|
|
8641
|
-
rig-c gate, check or accepted failing character leaves no record.
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
`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.
|
|
8645
8720
|
|
|
8646
8721
|
The fixed top-level key order is `spec`, `scene`, `characters`, `plate`, `plates`,
|
|
8647
8722
|
then `output_profile` when selected.
|
|
@@ -10962,7 +11037,7 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
|
|
|
10962
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) |
|
|
10963
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) |
|
|
10964
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) |
|
|
10965
|
-
| `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) |
|
|
10966
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) |
|
|
10967
11042
|
| `WIND_BAND.pairs` | `WIND_BAND.pairs` | 'pair' | finding when !holdsAll; otherwise evidence | [p.a, p.b] | [check.ts:6833](../src/check.ts#L6833) |
|
|
10968
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
|
@@ -457,6 +457,22 @@ the sorted field names whose presence or digest changed. It returns an empty
|
|
|
457
457
|
array for matching or legacy manifests. See the workflow in
|
|
458
458
|
[Keeping assembled parts current](AUTHORING.md#keeping-assembled-parts-current).
|
|
459
459
|
|
|
460
|
+
## Programmatic physics-only clip discovery
|
|
461
|
+
|
|
462
|
+
The stable named subpath `@rig-c/parts/physics-clips` exports
|
|
463
|
+
`physicsOnlyClips(motion: unknown): Array<{ name: string; duration: number; constraints: string[] }>`.
|
|
464
|
+
Pass a parsed `rigc-motion/1` document. Results follow the document's
|
|
465
|
+
`animations` order, excluding `idle`. A clip qualifies when it has at least one
|
|
466
|
+
track, every track targets only a named physics constraint, and other animation
|
|
467
|
+
payloads are empty or absent. Clip metadata such as `loop` and `note` is allowed.
|
|
468
|
+
Each result carries the source clip name and duration, with distinct constraint
|
|
469
|
+
names in first-keyed order. An input with no qualifying clips returns `[]`.
|
|
470
|
+
Invalid motion is refused with
|
|
471
|
+
`PHYSICS_CLIPS_MOTION`.
|
|
472
|
+
|
|
473
|
+
`compose` uses the same export to discover clips for `characters[].with_idle`.
|
|
474
|
+
See [Physics clips and scene repeats](AUTHORING.md#physics-clips-and-scene-repeats-issue-1615).
|
|
475
|
+
|
|
460
476
|
## Programmatic parts file references
|
|
461
477
|
|
|
462
478
|
`@rig-c/parts/src/parts.ts` exports `partsFileReferences(dir: string):
|
|
@@ -599,7 +615,7 @@ and do not certify visibility. See the
|
|
|
599
615
|
| `compare` | `--left`, `--right`; optional `--map`, `--help` (`-h`) |
|
|
600
616
|
| `rig` | `--config`, `--parts`, `--out`; optional `--idle-keys` (ctl, direct), `--page-edges` (pot, free), `--pack-shape` (rect, polygon), `--page-size`, `--help` (`-h`) |
|
|
601
617
|
| `check-parts` | `--parts`, `--out`; optional `--json`, `--help` (`-h`) |
|
|
602
|
-
| `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). |
|
|
603
619
|
| `loop` | `--frames`, `--out`; optional `--palette`, `--help` (`-h`) |
|
|
604
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`) |
|
|
605
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`) |
|
|
@@ -1189,15 +1205,17 @@ execution in historical evidence is inferred from a current export.
|
|
|
1189
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`) |
|
|
1190
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 |
|
|
1191
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. |
|
|
1192
|
-
| 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
|
|
1193
|
-
| 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. |
|
|
1194
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. |
|
|
1195
|
-
| 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
|
|
1196
|
-
| 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. |
|
|
1197
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. |
|
|
1198
|
-
| 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
|
|
1199
|
-
| 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`) |
|
|
1200
|
-
|
|
|
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) |
|
|
1201
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) |
|
|
1202
1220
|
| `idle.png`, `idle-indexed.png`, `idle.gif` | `loop`, `build --loop` | APNG and GIF encodings of the rendered idle |
|
|
1203
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 |
|
|
@@ -1309,8 +1327,77 @@ Files authors write for this package, each with a spec id the reader holds:
|
|
|
1309
1327
|
name on purpose: they name a file format, not the tool, and a file written before
|
|
1310
1328
|
the rename still reads. They do not change at 1.0.
|
|
1311
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
|
+
|
|
1312
1393
|
### Check report (`rig-parts-check/1`)
|
|
1313
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
|
+
|
|
1314
1401
|
Spec `rig-parts-check/1` (issues #1372, #1378) is a stable contract as of
|
|
1315
1402
|
2.45.0, the first version that writes it.
|
|
1316
1403
|
|
|
@@ -2207,10 +2294,9 @@ verified even without `required`; when required, the plate needs a verified
|
|
|
2207
2294
|
receipt matching its bytes. Receipt refusals occur before compose writes new
|
|
2208
2295
|
artifacts. As before, compose creates `--out` and clears its owned outputs,
|
|
2209
2296
|
including an earlier `rig/` and `scene.json`, before input validation, so a
|
|
2210
|
-
refused re-run can remove earlier artifacts.
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
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.
|
|
2214
2300
|
|
|
2215
2301
|
### Editor receipts
|
|
2216
2302
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
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": {
|
|
7
7
|
"./assembly-reading": "./src/assembly-reading.ts",
|
|
8
|
+
"./physics-clips": "./src/physics-clips.ts",
|
|
8
9
|
"./cloth-targets.json": "./src/cloth-targets.json",
|
|
9
10
|
"./*": "./*"
|
|
10
11
|
},
|
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
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PartsError, type Problem, refuseIfAny } from './errors.ts';
|
|
2
|
+
|
|
3
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
4
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function kind(value: unknown): string {
|
|
8
|
+
return value === null ? 'null' : Array.isArray(value) ? 'array' : value === undefined ? 'absent' : typeof value;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const CLIP_FIELDS = new Set(['duration', 'loop', 'note', 'tracks']);
|
|
12
|
+
const OTHER_TARGETS = ['bone', 'group', 'slot', 'path', 'slider'];
|
|
13
|
+
|
|
14
|
+
/** The side clips that need a compose `with_idle` declaration, in motion order. */
|
|
15
|
+
export function physicsOnlyClips(motion: unknown): Array<{ name: string; duration: number; constraints: string[] }> {
|
|
16
|
+
const code = 'PHYSICS_CLIPS_MOTION';
|
|
17
|
+
if (!isRecord(motion) || motion.spec !== 'rigc-motion/1' || !isRecord(motion.animations)) {
|
|
18
|
+
const found = isRecord(motion)
|
|
19
|
+
? `spec ${typeof motion.spec === 'string' ? JSON.stringify(motion.spec) : kind(motion.spec)}; animations ${kind(motion.animations)}`
|
|
20
|
+
: kind(motion);
|
|
21
|
+
throw new PartsError([{ code, object: 'motion', detail: `found ${found}. Pass a parsed rigc-motion/1 with an animations object` }]);
|
|
22
|
+
}
|
|
23
|
+
const clips: ReturnType<typeof physicsOnlyClips> = [];
|
|
24
|
+
const problems: Problem[] = [];
|
|
25
|
+
for (const [name, clip] of Object.entries(motion.animations)) {
|
|
26
|
+
if (!isRecord(clip) || typeof clip.duration !== 'number' || !Number.isFinite(clip.duration) ||
|
|
27
|
+
!Array.isArray(clip.tracks) || !clip.tracks.every(isRecord)) {
|
|
28
|
+
const found = isRecord(clip)
|
|
29
|
+
? `duration ${typeof clip.duration === 'number' ? clip.duration : kind(clip.duration)}, tracks ${kind(clip.tracks)}`
|
|
30
|
+
: kind(clip);
|
|
31
|
+
problems.push({ code, object: `motion.animations[${JSON.stringify(name)}]`, detail: `found ${found}. Requires a finite duration and an array of track objects` });
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (name === 'idle' || clip.tracks.length === 0 || Object.entries(clip).some(([key, value]) =>
|
|
35
|
+
!CLIP_FIELDS.has(key) && value !== undefined && !(Array.isArray(value) && value.length === 0))) continue;
|
|
36
|
+
|
|
37
|
+
const constraints = new Set<string>();
|
|
38
|
+
for (const track of clip.tracks) {
|
|
39
|
+
if (typeof track.physics !== 'string' || track.physics === '' ||
|
|
40
|
+
OTHER_TARGETS.some(key => Object.hasOwn(track, key))) {
|
|
41
|
+
constraints.clear();
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
constraints.add(track.physics);
|
|
45
|
+
}
|
|
46
|
+
if (constraints.size > 0) clips.push({ name, duration: clip.duration, constraints: [...constraints] });
|
|
47
|
+
}
|
|
48
|
+
refuseIfAny(problems);
|
|
49
|
+
return clips;
|
|
50
|
+
}
|
package/src/scene.ts
CHANGED
|
@@ -116,6 +116,7 @@ import { ACCEPTABLE_BARS, barsNotMet, CHECK_SPEC, type CheckReport, COMPOSE_PREV
|
|
|
116
116
|
import { CONSTRAINT_BONE_FIELDS, editorReceiptProblems, ROOT_BONE } from './config.ts';
|
|
117
117
|
import { cropToSpineY } from './coords.ts';
|
|
118
118
|
import { failLine, PartsError, type Problem, refuseIfAny } from './errors.ts';
|
|
119
|
+
import { physicsOnlyClips } from './physics-clips.ts';
|
|
119
120
|
import { readParts } from './parts.ts';
|
|
120
121
|
import { missingReceipts, readEditorReceipts, type EditorReceipts } from './editreceipt.ts';
|
|
121
122
|
import { edgeLength } from './length.ts';
|
|
@@ -126,7 +127,13 @@ import { clearComposeRun, COMPOSE_RUN_FILE, COMPOSE_RUN_SPEC, type ComposeRun, t
|
|
|
126
127
|
import { readRequirements, type RequirementsFile } from './requirements.ts';
|
|
127
128
|
import { OFFSET_PLACES, rigJsonText, type RigSpec } from './rig.ts';
|
|
128
129
|
import { pyRound } from './round.ts';
|
|
129
|
-
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';
|
|
130
137
|
import { repeatSceneKeys, type SceneRepeatSeam } from './scenerepeat.ts';
|
|
131
138
|
|
|
132
139
|
/** The scene file's `spec`. */
|
|
@@ -589,18 +596,6 @@ function animationsOf(motion: MotionSpec): Record<string, SceneAnimation> {
|
|
|
589
596
|
return motion.animations as unknown as Record<string, SceneAnimation>;
|
|
590
597
|
}
|
|
591
598
|
|
|
592
|
-
function physicsClipTargets(clip: SceneAnimation): ReadonlySet<string> | undefined {
|
|
593
|
-
if (clip.tracks.length === 0 || Object.entries(clip).some(([key, value]) =>
|
|
594
|
-
!['duration', 'loop', 'note', 'tracks'].includes(key) && value !== undefined && !(Array.isArray(value) && value.length === 0))) return undefined;
|
|
595
|
-
const targets = new Set<string>();
|
|
596
|
-
for (const track of clip.tracks) {
|
|
597
|
-
if (typeof track.physics !== 'string' || track.physics === '' ||
|
|
598
|
-
['bone', 'group', 'slot', 'path', 'slider'].some(key => Object.hasOwn(track, key))) return undefined;
|
|
599
|
-
targets.add(track.physics);
|
|
600
|
-
}
|
|
601
|
-
return targets;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
599
|
/** Maximum copies of each source searched for a diagnostic hint. Acceptance compares the declared counts directly. */
|
|
605
600
|
const WITH_IDLE_DIAGNOSTIC_COPY_LIMIT = 10_000;
|
|
606
601
|
|
|
@@ -608,7 +603,7 @@ function compareRepeatDurations(left: number, right: number): -1 | 0 | 1 {
|
|
|
608
603
|
return left === right ? 0 : left < right ? -1 : 1;
|
|
609
604
|
}
|
|
610
605
|
|
|
611
|
-
function idleRepeatAdvice(idlePeriod: number, clipPeriod: number): string {
|
|
606
|
+
function idleRepeatAdvice(name: string, idlePeriod: number, clipPeriod: number, scenePeriodMatchesIdle: boolean): string {
|
|
612
607
|
if (Number.isFinite(idlePeriod) && idlePeriod > 0 && Number.isFinite(clipPeriod) && clipPeriod > 0) {
|
|
613
608
|
let idleCount = 1;
|
|
614
609
|
let clipCount = 1;
|
|
@@ -618,7 +613,21 @@ function idleRepeatAdvice(idlePeriod: number, clipPeriod: number): string {
|
|
|
618
613
|
if (!Number.isFinite(idleDuration) || !Number.isFinite(clipDuration)) break;
|
|
619
614
|
// Only the smaller product can catch the other, so the first match has the least idle count and then clip count.
|
|
620
615
|
const order = compareRepeatDurations(idleDuration, clipDuration);
|
|
621
|
-
if (order === 0)
|
|
616
|
+
if (order === 0) {
|
|
617
|
+
const clipField = `with_idle.${name}: ${clipCount}`;
|
|
618
|
+
const unknownScenePeriod = "Cannot name a scene.repeats count because the scene's own period is not declared.";
|
|
619
|
+
if (idleCount === 1) {
|
|
620
|
+
const sceneAdvice = scenePeriodMatchesIdle
|
|
621
|
+
? `Omit scene.repeats.idle and keep scene.animations.idle.duration: ${idleDuration} (camera terminal key ${idleDuration} s).`
|
|
622
|
+
: unknownScenePeriod;
|
|
623
|
+
return `Omit idle_repeats and write ${clipField} (${idleDuration} s). ${sceneAdvice}`;
|
|
624
|
+
}
|
|
625
|
+
if (scenePeriodMatchesIdle) {
|
|
626
|
+
return `Write idle_repeats: ${idleCount}, ${clipField}, scene.repeats.idle: ${idleCount}, and scene.animations.idle.duration: ${idleDuration} ` +
|
|
627
|
+
`(composed camera terminal key ${idleDuration} s, authored terminal key stays at ${idlePeriod} s).`;
|
|
628
|
+
}
|
|
629
|
+
return `Write idle_repeats: ${idleCount} and ${clipField} (${idleDuration} s). ${unknownScenePeriod}`;
|
|
630
|
+
}
|
|
622
631
|
if (order < 0) idleCount++;
|
|
623
632
|
else clipCount++;
|
|
624
633
|
}
|
|
@@ -676,7 +685,7 @@ export function checkBarsFailed(ck: Readonly<Record<string, unknown>>): string[]
|
|
|
676
685
|
* from {@link barsNotMet}. Without an accept list the refusal reads as it
|
|
677
686
|
* always did.
|
|
678
687
|
*/
|
|
679
|
-
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 {
|
|
680
689
|
const before = problems.length;
|
|
681
690
|
const dir = c.buildDir;
|
|
682
691
|
const who = `character "${c.id}" (${c.build})`;
|
|
@@ -693,10 +702,11 @@ export function readCharacterBuild(c: SceneCharacter, problems: Problem[], accep
|
|
|
693
702
|
};
|
|
694
703
|
const json = (path: string, what: string): unknown => readJson(join(dir, path), what, problems, bytes => consumed(path, bytes));
|
|
695
704
|
if (!existsSync(dir) || !statSync(dir).isDirectory()) {
|
|
696
|
-
|
|
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` });
|
|
697
707
|
return null;
|
|
698
708
|
}
|
|
699
|
-
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;
|
|
700
710
|
const joined = new Set([...accept, ...c.accept]);
|
|
701
711
|
let accepted: string[] = [];
|
|
702
712
|
if (check !== undefined) {
|
|
@@ -1005,8 +1015,7 @@ export const UNSCALED_TRACK_PROPERTIES: readonly string[] = ['rotate', 'scale',
|
|
|
1005
1015
|
* character cannot be reproduced by a single timeline value when the constraint drives
|
|
1006
1016
|
* both or when `referenceScale` is shared across characters (issue #1485; see {@link physicsForce}).
|
|
1007
1017
|
*/
|
|
1008
|
-
export
|
|
1009
|
-
export const FORCE_PHYSICS_TRACK_PROPERTIES: readonly string[] = ['wind', 'gravity'];
|
|
1018
|
+
export { UNSCALED_PHYSICS_TRACK_PROPERTIES, FORCE_PHYSICS_TRACK_PROPERTIES };
|
|
1010
1019
|
|
|
1011
1020
|
/** The two properties a transform constraint or a slider reads or drives in length (`propertyScale` in `SkeletonJson.js`). */
|
|
1012
1021
|
function lengthProperty(name: string): boolean {
|
|
@@ -1392,6 +1401,8 @@ interface SceneReportV1 {
|
|
|
1392
1401
|
characters: SceneCharacterReport[];
|
|
1393
1402
|
order: { declared: string[]; slots: string[]; judged_by: 'nothing' };
|
|
1394
1403
|
idle_duration: number;
|
|
1404
|
+
scene_driven: Record<string, SceneDrivenTake>;
|
|
1405
|
+
repeats?: Record<string, number>;
|
|
1395
1406
|
}
|
|
1396
1407
|
|
|
1397
1408
|
export type SceneReport = SceneReportV1 | (Omit<SceneReportV1, 'spec'> & {
|
|
@@ -1407,6 +1418,8 @@ export interface ComposedScene {
|
|
|
1407
1418
|
report: SceneReport;
|
|
1408
1419
|
/** Opt-in declaration retained for pre-emission pose measurement; never serialized. */
|
|
1409
1420
|
sceneAnimations?: SceneAnimations;
|
|
1421
|
+
/** Ownership verdict awaiting Core's validation. */
|
|
1422
|
+
sceneChannels?: SceneChannelAudit;
|
|
1410
1423
|
/** Compiled timeline addresses checked at the final gate; never serialized. */
|
|
1411
1424
|
repeatSeams: SceneRepeatSeam[];
|
|
1412
1425
|
sceneCamera?: ResolvedSceneCamera;
|
|
@@ -1731,12 +1744,11 @@ export function composeScene(
|
|
|
1731
1744
|
const b = byId.get(c.id);
|
|
1732
1745
|
if (b === undefined) continue;
|
|
1733
1746
|
const animations = animationsOf(b.motion);
|
|
1747
|
+
const physicsClips = new Map(physicsOnlyClips(b.motion).map(row => [row.name, row]));
|
|
1734
1748
|
const clips = new Map<string, SceneAnimation>();
|
|
1735
|
-
for (const
|
|
1736
|
-
if (name
|
|
1737
|
-
|
|
1738
|
-
if (targets !== undefined && !Object.hasOwn(declarations, name)) {
|
|
1739
|
-
const count = targets.size;
|
|
1749
|
+
for (const { name, constraints } of physicsClips.values()) {
|
|
1750
|
+
if (!Object.hasOwn(declarations, name)) {
|
|
1751
|
+
const count = constraints.length;
|
|
1740
1752
|
const advice = c.scale === 1
|
|
1741
1753
|
? 'Declare its whole-period repeat count to carry it into idle or false to play idle without it'
|
|
1742
1754
|
: `At scale ${c.scale}, declare false to play idle without it. A repeat count applies at scale 1 only`;
|
|
@@ -1747,19 +1759,21 @@ export function composeScene(
|
|
|
1747
1759
|
for (const [name, count] of Object.entries(declarations)) {
|
|
1748
1760
|
const object = `${character}.with_idle[${JSON.stringify(name)}]`;
|
|
1749
1761
|
const source = name !== 'idle' && Object.hasOwn(animations, name) ? animations[name] : undefined;
|
|
1750
|
-
|
|
1762
|
+
const physicsClip = physicsClips.get(name);
|
|
1763
|
+
if (source === undefined || physicsClip === undefined) {
|
|
1751
1764
|
fail('SCENE_PHYSICS_CLIP_ONLY', object, `character ${show(c.id)} ${source === undefined ? 'has no clip beside idle named' : 'has a clip with other timelines or no physics keys named'} ${show(name)}. Name a clip beside idle with only physics-constraint tracks`);
|
|
1752
1765
|
continue;
|
|
1753
1766
|
}
|
|
1754
1767
|
if (count === false || c.scale !== 1) continue;
|
|
1755
|
-
const period =
|
|
1768
|
+
const period = physicsClip.duration;
|
|
1756
1769
|
const foldedDuration = count * period;
|
|
1757
1770
|
if (Number.isFinite(foldedDuration)) withIdleClockFields.push(`${object} for character ${show(c.id)} implies ${foldedDuration} s (${count} × ${period} s)`);
|
|
1758
1771
|
const sourceIdle = animations.idle.duration;
|
|
1759
1772
|
if (!Number.isFinite(foldedDuration) || foldedDuration <= 0 || compareRepeatDurations(idleDuration, foldedDuration) !== 0) {
|
|
1760
1773
|
const idleField = c.idle_repeats === undefined ? `character ${show(c.id)}'s source idle` : `${character}.idle_repeats: ${c.idle_repeats} (implies ${c.idle_repeats * sourceIdle} s)`;
|
|
1761
1774
|
const sceneField = clip === undefined ? '' : ` ${sceneIdleClock} declares ${clip.duration} s.`;
|
|
1762
|
-
|
|
1775
|
+
const advice = idleRepeatAdvice(name, sourceIdle, period, sceneIdleRepeat === undefined && clip?.duration === sourceIdle);
|
|
1776
|
+
fail('SCENE_WITH_IDLE_DURATION', object, `character ${show(c.id)} clip ${show(name)} at ${count} × ${period} s implies ${foldedDuration} s. The played idle is ${idleDuration} s with ${idleField}.${sceneField} ${advice}`);
|
|
1763
1777
|
continue;
|
|
1764
1778
|
}
|
|
1765
1779
|
clips.set(name, source);
|
|
@@ -1930,10 +1944,9 @@ export function composeScene(
|
|
|
1930
1944
|
};
|
|
1931
1945
|
// A generated pivot must not resolve an undeclared source bone reference.
|
|
1932
1946
|
// Group members can also be slots or physics constraints, depending on the property.
|
|
1933
|
-
const isBoneProperty = (property: string): boolean => SCALED_TRACK_PROPERTIES.includes(property) || UNSCALED_TRACK_PROPERTIES.includes(property);
|
|
1934
1947
|
const sceneBoneGroups = new Set<string>();
|
|
1935
1948
|
if (pivots.size > 0) for (const clip of Object.values(scene.animations ?? {})) for (const track of clip.tracks) {
|
|
1936
|
-
if (track.group !== undefined &&
|
|
1949
|
+
if (track.group !== undefined && isSceneBoneProperty(track.property)) sceneBoneGroups.add(track.group);
|
|
1937
1950
|
}
|
|
1938
1951
|
for (const b of ready) if (pivots.has(b.id) && !bonesOf.get(b.id)?.has(PLACEMENT_BONE)) {
|
|
1939
1952
|
const check = (name: unknown, where: string): void => {
|
|
@@ -1949,7 +1962,7 @@ export function composeScene(
|
|
|
1949
1962
|
const boneGroups = new Set(Object.keys(b.motion.groups).filter(group => sceneBoneGroups.has(prefixed(b.id, group))));
|
|
1950
1963
|
for (const [name, anim] of Object.entries(animationsOf(b.motion))) for (const [i, track] of anim.tracks.entries()) {
|
|
1951
1964
|
check(track.bone, `motion.json animations.${name}.tracks[${i}].bone`);
|
|
1952
|
-
if (track.group !== undefined &&
|
|
1965
|
+
if (track.group !== undefined && isSceneBoneProperty(track.property)) boneGroups.add(track.group);
|
|
1953
1966
|
}
|
|
1954
1967
|
for (const group of boneGroups) {
|
|
1955
1968
|
if (b.motion.groups[group]?.includes(PLACEMENT_BONE)) check(PLACEMENT_BONE, `motion.json groups.${group}`);
|
|
@@ -2307,7 +2320,7 @@ export function composeScene(
|
|
|
2307
2320
|
}
|
|
2308
2321
|
for (const [animation, clip] of Object.entries(scene.animations)) for (const [i, track] of clip.tracks.entries()) {
|
|
2309
2322
|
const group = track.group;
|
|
2310
|
-
const members = group !== undefined &&
|
|
2323
|
+
const members = group !== undefined && isSceneBoneProperty(track.property) && Object.hasOwn(groups, group) ? groups[group] : [];
|
|
2311
2324
|
const targets = track.bone === undefined ? members : [track.bone];
|
|
2312
2325
|
for (const bone of new Set(targets)) {
|
|
2313
2326
|
const id = undeclaredPivots.get(bone);
|
|
@@ -2321,12 +2334,13 @@ export function composeScene(
|
|
|
2321
2334
|
}
|
|
2322
2335
|
let sceneAnimations = scene.animations;
|
|
2323
2336
|
let sceneCamera: ResolvedSceneCamera | undefined;
|
|
2337
|
+
let sceneChannels: SceneChannelAudit | undefined;
|
|
2324
2338
|
try {
|
|
2325
2339
|
if (scene.repeats !== undefined) {
|
|
2326
2340
|
const repeated = repeatSceneAnimations(scene.animations, motion.groups, scene.repeats, repeatSeams);
|
|
2327
2341
|
if (scene.animations !== undefined) sceneAnimations = repeated;
|
|
2328
2342
|
}
|
|
2329
|
-
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()]);
|
|
2330
2344
|
if (scene.camera !== undefined) sceneCamera = resolveSceneCamera(scene.camera, motion, scene.repeats);
|
|
2331
2345
|
} catch (err) {
|
|
2332
2346
|
if (!(err instanceof PartsError) || sceneIdleRepeat === undefined || idleClockFields.length === 0) throw err;
|
|
@@ -2358,8 +2372,15 @@ export function composeScene(
|
|
|
2358
2372
|
characters: rows,
|
|
2359
2373
|
order: { declared: [...scene.order], slots: slots.map((s) => s.name), judged_by: 'nothing' },
|
|
2360
2374
|
idle_duration: idleDuration,
|
|
2375
|
+
scene_driven: sceneDrivenTakes(motion, sceneAnimations, sceneCamera),
|
|
2376
|
+
...(scene.repeats === undefined ? {} : { repeats: { ...scene.repeats } }),
|
|
2377
|
+
};
|
|
2378
|
+
return {
|
|
2379
|
+
rig, motion, images, report, repeatSeams,
|
|
2380
|
+
...(sceneAnimations === undefined ? {} : { sceneAnimations }),
|
|
2381
|
+
...(sceneCamera === undefined ? {} : { sceneCamera }),
|
|
2382
|
+
...(sceneChannels === undefined ? {} : { sceneChannels }),
|
|
2361
2383
|
};
|
|
2362
|
-
return { rig, motion, images, report, repeatSeams, ...(sceneAnimations === undefined ? {} : { sceneAnimations }), ...(sceneCamera === undefined ? {} : { sceneCamera }) };
|
|
2363
2384
|
}
|
|
2364
2385
|
|
|
2365
2386
|
// ---------------------------------------------------------------------------
|
|
@@ -2516,17 +2537,10 @@ export function unprefixedNames(rig: RigSpec, motion: MotionSpec, ids: readonly
|
|
|
2516
2537
|
// the stage
|
|
2517
2538
|
// ---------------------------------------------------------------------------
|
|
2518
2539
|
|
|
2519
|
-
|
|
2520
|
-
* Everything before the gate, from the files: the scene, every character's
|
|
2521
|
-
* build (with `accept`, `compose --accept`, issue #203), the plate and the
|
|
2522
|
-
* `--requirements` file, each read with its problems collected, then
|
|
2523
|
-
* {@link composeScene} — one refusal naming every problem the
|
|
2524
|
-
* files hold. Pure but for the reads.
|
|
2525
|
-
*/
|
|
2526
|
-
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) {
|
|
2527
2541
|
const scene = loadScene(scenePath);
|
|
2528
2542
|
const problems: Problem[] = acceptProblems(accept, '--accept');
|
|
2529
|
-
const builds = scene.characters.map((c) => readCharacterBuild(c, problems, accept));
|
|
2543
|
+
const builds = scene.characters.map((c) => readCharacterBuild(c, problems, accept, checkBuilds));
|
|
2530
2544
|
let plate: PlateImage | null = null;
|
|
2531
2545
|
if (scene.plate !== null) {
|
|
2532
2546
|
const ledger = readEditorReceipts(scene.plate.editor_receipts, scene.path, 'scene.plate.editor_receipts', 'scene file');
|
|
@@ -2573,6 +2587,21 @@ export function composeFromFiles(scenePath: string, requirementsPath?: string, m
|
|
|
2573
2587
|
}
|
|
2574
2588
|
}
|
|
2575
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);
|
|
2576
2605
|
const runRecord: ComposeRun = {
|
|
2577
2606
|
spec: COMPOSE_RUN_SPEC,
|
|
2578
2607
|
scene: { path: scenePath, sha256: scene.sha256 },
|
|
@@ -2710,8 +2739,9 @@ export function composeStage(input: ComposeInput, run: ComposeRunners, log: Log)
|
|
|
2710
2739
|
const gated: { camera?: CameraEvidence } = {};
|
|
2711
2740
|
let gate: ReturnType<typeof gateThroughRigc>;
|
|
2712
2741
|
try {
|
|
2713
|
-
const { sceneAnimations: clips, repeatSeams } = composed;
|
|
2742
|
+
const { sceneAnimations: clips, repeatSeams, sceneChannels } = composed;
|
|
2714
2743
|
const checkMotion = (build: string): void => {
|
|
2744
|
+
refuseIfAny(sceneChannels?.problems ?? []);
|
|
2715
2745
|
if (clips === undefined && repeatSeams.length === 0) return;
|
|
2716
2746
|
const modelText = readFileSync(join(build, CAMERA_MODEL), 'utf8');
|
|
2717
2747
|
refuseIfAny(sceneRepeatCurveProblems(modelText, repeatSeams));
|
|
@@ -2795,7 +2825,8 @@ export function composeStage(input: ComposeInput, run: ComposeRunners, log: Log)
|
|
|
2795
2825
|
}
|
|
2796
2826
|
const writeCameraReport = (): void => {
|
|
2797
2827
|
if (evidence === undefined || !cameraBound) return;
|
|
2798
|
-
|
|
2828
|
+
const { repeats, ...base } = r;
|
|
2829
|
+
composed.report = { ...base, spec: SCENE_CAMERA_REPORT_SPEC, camera: evidence.report, ...(repeats === undefined ? {} : { repeats }) };
|
|
2799
2830
|
writeFileSync(reportPath, rigJsonText(composed.report));
|
|
2800
2831
|
say(`${wroteRig}, and ${reportPath}`);
|
|
2801
2832
|
};
|
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. */
|