rig-parts 1.47.0 → 1.48.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 CHANGED
@@ -429,7 +429,7 @@ usage:
429
429
  rig-parts check --rig <dir> --out <dir> [--parts <dir>] [--source <painting.png>]
430
430
  [--page-edges pot|free] [--pack-shape rect|polygon]
431
431
  [--requirements <file.json>] [--seam-pairs] [--keep-stills]
432
- [--set <name> | --all-sets]
432
+ [--set <name> | --all-sets] [--environment <schedule.json>]
433
433
  Build, gate, render and measure a rig through rig-c's CLI (the rigc at
434
434
  node_modules/.bin/rigc, or on PATH). --rig holds rig.json and motion.json:
435
435
  a rig spec, which rigc build compiles, not a compiled skeleton.json.
@@ -547,6 +547,29 @@ usage:
547
547
  follow no frame of which reaches its least drive) is
548
548
  CHECK_REQUIREMENT_MEASURABLE, and the run is not PASS. Without the flag
549
549
  nothing is read, written or printed for it.
550
+ --environment <schedule.json> takes the readings in the world a person
551
+ watched: a rigc-environment/1 schedule ({ "spec": "rigc-environment/1",
552
+ "steps": [{ "t": <seconds>, "wind"?: [x, y], "gravity"?: [x, y] }, ...] },
553
+ x right, y down — what rigc render --environment reads, and what the
554
+ review editor exports). It is read once, by rig-c's own reader, before
555
+ anything is built; a malformed one, or a path with nothing at it, is
556
+ refused, CHECK_ENVIRONMENT, rigc's sentence verbatim, and --out is not
557
+ written. Every render a bar or a warning reads with the physics on is
558
+ posed under it — the idle (TIP_OVER_ROOT, STILL_REGIONS_DARK,
559
+ TEXTURE_STRETCH, CLOTH_SETTLES), the physics-on half of
560
+ ANIMATIONS_DO_NOT_FOLD, the parts BREATH_VISIBLE renders alone,
561
+ SEAM_OVER_MOTION and the --requirements renders; the physics-off renders
562
+ (the loop's, the fold bar's other half, STRESS_OFF_CHAIN,
563
+ SEAM_OVER_RANGE), the setup-pose stills and build's loop take none. What
564
+ rigc render refuses of the schedule on this rig (no physics constraint,
565
+ a half no constraint answers, a step after the last frame) is
566
+ CHECK_ENVIRONMENT with rigc's line. The world before the first step is
567
+ the runtime's, wind [1, 0] and gravity [0, 1]: a schedule stating that
568
+ reads what a run without the flag reads, and wind [0, 0] is a calm, not
569
+ the default (AUTHORING §6, The world the readings are taken in). One
570
+ environment: line names the path, the step count and the sha256's first
571
+ 16 hex; check.json's environment holds path (as given), sha256 and
572
+ steps. Without the flag no key and no render argument moves.
550
573
 
551
574
  rig-parts loop --frames <dir> --out <file.png | file.gif> [--palette]
552
575
  Encode a frame set rigc render wrote (its --out directory, or the set
@@ -663,6 +686,7 @@ usage:
663
686
  [--pack-shape rect|polygon] [--loop] [--requirements <file.json>]
664
687
  [--idle-keys ctl|direct] [--lead-in <periods>] [--seam-pairs] [--keep-stills]
665
688
  [--alt <name>=<source>:<full>[:<head>]] [--set <name> | --all-sets]
689
+ [--environment <schedule.json>]
666
690
  assemble, then rig, then check, in one process, each stage's own lines
667
691
  printed under [assemble], [rig] and [check]; the first stage that refuses
668
692
  stops the build with its own FAIL lines. The config must already carry
@@ -685,6 +709,9 @@ usage:
685
709
  and check's artifact, take them). --requirements is forwarded to check
686
710
  (as for check); the file's own shape is read before assemble runs, and
687
711
  its names resolve against the rig in the check, before it builds.
712
+ --environment is forwarded to check (as for check); the schedule is read
713
+ by rig-c's reader before assemble runs, so a malformed one is refused,
714
+ CHECK_ENVIRONMENT, under [assemble] before anything is assembled.
688
715
  --seam-pairs and --keep-stills are forwarded to check (as for check:
689
716
  the seam split by pair on a pass too, under check/seam/; the setup-pose
690
717
  still under check/setup_still/). check's --rig and --parts are refused:
@@ -880,13 +907,13 @@ const TAKES = {
880
907
  rig: { valued: ['--config', '--parts', '--out', '--idle-keys', '--page-edges', '--pack-shape'], switches: [] },
881
908
  propose: { valued: ['--parts', '--source', '--out', '--from-config', '--compare', '--full', '--head', '--canvas', '--keypoints', '--person', '--wrist-snap', '--grid-rule', '--cloth', '--write-config'], switches: ['--head-box', '--no-back-hair'] },
882
909
  compare: { valued: ['--left', '--right', '--map'], switches: [] },
883
- check: { valued: ['--rig', '--out', '--parts', '--source', '--page-edges', '--pack-shape', '--requirements', '--set'], switches: ['--seam-pairs', '--keep-stills', '--all-sets'] },
910
+ check: { valued: ['--rig', '--out', '--parts', '--source', '--page-edges', '--pack-shape', '--requirements', '--set', '--environment'], switches: ['--seam-pairs', '--keep-stills', '--all-sets'] },
884
911
  loop: { valued: ['--frames', '--out'], switches: ['--palette'] },
885
912
  assemble: { valued: ['--source', '--full', '--head', '--config', '--out', '--seam', '--project', '--alt'], switches: ['--propose-plan'] },
886
913
  'comfy seethrough': { valued: ['--image', '--out', '--resolution', '--steps', '--seed', '--prefix', '--host', '--wait', '--timeout', '--poll'], switches: ['--offload', '--lama', '--nf4'] },
887
914
  'comfy paint': { valued: ['--config', '--out', '--seeds', '--seed0', '--host', '--wait', '--timeout', '--poll'], switches: [] },
888
915
  inputs: { valued: ['--source', '--config', '--out'], switches: [] },
889
- build: { valued: ['--config', '--source', '--full', '--head', '--out', '--seam', '--project', '--page-edges', '--pack-shape', '--requirements', '--idle-keys', '--lead-in', '--alt', '--set'], switches: ['--loop', '--seam-pairs', '--keep-stills', '--all-sets'] },
916
+ build: { valued: ['--config', '--source', '--full', '--head', '--out', '--seam', '--project', '--page-edges', '--pack-shape', '--requirements', '--idle-keys', '--lead-in', '--alt', '--set', '--environment'], switches: ['--loop', '--seam-pairs', '--keep-stills', '--all-sets'] },
890
917
  compose: { valued: ['--scene', '--out', '--requirements', '--accept'], switches: [] },
891
918
  'mesh-draft': { valued: ['--config', '--parts', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape'], switches: ['--more-triangles'] },
892
919
  remesh: { valued: ['--rig', '--config', '--parts', '--part', '--mesh', '--delta', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape'], switches: [] },
@@ -1157,7 +1184,7 @@ function cmdCheck(args: string[]): number {
1157
1184
  try {
1158
1185
  const bin = findRigc(import.meta.dir, process.env.PATH ?? '');
1159
1186
  const r = checkStage(
1160
- { rig, parts: f.get('--parts'), source: f.get('--source'), out, pageEdges: edges, packShape: shape, requirements: f.get('--requirements'), seamPairs: seamPairs === 1, keepStills: keepStills === 1, ...(f.has('--set') ? { set: f.get('--set') as string } : {}), allSets: allSets === 1 },
1187
+ { rig, parts: f.get('--parts'), source: f.get('--source'), out, pageEdges: edges, packShape: shape, requirements: f.get('--requirements'), seamPairs: seamPairs === 1, keepStills: keepStills === 1, ...(f.has('--set') ? { set: f.get('--set') as string } : {}), allSets: allSets === 1, ...(f.has('--environment') ? { environment: f.get('--environment') as string } : {}) },
1161
1188
  rigcRunner(bin),
1162
1189
  bin,
1163
1190
  console.log,
@@ -1658,7 +1685,7 @@ function cmdBuild(args: string[]): number {
1658
1685
  const scratch = mkdtempSync(join(tmpdir(), 'rig-parts-build-'));
1659
1686
  try {
1660
1687
  const r = build(
1661
- { config, source, full, head, out, seam: seam as SeamRule, project: project as ProjectRule, loop, pageEdges: edges, packShape: shape, ...(flags.has('--requirements') ? { requirements: flags.get('--requirements') as string } : {}), idleKeys: keys, ...(leadText === undefined ? {} : { leadIn: Number(leadText) }), seamPairs: on.has('--seam-pairs'), keepStills: on.has('--keep-stills'), ...(alts.length === 0 ? {} : { alts }), ...(flags.has('--set') ? { set: flags.get('--set') as string } : {}), allSets: on.has('--all-sets') },
1688
+ { config, source, full, head, out, seam: seam as SeamRule, project: project as ProjectRule, loop, pageEdges: edges, packShape: shape, ...(flags.has('--requirements') ? { requirements: flags.get('--requirements') as string } : {}), idleKeys: keys, ...(leadText === undefined ? {} : { leadIn: Number(leadText) }), seamPairs: on.has('--seam-pairs'), keepStills: on.has('--keep-stills'), ...(alts.length === 0 ? {} : { alts }), ...(flags.has('--set') ? { set: flags.get('--set') as string } : {}), allSets: on.has('--all-sets'), ...(flags.has('--environment') ? { environment: flags.get('--environment') as string } : {}) },
1662
1689
  { rig: rigcRunner(bin), check: rigcRunner(bin), checkBin: bin, scratch: join(scratch, 'rig-gate') },
1663
1690
  console.log,
1664
1691
  );
package/docs/AUTHORING.md CHANGED
@@ -1861,8 +1861,9 @@ rigc render --candidate out/check/build --animation idle --fps 12 --max 640 --ge
1861
1861
  Read by `CLOTH_SETTLES`'s own definition on the `geometry.json` that writes, none of the
1862
1862
  16 chains settles. The nine that settle under the default world keep moving to the last
1863
1863
  frame: the skirt's eight trees end at 7.66 to 23.79 rig px/s, and the swing at 2.778
1864
- (selftest `CH21` holds this). `check` itself always reads the default world, so `wind`'s
1865
- `check.json` keeps its WARN. The WARN states what the rig does with nothing driving it;
1864
+ (selftest `CH21` holds this). `check` without `--environment` reads the default world, so
1865
+ `wind`'s tracked `check.json` keeps its WARN; `check --environment examples/wind/breeze.json`
1866
+ takes every reading under the breeze instead (§6, *The world the readings are taken in*). The WARN states what the rig does with nothing driving it;
1866
1867
  it is not a fault (`CH20` holds that the idle keys no hip and that the chains which
1867
1868
  settle are exactly the ones no idle key drives). A soft region with no wind response,
1868
1869
  such as `reference-sample`'s `hip_jiggle`, is not reached by an environment at all:
@@ -3115,8 +3116,41 @@ documents do not ship). Each is an input this package built; none is an author's
3115
3116
  | <a id="REQUIREMENTS_MAY_FOLD"></a>`REQUIREMENTS_MAY_FOLD` | a `may_fold` entry names a slot with no mesh attachment — a region is one quad and cannot fold (issue #320). Refused before anything is built. Before issue #333 an entry naming the idle was refused here too; the bar reads the idle now, and `idle` is an animation name like any other | a mesh slot |
3116
3117
  | <a id="REQUIREMENTS_NOT_PLANTED"></a>`REQUIREMENTS_NOT_PLANTED` | a `not_planted` name is a part `check` does not read as a planted foot — it does not come from a See-through `footwear` layer — or there is no `parts.json` to choose the feet by (issue #231). Refused before anything is built | a `footwear` part's name |
3117
3118
  | <a id="REQUIREMENTS_TIP_EXCEPTION"></a>`REQUIREMENTS_TIP_EXCEPTION` | a `not_swinging`, `rises` or `rests` name is a part `TIP_OVER_ROOT` does not read — not from a See-through `handwear` or `bottomwear` layer — or there is no `parts.json` (refused before anything is built); or a `rises` part is not carried by a chain that rises: the chain's **last link**, at the setup pose, runs other than up — from its origin along its `length` (the extent the rig stage turns a link to), or, a last link with no length, from the link before's origin to its own — the detail giving the link read and the direction measured (refused after the idle is rendered, before `check.json` is written) (issues #231, #322; until #322 it read the chain's first link's origin to its last's, which refused a folded arm — a link that hangs, then a forearm raised) | a swinging part's name; for `rises`, a part whose chain does rise |
3119
+ | <a id="CHECK_ENVIRONMENT"></a>`CHECK_ENVIRONMENT` | `check --environment` (or `build --environment`, forwarded): the schedule is refused, the detail rigc's own sentence verbatim. Read once by rig-c's reader (`readEnvironmentSchedule`, `rig-c/src/environment.ts`) before anything is built — nothing at the path, a file that is not JSON or not an object, a `spec` other than `rigc-environment/1`, a key besides `spec`, `steps` or a step's `t`, `wind`, `gravity`, no step, a `t` not finite, below 0 or not after the step before, a `wind` or `gravity` not a pair of finite numbers (JSON's `1e999` reads as `Infinity` and is refused), a step stating neither — and `--out` is not written (`build` refuses under `[assemble]`, before it assembles). After the build, what `rigc render --environment` refuses of a well-formed schedule on this rig, quoted from its `--environment <path>:` line: no physics constraint, a half no constraint answers, two steps on one frame at 12 fps, a step after the last frame of the animation rendered. Also refused before anything is built: a `motion.json` with no animation, where no render `check` makes could pose the schedule | the schedule — rigc's sentence names the entry, the field, the value found and the value required; for a rig with no physics constraint, drop the flag: no world moves it |
3118
3120
  | <a id="REQUIREMENTS_SEAM"></a>`REQUIREMENTS_SEAM` | a `seam` cannot be read against the rig: there is no `parts.json` (a merged rig, §7 *Measuring a rig rig-parts did not assemble*), or the two parts' art does not meet at the setup pose (no 4-adjacent pair). Refused before anything is built | two parts whose art touches, on a rig with its `parts.json` |
3119
3121
 
3122
+ **The world the readings are taken in** (`--environment`, issue #538). A physics chain
3123
+ answers the world as well as the bones above it, and `check` without the flag reads
3124
+ rigc's default world, wind (1, 0) and gravity (0, 1) — not the one a person watched in
3125
+ the review editor. `check --environment <schedule.json>` hands a `rigc-environment/1`
3126
+ schedule (§3, *What moves them*) to every render whose frames a bar or a warning reads,
3127
+ and to none that writes a product: the idle render (`TIP_OVER_ROOT`, `STILL_REGIONS_DARK`,
3128
+ `TEXTURE_STRETCH`, `CLOTH_SETTLES`), the physics-on half of `ANIMATIONS_DO_NOT_FOLD`, the
3129
+ parts `BREATH_VISIBLE` renders alone, `SEAM_OVER_MOTION` and the `--requirements`
3130
+ renders. The renders with the physics left out — the loop's keyed render, the fold
3131
+ bar's physics-off half, `STRESS_OFF_CHAIN`'s turned copy and `SEAM_OVER_RANGE`'s bent
3132
+ copy — take none: no world moves a skeleton with no physics constraint, and
3133
+ `rigc render` refuses a schedule on one (`the skeleton declares no physics constraint,
3134
+ so no environment moves anything in it`, rig-c 2.60.0, measured on the fold bar's off
3135
+ half). The setup-pose stills (the seam, `BLINK_NO_HOLE`, `SETUP_POSE_VS_SOURCE`) take
3136
+ none either: each is a 0.1 s animation read at its first frame, and rigc refuses a step
3137
+ after its last (`entry 1's t 0.5 falls after the last frame of every set drawn`,
3138
+ measured). `build --loop` encodes a product and takes none. One line,
3139
+ `environment: <path>, rigc-environment/1, <n> step(s), sha256 <16 hex>`, says which
3140
+ schedule, and `check.json` carries `environment` — `path` as the command line gave it,
3141
+ the `sha256` of the bytes read, `steps` — after `pack_mode`; without the flag neither
3142
+ is written and no render argument moves.
3143
+
3144
+ The world before the first step is the runtime's, so a still schedule is the one that
3145
+ states it: `{ "t": 0, "wind": [1, 0], "gravity": [0, 1] }` reads what a run without the
3146
+ flag reads — on the cloth fixture (selftest `CK514`), the same idle frames and the same
3147
+ `check.json` but for its `environment` key. Wind `[0, 0]` is not that world but a calm,
3148
+ and it moves the readings: on the same fixture `TEXTURE_STRETCH` 1.382 → 1.214 and
3149
+ `TIP_OVER_ROOT`'s ratio 15.061 → 7.216. A gust that moves the chains moves the bars:
3150
+ wind (1, 0), then (40, 0) from 0.5 s, reads `TEXTURE_STRETCH` 32.181 (FAIL, `hair_back`
3151
+ triangle 258), two meshes folding under `ANIMATIONS_DO_NOT_FOLD` (FAIL; none without the
3152
+ flag) and 8 `CLOTH_SETTLES` warnings for 9 (selftest `CK515`).
3153
+
3120
3154
  ### compose
3121
3155
 
3122
3156
  Every refusal below is collected with the others and printed at once, under
package/docs/STABILITY.md CHANGED
@@ -56,9 +56,9 @@ defaults are the help's too, and none is guessed from the art.
56
56
  | `propose` | `--parts`, `--source`, `--out`; optional `--compare` or `--from-config` (one of them), `--keypoints`, `--person` and `--wrist-snap` (each with `--keypoints`), `--full`, `--head` (the turn control's depths; not with `--from-config`), `--grid-rule` (`figure` or `part`, the drafted lattice's spacing; not with `--from-config`), `--cloth` (a config whose `cloth` block is the recipe, issue #364; not with `--from-config`), `--write-config` (a new file, with `--cloth` and not with `--from-config`, issue #537 — additive: without it nothing `propose` writes changes) |
57
57
  | `compare` | `--left`, `--right`; optional `--map` |
58
58
  | `rig` | `--config`, `--parts`, `--out`; optional `--idle-keys` (ctl, direct), `--page-edges` (pot, free), `--pack-shape` (rect, polygon) |
59
- | `check` | `--rig`, `--out`; optional `--parts`, `--source`, `--page-edges`, `--pack-shape`, `--requirements`, `--seam-pairs`, `--keep-stills`, `--set` or `--all-sets` (issue #454) |
59
+ | `check` | `--rig`, `--out`; optional `--parts`, `--source`, `--page-edges`, `--pack-shape`, `--requirements`, `--seam-pairs`, `--keep-stills`, `--set` or `--all-sets` (issue #454), `--environment` (issue #538, additive) |
60
60
  | `loop` | `--frames`, `--out`; optional `--palette` |
61
- | `build` | `--config`, `--source`, `--full`, `--out`; optional `--head` (as for `assemble`), `--seam`, `--project`, `--page-edges`, `--pack-shape`, `--loop`, `--lead-in`, `--requirements`, `--idle-keys`, `--seam-pairs`, `--keep-stills`, `--alt` (as for `assemble`, issue #454), `--set` or `--all-sets` (as for `check`, issue #454) |
61
+ | `build` | `--config`, `--source`, `--full`, `--out`; optional `--head` (as for `assemble`), `--seam`, `--project`, `--page-edges`, `--pack-shape`, `--loop`, `--lead-in`, `--requirements`, `--idle-keys`, `--seam-pairs`, `--keep-stills`, `--alt` (as for `assemble`, issue #454), `--set` or `--all-sets` (as for `check`, issue #454), `--environment` (as for `check`, issue #538, additive) |
62
62
  | `compose` | `--scene`, `--out`; optional `--requirements`, `--accept` |
63
63
  | `mesh-draft` | `--config`, `--parts`, `--out`; optional `--requirements`, `--idle-keys` (ctl, direct), `--page-edges` (pot, free), `--pack-shape` (rect, polygon), `--more-triangles` |
64
64
  | `remesh` | `--rig`, `--config`, `--parts`, `--part`, `--out`, and one of `--mesh` or `--delta` (issue #526); optional `--requirements`, `--idle-keys` (ctl, direct), `--page-edges` (pot, free), `--pack-shape` (rect, polygon) |
@@ -193,7 +193,7 @@ every number) are AUTHORING §3's tables, and the loader refuses any other by na
193
193
  | `parts.json`, `parts/<name>.png` | `assemble`, `build` | one record per part: `from` (`<run>:<tag>` with a See-through v3 tag, `<run>:author:<label>` for a layer the author made — issue #256, read by no role rule — or `painting:<name>` for a patch), `cut_from` on a cut's piece only (the plan part it was cut from, issue #230), `limb` on a limb segment's part only (issue #349: `name`, `segment`, `of`, `bone`, and below a joint `joint`, `range` when the config segment declares one (issue #360), and `cap` — `at`, `width`, `radius`, `box`, `layer_px`, `image_px` with a cap image, `image_layer` after it when that image was a hidden-art layer — issue #359, `<run>:<layer>:hidden` — `missing_px`, then `shape` and `upper_px` under the segment's `cap_shape`, and `edge`, `feather_radius` and `feathered_px` under its `edge`, and `cut_band`, `cut_offset`, `cut_at`, `cut_crossed`, `joint_crossed`, `band_px` and `stroke_luma_max` (when the band has a split) under its `cut_band`, issue #360), the box `x`, `y`, `w`, `h` (rig px), the pixel counts `src/parts.ts` documents (`opaque_px`, `visible_px`, `occluded_px`, `projected_core_px`, `source_px_taken`, `visible_not_projected_px`, `refused_drift_px`, `merged_px`, `seam_override_px`, and `fringe_pushed_back` when not empty); `rig_size`, `scale_rig_per_source`, `ghost_px`, `recomposite`, and `scene` (`figure_alpha_above`, `figure_px`, `figure_mask`) under `config.scene` only, with the figure's mask `figure_rig.png` beside the recomposite (issue #242); `single_run_pad` (`file_size`, `side`, `left`, `top`) last, only for one run whose file is not the `seethrough.resolution` square (issue #366) |
194
194
  | `rig/rig.json`, `rig/motion.json`, `rig/images/` | `rig`, `build`, `compose` | rig-c's rig spec and motion spec, `spec` `rigc-rig/1` and `rigc-motion/1`: the format is rig-c's, and this package writes only what rig-c's parser accepts; a bone carries `inherit` only where config.bones declares one, rig-c's mode name as written (issue #348) |
195
195
  | `rig/mesh_report.json` | `rig`, `build` | one row per mesh: `part`, `vertices`, `triangles`, `hull`, `bones`, `max_influences`, `mean_influences`, `art_coverage`, then `grid` (a lattice); `mode` "contour" with `params`, `contour`, `regions` (`params.maxEdge` and `contour.outlineCut` only when the mesh declares `contour.maxEdge`; `params.bridges` and `contour.bridges` — `islands`, `units`, `joins`, and `faint` only when an island was left out as faint — only when it declares `contour.bridges`); or `mode` "influence" with `influence` (as declared), `reach` (`farthest`, `at`, `nearest`, `capped`, `widest`) and `lattice` (rig-c's `SegmentsLatticeReport`: `cols`, `rows`, `artCells`, `keptCells`, `passes`, `islands`) (issue #378); or `mode` "auto" with `settings`, `source`, `result`, `residuals`, `worst_residual`, `worst_region`, `motion_amplitude`, `termination`, `weights`, `regions`, `deformation`, `quality_report` (rig-c's `mesh-quality-report/1` document whole), `motion_report`, and, only when they apply, `stray_cleared` (after `source`, when `source.stray` is declared), `skinning_residual` and `replay` (`AutoMeshReport` in `src/rig.ts`); in every mode, `exponent` when the mesh declares one (after `grid`, or after `mode`); `influences`, as declared, when a lattice or contour mesh declares it (after `exponent`, or where `exponent` would be); `stray` and `stray_cleared` when a lattice mesh declares `stray` (after `influences`, or where `influences` would be); `ribs` when a contour or auto mesh declares them (after `exponent`, or after `mode`), and then `contour.ribs` (`source.contour.ribs` in the automatic mode) |
196
- | `check/check.json` and the rest of `check/` | `check`, `build`, `compose` | the reference's fields in its order (`gate_spine_html_green`, `rigc_entry`, `pack_mode`, `loop_max_diff`, the seam figures — `seam_mean`, `seam_px_over_40`, `seam_px_over_80` and, from issue #216, `seam_frame_scale`, the frame scale the bar divides the count by), `loop_physics` after `loop_max_diff` when the rig declares a physics constraint, `seam_border` after the seam figures when `parts.json` declares a scene (issue #242), `seam_pairs` after the seam figures when the seam bar fails or `--seam-pairs` asks (each row's picture under `check/seam/`; `--keep-stills` leaves the setup-pose still and its `frames.json` under `check/setup_still/`), then the judgement lines (`BREATH_VISIBLE`, `BLINK_NO_HOLE`, `CHAIN_LAG`, `TIP_OVER_ROOT`, `STILL_REGIONS_DARK`, `TEXTURE_STRETCH`), `ANIMATIONS_DO_NOT_FOLD` after them when `motion.json` holds an animation, the idle included — on every rig with an idle since issue #333 (issues #320, #363: `status`, `animations`, `fps`, `physics_left_out`, `folding` — each `animation`, `slot`, `attachment`, `frames`, `worst_frame`, `worst_triangles`, `triangles`, `physics_on`, `physics_off`, `physics_constraints`, `declared`, `line` — `folding_undeclared`, `declared_not_folding`, `bar`), `FEET_STAY_LEVEL` after it when a `footwear` part rides a bone that hangs from another and `motion.json` holds an animation (issue #348: `status`, `reason` on a SKIP only, `animations`, `fps`, `physics_left_out`, `bar_degrees`, `bar`, `feet` — each `part`, `bone`, `hangs_from`, `status`, `frames_posed`, `worst`), `LIMB_ONE_BONE` after it (and after `STRESS_OFF_CHAIN` where that is written) when `parts.json` holds a limb segment's part (issue #349: `status`, `parts` — each `part`, `limb`, `bone`, `status`, `others`), `SEAM_OVER_RANGE` after it when a limb record carries a `range` (issue #360: `status`, `frame_scale`, `physics_left_out`, `bar` — `mean`, `rig_px_over_40`, `level` — and `joints`, each `part`, `limb`, `segment`, `joint`, `bone`, `range`, `at`, `radius`, `under_px`, `status`, `poses` — each `degrees`, `status`, `mean`, `px_over_40`, `px_over_80`, `rig_px_over_40` — and `unread` on a joint not read), `SEAM_OVER_MOTION` after it when `parts.json` holds a limb segment or `--requirements` a `seam` (issue #493, a warning and not a bar: `status` — `WARN`, `CLEAR` or `SKIP` — `reason` on a SKIP only, `fps`, `floor`, `pairs` — each `pair`, `a`, `b`, `declared`, and `unread` on a pair not read — `animations`, `warnings`, `rows` — each `pair`, `animation`, `status`, `drawn`, `banded`, `opens`, `px`, `max_px`, `under_floor`), `CLOTH_SETTLES` after it when the rig declares a physics constraint and has an idle (issue #501, a warning and not a bar: `status` — `WARN` or `CLEAR` — `fps`, `frames`, `duration`, `floor_rig_px_per_s`, `floor`, `levers`, `warnings`, `rows` — each `tip`, `root`, `links`, `point`, `settles_at`, `max_rig_px_per_s`, `min_rig_px_per_s`), `RECOMPOSITE_HOLES` (its first figure `declared_scene` when `parts.json` declares a scene), `SETUP_POSE_VS_SOURCE`, `skipped`, a `requirements` block under `--requirements`, and `PASS`; `check/build/skeleton.json`, `.atlas` and `.png` are the packed artifact rig-c writes |
196
+ | `check/check.json` and the rest of `check/` | `check`, `build`, `compose` | the reference's fields in its order (`gate_spine_html_green`, `rigc_entry`, `pack_mode`, `environment` after it under `--environment` only (issue #538, additive: `path` as given, `sha256`, `steps`), `loop_max_diff`, the seam figures — `seam_mean`, `seam_px_over_40`, `seam_px_over_80` and, from issue #216, `seam_frame_scale`, the frame scale the bar divides the count by), `loop_physics` after `loop_max_diff` when the rig declares a physics constraint, `seam_border` after the seam figures when `parts.json` declares a scene (issue #242), `seam_pairs` after the seam figures when the seam bar fails or `--seam-pairs` asks (each row's picture under `check/seam/`; `--keep-stills` leaves the setup-pose still and its `frames.json` under `check/setup_still/`), then the judgement lines (`BREATH_VISIBLE`, `BLINK_NO_HOLE`, `CHAIN_LAG`, `TIP_OVER_ROOT`, `STILL_REGIONS_DARK`, `TEXTURE_STRETCH`), `ANIMATIONS_DO_NOT_FOLD` after them when `motion.json` holds an animation, the idle included — on every rig with an idle since issue #333 (issues #320, #363: `status`, `animations`, `fps`, `physics_left_out`, `folding` — each `animation`, `slot`, `attachment`, `frames`, `worst_frame`, `worst_triangles`, `triangles`, `physics_on`, `physics_off`, `physics_constraints`, `declared`, `line` — `folding_undeclared`, `declared_not_folding`, `bar`), `FEET_STAY_LEVEL` after it when a `footwear` part rides a bone that hangs from another and `motion.json` holds an animation (issue #348: `status`, `reason` on a SKIP only, `animations`, `fps`, `physics_left_out`, `bar_degrees`, `bar`, `feet` — each `part`, `bone`, `hangs_from`, `status`, `frames_posed`, `worst`), `LIMB_ONE_BONE` after it (and after `STRESS_OFF_CHAIN` where that is written) when `parts.json` holds a limb segment's part (issue #349: `status`, `parts` — each `part`, `limb`, `bone`, `status`, `others`), `SEAM_OVER_RANGE` after it when a limb record carries a `range` (issue #360: `status`, `frame_scale`, `physics_left_out`, `bar` — `mean`, `rig_px_over_40`, `level` — and `joints`, each `part`, `limb`, `segment`, `joint`, `bone`, `range`, `at`, `radius`, `under_px`, `status`, `poses` — each `degrees`, `status`, `mean`, `px_over_40`, `px_over_80`, `rig_px_over_40` — and `unread` on a joint not read), `SEAM_OVER_MOTION` after it when `parts.json` holds a limb segment or `--requirements` a `seam` (issue #493, a warning and not a bar: `status` — `WARN`, `CLEAR` or `SKIP` — `reason` on a SKIP only, `fps`, `floor`, `pairs` — each `pair`, `a`, `b`, `declared`, and `unread` on a pair not read — `animations`, `warnings`, `rows` — each `pair`, `animation`, `status`, `drawn`, `banded`, `opens`, `px`, `max_px`, `under_floor`), `CLOTH_SETTLES` after it when the rig declares a physics constraint and has an idle (issue #501, a warning and not a bar: `status` — `WARN` or `CLEAR` — `fps`, `frames`, `duration`, `floor_rig_px_per_s`, `floor`, `levers`, `warnings`, `rows` — each `tip`, `root`, `links`, `point`, `settles_at`, `max_rig_px_per_s`, `min_rig_px_per_s`), `RECOMPOSITE_HOLES` (its first figure `declared_scene` when `parts.json` declares a scene), `SETUP_POSE_VS_SOURCE`, `skipped`, a `requirements` block under `--requirements`, and `PASS`; `check/build/skeleton.json`, `.atlas` and `.png` are the packed artifact rig-c writes |
197
197
  | `layers.json`, `<index>_<name>.png` | `layers --export` | the wrapper form `layers` reads (issue #359): `width`, `height`, then `layers` — each `name`, `filename`, `left`, `top`, `right`, `bottom`, `depth_median` (the input's own; `null` for a PSD, the manifest's order then being the draw order) — drawn layers in draw order, then the hidden-art layers; a PNG's name is its index and its layer's name, and the manifest, not the file name, says which layer it is |
198
198
  | the template `.psd` | `layers --template` | one empty layer per name `templateLayerNames` (`src/layers.ts`) holds, bottom first; the same canvas writes the same bytes |
199
199
  | `proposal.json`, `render/landmarks*.png` | `propose` | the config's four rig sections, `constraints` with `--cloth` (issue #364: a physics constraint per tree link named `<bone>_physics`, a dangling end's `<bone>_translate`, and a skirt swing's transforms `<swing>_<tree>`), `turn` with `--full`/`--head`, `proposed_rig_scale` (issue #354), and `notes` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rig-parts",
3
- "version": "1.47.0",
3
+ "version": "1.48.0",
4
4
  "description": "AI-authored 2D character parts from one anime painting and its See-through layer decomposition: measured parts, weighted-mesh rig specs, verified through rig-c before anything is written. A CLI for agents that cannot see the image.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/build.ts CHANGED
@@ -70,7 +70,7 @@ import {
70
70
  splitSchedule,
71
71
  untestedIntervals,
72
72
  } from './autoreplay.ts';
73
- import { besideIdleLine, CLOTH_LINE, type ClothLine, clothWarnText, frameRuns, MOTION_SEAM_LINE, type MotionSeamLine, type MotionSeamPlant, motionSeamWarnText, FOLD_LINE, type FoldsLine, LEVEL_LINE, type LevelLine, LIMB_LINE, type LimbLine, STRESS_LINE, SWEEP_LINE, type SweepLine, buildGateLines, causeLines, IDLE_FPS, IDLE_MAX_PX, maxRgbDiff, REQUIREMENTS_DIR, type CheckReport, type PackLine, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, GATE_PROFILE, JUDGEMENT_LINES, type JudgementLine, packedBuildArgs, packedBuildLabel, type PackMode, type PackShape, type PageEdges, readFrameSet, rigcFailed, rigcIdentity, rigcRanClause, REPORTED_LINES, type ReportedLine, type RigcRunner, runCheck, SEAM_DIR, SEAM_MEAN_BAR, seamPairText, seamRigPxText, SOURCE_LINE, SEAM_PX_BAR, SEAM_PX_LEVEL, SEAM_PX_LEVEL_HIGH, SPINEBOY_YARDSTICK, STILL_DIR } from './check.ts';
73
+ import { besideIdleLine, CLOTH_LINE, type ClothLine, clothWarnText, frameRuns, MOTION_SEAM_LINE, type MotionSeamLine, type MotionSeamPlant, motionSeamWarnText, FOLD_LINE, type FoldsLine, LEVEL_LINE, type LevelLine, LIMB_LINE, type LimbLine, STRESS_LINE, SWEEP_LINE, type SweepLine, buildGateLines, causeLines, environmentLine, IDLE_FPS, IDLE_MAX_PX, maxRgbDiff, REQUIREMENTS_DIR, type CheckReport, type PackLine, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, GATE_PROFILE, JUDGEMENT_LINES, type JudgementLine, packedBuildArgs, packedBuildLabel, type PackMode, readCheckEnvironment, type PackShape, type PageEdges, readFrameSet, rigcFailed, rigcIdentity, rigcRanClause, REPORTED_LINES, type ReportedLine, type RigcRunner, runCheck, SEAM_DIR, SEAM_MEAN_BAR, seamPairText, seamRigPxText, SOURCE_LINE, SEAM_PX_BAR, SEAM_PX_LEVEL, SEAM_PX_LEVEL_HIGH, SPINEBOY_YARDSTICK, STILL_DIR } from './check.ts';
74
74
  import { type Cut, type Extend, type Limb, loadConfig, loadConfigAndAnimations, loadEarlyConfig, type Patch, type PlanEntry } from './config.ts';
75
75
  import { failLine, PartsError, type Problem, refuseIfAny } from './errors.ts';
76
76
  import type { MeshQualityReport, MotionSchedule } from 'rig-c/mesh';
@@ -1359,6 +1359,11 @@ export interface CheckStageInput {
1359
1359
  set?: string;
1360
1360
  /** `check --all-sets` (issue #454): measure every declared alternate set's setup-pose seam and recomposite figures. */
1361
1361
  allSets?: boolean;
1362
+ /**
1363
+ * `check --environment <file>` (issue #538): a `rigc-environment/1` schedule every render a bar or a warning reads
1364
+ * with the physics on is posed under; absent, no render argument and no byte of `check.json` moves.
1365
+ */
1366
+ environment?: string;
1362
1367
  }
1363
1368
 
1364
1369
  /**
@@ -1581,7 +1586,8 @@ export function checkStage(input: CheckStageInput, rigc: RigcRunner, bin: string
1581
1586
  const entryLine = versionLines.find((l) => l.startsWith('entry:'));
1582
1587
  log(` ${rigcIdentity(bin, v)}${entryLine === undefined ? '' : `; ${entryLine}`}`);
1583
1588
  const mode: PackMode = { pageEdges: input.pageEdges ?? DEFAULT_PAGE_EDGES, packShape: input.packShape ?? DEFAULT_PACK_SHAPE };
1584
- const r = runCheck(input.rig, input.out, rigc, input.parts, mode, input.source, input.requirements, input.seamPairs === true, input.keepStills === true, input.set, input.allSets === true);
1589
+ const r = runCheck(input.rig, input.out, rigc, input.parts, mode, input.source, input.requirements, input.seamPairs === true, input.keepStills === true, input.set, input.allSets === true, input.environment);
1590
+ if (r.figures.environment !== undefined) log(` ${environmentLine(r.figures.environment)}`);
1585
1591
  log(` gate rig-play (rigc ${packedBuildLabel(mode)}), verbatim:`);
1586
1592
  for (const l of r.gateHtml) log(l);
1587
1593
  for (const l of packLines(r)) log(` ${l}`);
@@ -1920,6 +1926,8 @@ export interface BuildInput {
1920
1926
  set?: string;
1921
1927
  /** `--all-sets`, forwarded to the check as `check` takes it (issue #454). */
1922
1928
  allSets?: boolean;
1929
+ /** `--environment <file>`, forwarded to the check as `check` takes it (issue #538): read before assemble runs, so a schedule check would refuse is refused first; absent, nothing moves. */
1930
+ environment?: string;
1923
1931
  }
1924
1932
 
1925
1933
  /** What `build` does with one flag `check` takes: hands it to its check stage, takes it as its own, or refuses it because build supplies the value itself. */
@@ -1946,6 +1954,7 @@ export const CHECK_FLAGS_IN_BUILD: Readonly<Record<string, CheckFlagInBuild>> =
1946
1954
  '--all-sets': { as: 'forwarded' },
1947
1955
  '--seam-pairs': { as: 'forwarded' },
1948
1956
  '--keep-stills': { as: 'forwarded' },
1957
+ '--environment': { as: 'forwarded' },
1949
1958
  };
1950
1959
 
1951
1960
  /** The `build` refusal of a `check` flag build supplies itself ({@link CHECK_FLAGS_IN_BUILD}), or null for any other flag. */
@@ -2039,6 +2048,8 @@ export function build(input: BuildInput, run: BuildRunners, log: Log): BuildResu
2039
2048
  loadConfig(input.config);
2040
2049
  // The same for the requirements file's own shape; its names resolve against the rig, in the check, before it builds.
2041
2050
  if (input.requirements !== undefined) readRequirements(input.requirements);
2051
+ // And the schedule (issue #538), by rigc's own reader, as check reads it.
2052
+ if (input.environment !== undefined) readCheckEnvironment(input.environment);
2042
2053
  assembleStage(
2043
2054
  { source: input.source, full: input.full, head: input.head, config: input.config, seam: input.seam, project: input.project, ...(input.alts === undefined ? {} : { alts: input.alts }) },
2044
2055
  { partsJson: join(out, 'parts.json'), partsDir: join(out, 'parts'), recomposite: join(out, 'recomposite_rig.png'), errorMap: join(out, ERROR_MAP_FILE) },
@@ -2056,7 +2067,7 @@ export function build(input: BuildInput, run: BuildRunners, log: Log): BuildResu
2056
2067
 
2057
2068
  let report: CheckReport;
2058
2069
  try {
2059
- report = checkStage({ rig: join(out, 'rig'), parts: out, out: join(out, 'check'), pageEdges: input.pageEdges, packShape: input.packShape, ...(input.requirements === undefined ? {} : { requirements: input.requirements }), seamPairs: input.seamPairs === true, keepStills: input.keepStills === true, ...(input.set === undefined ? {} : { set: input.set }), allSets: input.allSets === true }, run.check, run.checkBin, prefixed('check'));
2070
+ report = checkStage({ rig: join(out, 'rig'), parts: out, out: join(out, 'check'), pageEdges: input.pageEdges, packShape: input.packShape, ...(input.requirements === undefined ? {} : { requirements: input.requirements }), seamPairs: input.seamPairs === true, keepStills: input.keepStills === true, ...(input.set === undefined ? {} : { set: input.set }), allSets: input.allSets === true, ...(input.environment === undefined ? {} : { environment: input.environment }) }, run.check, run.checkBin, prefixed('check'));
2060
2071
  } catch (err) {
2061
2072
  return refused('check', err);
2062
2073
  }
package/src/check.ts CHANGED
@@ -77,6 +77,7 @@
77
77
  * the last idle frame is refused unless it sits at t = duration (within
78
78
  * `TIME_SLACK`, issue #244).
79
79
  */
80
+ import { createHash } from 'node:crypto';
80
81
  import { copyFileSync, cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
81
82
  import { basename, delimiter, dirname, join, resolve } from 'node:path';
82
83
  import { measureRecomposite, type RecompositeFigures, recompositeRecord, scenePhrase, sourceInRig } from './assemble.ts';
@@ -158,6 +159,7 @@ import {
158
159
  } from './requirements.ts';
159
160
  import { RIG_BONE_INHERIT, type RigSpec as RigcRigSpec } from 'rig-c/src/rig.ts';
160
161
  import { expandStops } from 'rig-c/src/stop.ts';
162
+ import { ENVIRONMENT_SPEC, EnvironmentError, readEnvironmentSchedule } from 'rig-c/src/environment.ts';
161
163
  import { alphaComposite } from './raster/composite.ts';
162
164
  import { readPng, writePng } from './raster/png.ts';
163
165
  import { newFloatImage, newRaster, type Raster } from './raster/types.ts';
@@ -1814,6 +1816,12 @@ export interface CheckFigures {
1814
1816
  rigc_entry: RigcEntryRecord;
1815
1817
  /** How the artifact's page was packed: the `--page-edges` and `--pack-shape` rigc was handed, which its pack line was read to agree with ({@link packEdgeProblems}). Provenance, not a bar. */
1816
1818
  pack_mode: { page_edges: PageEdges; pack_shape: PackShape };
1819
+ /**
1820
+ * Written only under `--environment` (issue #538): the `rigc-environment/1` schedule every measured render was posed
1821
+ * under — the path as the command line gave it, the sha256 of the bytes read, and how many steps rigc's reader read
1822
+ * off them ({@link readCheckEnvironment}). Provenance, not a bar; without the flag no key is written.
1823
+ */
1824
+ environment?: CheckEnvironment;
1817
1825
  /** Null when the rig has no idle (issue #77); `skipped.loop` then says why. */
1818
1826
  loop_max_diff: number | null;
1819
1827
  /**
@@ -3577,6 +3585,61 @@ export function rigcFailed(what: string, call: RigcCall, lines: readonly string[
3577
3585
  return quoted.map((l) => ({ code: 'CHECK_RIGC_GREEN', object, detail: `exit ${call.status}: ${l}${ran}` }));
3578
3586
  }
3579
3587
 
3588
+ // ---------------------------------------------------------------------------
3589
+ // the world the readings are taken in (issue #538)
3590
+ // ---------------------------------------------------------------------------
3591
+
3592
+ /** The refusal of a schedule `check --environment` names: rigc's reader's sentence, or rigc render's, verbatim. */
3593
+ export const ENVIRONMENT_RULE = 'CHECK_ENVIRONMENT';
3594
+
3595
+ /** What `check.json` records of the schedule under `--environment`: provenance, not a bar. */
3596
+ export interface CheckEnvironment {
3597
+ /** The path as the command line gave it — never resolved, so the record holds no directory the caller did not type. */
3598
+ path: string;
3599
+ /** The sha256 of the file's bytes as read, the bytes rigc's reader read. */
3600
+ sha256: string;
3601
+ /** How many steps rigc's reader read off it. */
3602
+ steps: number;
3603
+ }
3604
+
3605
+ function environmentRefused(given: string, sentence: string): PartsError {
3606
+ return new PartsError([{ code: ENVIRONMENT_RULE, object: given, detail: sentence }]);
3607
+ }
3608
+
3609
+ /**
3610
+ * `--environment <file>` read once, before anything is built (issue #538): the file's bytes hashed and handed to
3611
+ * rig-c's own reader, `readEnvironmentSchedule` (`rig-c/src/environment.ts`), which refuses every malformed schedule
3612
+ * — a `spec` other than {@link ENVIRONMENT_SPEC}, a key it does not read, no step, a `t` that is not finite, at or
3613
+ * above 0 and after the step before, a `wind` or `gravity` that is not a pair of finite numbers, a step that changes
3614
+ * nothing — by entry, field, the value found and the value required. Nothing here reads the schedule's meaning: its
3615
+ * sentence is carried as {@link ENVIRONMENT_RULE}'s detail, verbatim, and a path with no file at it is worded as
3616
+ * `rigc render --environment` words it. What a well-formed schedule cannot do to this rig — move a rig with no
3617
+ * physics constraint, change a half no constraint answers, fall after the last frame drawn — is rigc render's to
3618
+ * refuse, and {@link runCheck} carries that sentence the same way.
3619
+ */
3620
+ export function readCheckEnvironment(given: string): CheckEnvironment {
3621
+ const path = resolve(given);
3622
+ if (!existsSync(path) || !statSync(path).isFile()) throw environmentRefused(given, `--environment ${given}: nothing at ${path} — it takes a schedule file { "spec": "${ENVIRONMENT_SPEC}", "steps": [...] }`);
3623
+ let bytes: Buffer;
3624
+ try {
3625
+ bytes = readFileSync(path);
3626
+ } catch (err) {
3627
+ throw environmentRefused(given, `--environment ${given}: not readable — ${(err as Error).message}`);
3628
+ }
3629
+ try {
3630
+ const steps = readEnvironmentSchedule(bytes.toString('utf8'), given);
3631
+ return { path: given, sha256: createHash('sha256').update(bytes).digest('hex'), steps: steps.length };
3632
+ } catch (err) {
3633
+ if (err instanceof EnvironmentError) throw environmentRefused(given, err.message);
3634
+ throw err;
3635
+ }
3636
+ }
3637
+
3638
+ /** The line `check` prints under `--environment`, beside rigc's identity: which schedule, by path and digest, and which renders it poses. */
3639
+ export function environmentLine(env: CheckEnvironment): string {
3640
+ return `environment: ${env.path}, ${ENVIRONMENT_SPEC}, ${env.steps} step(s), sha256 ${env.sha256.slice(0, 16)} — every render a bar or a warning reads with the physics on is posed under it; the physics-off, setup-pose and loop renders are not`;
3641
+ }
3642
+
3580
3643
  /**
3581
3644
  * Run the whole check. Refuses (throws a PartsError) when the inputs are
3582
3645
  * unreadable or a rigc step that everything after it depends on is red — the
@@ -3603,23 +3666,28 @@ export function rigcFailed(what: string, call: RigcCall, lines: readonly string[
3603
3666
  * MEASURABLE is a problem. Without it nothing here reads, writes or prints
3604
3667
  * anything it did not before.
3605
3668
  */
3606
- export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, partsHome?: string, mode: PackMode = DEFAULT_PACK_MODE, source?: string, requirements?: string, seamPairsAsked = false, keepStills = false, set?: string, allSets = false): CheckReport {
3669
+ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, partsHome?: string, mode: PackMode = DEFAULT_PACK_MODE, source?: string, requirements?: string, seamPairsAsked = false, keepStills = false, set?: string, allSets = false, environment?: string): CheckReport {
3607
3670
  let inp: CheckInputs;
3608
3671
  let reqFile: RequirementsFile | null = null;
3609
3672
  let seams: Map<string, SeamPair[]> | null = null;
3610
- if (requirements === undefined) inp = readCheckInputs(rigDir, partsHome, source, set, allSets);
3611
- else {
3612
- // Both readers collect every problem; one refusal names both sets.
3613
- const refused: Problem[] = [];
3614
- const take = <T>(read: () => T): T | null => {
3615
- try {
3616
- return read();
3617
- } catch (err) {
3618
- if (!(err instanceof PartsError)) throw err;
3619
- refused.push(...err.problems);
3620
- return null;
3621
- }
3622
- };
3673
+ // Every reader collects every problem; one refusal names every set.
3674
+ const refused: Problem[] = [];
3675
+ const take = <T>(read: () => T): T | null => {
3676
+ try {
3677
+ return read();
3678
+ } catch (err) {
3679
+ if (!(err instanceof PartsError)) throw err;
3680
+ refused.push(...err.problems);
3681
+ return null;
3682
+ }
3683
+ };
3684
+ // Issue #538: the schedule is read once, first, by rigc's own reader; refused, nothing is built or written.
3685
+ const env = environment === undefined ? null : take(() => readCheckEnvironment(environment));
3686
+ if (requirements === undefined) {
3687
+ const got = take(() => readCheckInputs(rigDir, partsHome, source, set, allSets));
3688
+ refuseIfAny(refused);
3689
+ inp = got as CheckInputs;
3690
+ } else {
3623
3691
  const got = take(() => readCheckInputs(rigDir, partsHome, source, set, allSets));
3624
3692
  reqFile = take(() => readRequirements(requirements));
3625
3693
  refuseIfAny(refused);
@@ -3638,7 +3706,29 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
3638
3706
  }
3639
3707
  refuseIfAny(refused);
3640
3708
  }
3709
+ // Issue #538: a motion with no animation gives check no render a schedule could pose — every frame it reads would be
3710
+ // the setup still's — so the flag is refused rather than recorded over readings it did not move.
3711
+ if (env !== null && !(isRecord(inp.motion.animations) && Object.keys(inp.motion.animations).length > 0)) {
3712
+ throw environmentRefused(env.path, `${inp.motionPath} holds no animation, so check renders no frame a schedule could pose — the setup-pose stills take none; rigc render reads a schedule only over an animation's frames`);
3713
+ }
3641
3714
  const rigcEntry = readRigcEntry(requireRigcVersion(rigc));
3715
+ /**
3716
+ * Issue #538: a render whose frames a bar or a warning reads, with the physics on — posed under the schedule when
3717
+ * `--environment` names one (the path as given; rigc reads the file the same way). A refusal rigc render prints of
3718
+ * the schedule against this rig (its `--environment <path>:` line) is carried as {@link ENVIRONMENT_RULE}, verbatim;
3719
+ * any other failure is the call site's to name. Without the flag it is `rigc`, and no argument moves.
3720
+ */
3721
+ const measured: RigcRunner =
3722
+ env === null
3723
+ ? rigc
3724
+ : (args) => {
3725
+ const call = rigc([...args, '--environment', env.path]);
3726
+ if (call.status !== 0) {
3727
+ const said = call.out.split('\n').map((l) => l.trim()).find((l) => l.startsWith(`rigc: --environment ${env.path}: `));
3728
+ if (said !== undefined) throw environmentRefused(env.path, `${said.slice('rigc: '.length)}${rigcRanClause(call)}`);
3729
+ }
3730
+ return call;
3731
+ };
3642
3732
  const out = resolve(outDir);
3643
3733
  mkdirSync(out, { recursive: true });
3644
3734
  const buildDir = join(out, 'build');
@@ -3709,7 +3799,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
3709
3799
  const levelProblems: Problem[] = [];
3710
3800
  try {
3711
3801
  if (inp.idleDuration !== null) {
3712
- const render = rigc(['render', '--candidate', buildDir, '--animation', 'idle', '--fps', String(IDLE_FPS), '--max', String(IDLE_MAX_PX), '--geometry', '--out', idleDir]);
3802
+ const render = measured(['render', '--candidate', buildDir, '--animation', 'idle', '--fps', String(IDLE_FPS), '--max', String(IDLE_MAX_PX), '--geometry', '--out', idleDir]);
3713
3803
  if (render.status !== 0) refuseIfAny(rigcFailed('render --animation idle --geometry', render, render.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
3714
3804
  idle = readFrameSet(idleDir);
3715
3805
  const last = idle.frames[idle.frames.length - 1];
@@ -3784,7 +3874,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
3784
3874
  // Issue #348: with a foot to read, the keyed render writes each animation's geometry as well.
3785
3875
  const geometry = feet.length > 0 ? ['--geometry'] : [];
3786
3876
  if (stripped === null) {
3787
- const fr = rigc(['render', '--candidate', buildDir, '--folds', ...geometry, '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--out', foldDir]);
3877
+ const fr = measured(['render', '--candidate', buildDir, '--folds', ...geometry, '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--out', foldDir]);
3788
3878
  if (fr.status !== 0) refuseIfAny(rigcFailed(`render --folds${geometry.map((g) => ` ${g}`).join('')} --fps ${fps}`, fr, fr.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
3789
3879
  const readings = filterFolds(readFoldSets(foldDir, animationNames, fps, fr.out));
3790
3880
  folds = foldsLine(animationNames, fps, 0, readings, mayFoldForRun, reqFile === null ? null : reqFile.path, foldProblems, readings, inp.rig, []);
@@ -3800,8 +3890,10 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
3800
3890
  } else {
3801
3891
  const onDir = join(foldDir, 'on');
3802
3892
  const offDir = join(foldDir, 'off');
3803
- const frOn = rigc(['render', '--candidate', buildDir, '--folds', '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--out', onDir]);
3893
+ const frOn = measured(['render', '--candidate', buildDir, '--folds', '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--out', onDir]);
3804
3894
  if (frOn.status !== 0) refuseIfAny(rigcFailed(`render --folds --fps ${fps}`, frOn, frOn.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
3895
+ // The physics-off half takes no schedule (issue #538): its candidate declares no physics constraint, so no
3896
+ // world moves it, and rigc render refuses a schedule on it by name.
3805
3897
  const frOff = rigc(['render', '--candidate', keyedBuild('the animations with their physics constraint(s) left out'), '--folds', ...geometry, '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--out', offDir]);
3806
3898
  if (frOff.status !== 0) refuseIfAny(rigcFailed(`render --folds${geometry.map((g) => ` ${g}`).join('')} --fps ${fps} (physics constraint(s) left out)`, frOff, frOff.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
3807
3899
  const readingsOn = filterFolds(readFoldSets(onDir, animationNames, fps, frOn.out));
@@ -3828,7 +3920,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
3828
3920
  // 3b. the parts a judgement reads alone: each rendered by its own slots, on the whole rig's grid
3829
3921
  const isolated = (label: string, ps: readonly PartRecord[]): FrameSet => {
3830
3922
  const dir = join(isoDir, label);
3831
- const r = rigc(['render', '--candidate', buildDir, '--animation', 'idle', '--fps', String(IDLE_FPS), '--max', String(IDLE_MAX_PX), '--slot', ps.map((p) => p.name).join(','), '--out', dir]);
3923
+ const r = measured(['render', '--candidate', buildDir, '--animation', 'idle', '--fps', String(IDLE_FPS), '--max', String(IDLE_MAX_PX), '--slot', ps.map((p) => p.name).join(','), '--out', dir]);
3832
3924
  if (r.status !== 0) refuseIfAny(rigcFailed(`render --animation idle --slot ${ps.map((p) => p.name).join(',')}`, r, r.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
3833
3925
  return readFrameSet(dir);
3834
3926
  };
@@ -3853,7 +3945,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
3853
3945
  if (b.status !== 0) refuseIfAny(rigcFailed(`${packedBuildLabel(mode)} (BREATH_VISIBLE's copy, the idle beside it with its breath tracks held at rest)`, b, buildGateLines(b.out)));
3854
3946
  const slots = ps.map((p) => p.name).join(',');
3855
3947
  const render = (animation: string, label: string): FrameSet => {
3856
- const r = rigc(['render', '--candidate', join(dir, 'build'), '--animation', animation, '--fps', String(IDLE_FPS), '--max', String(IDLE_MAX_PX), '--slot', slots, '--out', join(dir, label)]);
3948
+ const r = measured(['render', '--candidate', join(dir, 'build'), '--animation', animation, '--fps', String(IDLE_FPS), '--max', String(IDLE_MAX_PX), '--slot', slots, '--out', join(dir, label)]);
3857
3949
  if (r.status !== 0) refuseIfAny(rigcFailed(`render --animation ${animation} --slot ${slots} (BREATH_VISIBLE's copy)`, r, r.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
3858
3950
  return readFrameSet(join(dir, label));
3859
3951
  };
@@ -4003,7 +4095,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
4003
4095
  rmSync(seamMotionDir, { recursive: true, force: true });
4004
4096
  try {
4005
4097
  const list = read.map((p) => `${p.a}:${p.b}`).join(',');
4006
- const r = rigc(['render', '--candidate', buildDir, '--seam', list, '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--out', seamMotionDir]);
4098
+ const r = measured(['render', '--candidate', buildDir, '--seam', list, '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--out', seamMotionDir]);
4007
4099
  if (r.status !== 0) refuseIfAny(rigcFailed(`render --seam ${list} --fps ${fps}`, r, r.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
4008
4100
  motionSeam = motionSeamLine(pairs, animationNames, fps, readMotionSeams(seamMotionDir, animationNames, fps, read));
4009
4101
  } finally {
@@ -4183,7 +4275,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
4183
4275
 
4184
4276
  // 5. the scene's declared requirements (issue #93), only under --requirements
4185
4277
  const reqProblems: Problem[] = [];
4186
- const reqBlock = reqFile === null ? null : measureRequirements(inp, reqFile, buildDir, out, rigc, reqProblems, seams ?? new Map());
4278
+ const reqBlock = reqFile === null ? null : measureRequirements(inp, reqFile, buildDir, out, rigc, reqProblems, seams ?? new Map(), measured);
4187
4279
 
4188
4280
  const skipped: { loop?: string; seam?: string } = {};
4189
4281
  if (inp.noIdle !== null) skipped.loop = inp.noIdle;
@@ -4192,6 +4284,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
4192
4284
  gate_spine_html_green: htmlGreen,
4193
4285
  rigc_entry: rigcEntry,
4194
4286
  pack_mode: { page_edges: mode.pageEdges, pack_shape: mode.packShape },
4287
+ ...(env === null ? {} : { environment: env }),
4195
4288
  loop_max_diff: loop === null ? null : loop.max,
4196
4289
  ...(loopPhysics === null ? {} : { loop_physics: loopPhysics }),
4197
4290
  seam_mean: seam === null ? null : round3(seam.mean),
@@ -4329,7 +4422,7 @@ const REQUIREMENTS_SCRATCH = '_requirements';
4329
4422
  * `CHECK_RIGC_GREEN`, quoting rigc. Lines go into the returned block; each
4330
4423
  * FAIL and NOT MEASURABLE into `problems`.
4331
4424
  */
4332
- export function measureRequirements(inp: CheckInputs, file: RequirementsFile, buildDir: string, out: string, rigc: RigcRunner, problems: Problem[], seams: ReadonlyMap<string, readonly SeamPair[]> = new Map()): RequirementsBlock {
4425
+ export function measureRequirements(inp: CheckInputs, file: RequirementsFile, buildDir: string, out: string, rigc: RigcRunner, problems: Problem[], seams: ReadonlyMap<string, readonly SeamPair[]> = new Map(), render: RigcRunner = rigc): RequirementsBlock {
4333
4426
  const reqDir = join(out, REQUIREMENTS_DIR);
4334
4427
  const scratch = join(out, REQUIREMENTS_SCRATCH);
4335
4428
  for (const d of [reqDir, scratch]) rmSync(d, { recursive: true, force: true });
@@ -4350,7 +4443,7 @@ export function measureRequirements(inp: CheckInputs, file: RequirementsFile, bu
4350
4443
  return b.dir;
4351
4444
  };
4352
4445
  const posesOf = (candidate: string, animation: string, dir: string, label: string): { poses: Poses; geo: IdleGeometry; path: string } => {
4353
- const r = rigc(['render', '--candidate', candidate, '--animation', animation, '--fps', String(file.fps), '--max', String(IDLE_MAX_PX), '--geometry', '--out', dir]);
4446
+ const r = render(['render', '--candidate', candidate, '--animation', animation, '--fps', String(file.fps), '--max', String(IDLE_MAX_PX), '--geometry', '--out', dir]);
4354
4447
  if (r.status !== 0) refuseIfAny(rigcFailed(`render --animation ${animation} --geometry (${label})`, r, r.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
4355
4448
  const set = readFrameSet(dir);
4356
4449
  if (set.written !== set.sampled || set.stride !== 1) {