rig-parts 2.63.1 → 2.65.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/src/build.ts CHANGED
@@ -2201,6 +2201,8 @@ export interface CheckStageInput {
2201
2201
  keepStills?: boolean;
2202
2202
  /** Skip the extra extremes renders and remove stale extremes outputs (issue #829). */
2203
2203
  noExtremes?: boolean;
2204
+ /** Use the stock idle render as scratch for compose preview. */
2205
+ previewIdle?: boolean;
2204
2206
  /** Declared RGBA loop seam bar and warm-up cap for the shipped idle render (issue #1590). */
2205
2207
  loopSeam?: LoopSeamRequest;
2206
2208
  /** `check --set <name>` (issue #454): measure one declared alternate set's setup-pose seam and recomposite figures. */
@@ -2447,10 +2449,10 @@ export function requirementText(name: string, line: RequirementLine): string {
2447
2449
  * check wrote them, then the directories it wrote whole (`build`, and `idle_frames`, the requirements, seam and
2448
2450
  * setup-still directories when they were written). The `check-run.json` record lists the files under these.
2449
2451
  */
2450
- export function checkWrote(r: CheckReport, out: string): { written: string[]; dirs: string[] } {
2452
+ export function checkWrote(r: CheckReport, out: string, previewIdle = false): { written: string[]; dirs: string[] } {
2451
2453
  return {
2452
2454
  written: r.written,
2453
- dirs: ['build', ...(r.idle === null ? [] : ['idle_frames']), ...(r.requirements === null ? [] : [REQUIREMENTS_DIR]),
2455
+ dirs: ['build', ...(r.idle === null || previewIdle ? [] : ['idle_frames']), ...(r.requirements === null ? [] : [REQUIREMENTS_DIR]),
2454
2456
  ...(r.figures.seam_pairs === undefined ? [] : [SEAM_DIR]), ...(existsSync(join(out, STILL_DIR)) ? [STILL_DIR] : [])],
2455
2457
  };
2456
2458
  }
@@ -2471,7 +2473,7 @@ export function checkStage(input: CheckStageInput, rigc: RigcRunner, bin: string
2471
2473
  const r = runCheck(
2472
2474
  input.rig, input.out, rigc, input.parts, mode, input.source, input.requirements, input.seamPairs === true,
2473
2475
  input.keepStills === true, input.set, input.allSets === true, input.environment, input.requirementsAs, input.config,
2474
- input.windBand, input.noExtremes === true, input.supportSource, input.supportFigure, input.assemblyRules, input.loopSeam,
2476
+ input.windBand, input.noExtremes === true, input.supportSource, input.supportFigure, input.assemblyRules, input.loopSeam, input.previewIdle,
2475
2477
  );
2476
2478
  if (r.figures.environment !== undefined) log(` ${environmentLine(r.figures.environment)}`);
2477
2479
  log(` gate rig-play (rigc ${packedBuildLabel(mode)}), verbatim:`);
@@ -2559,7 +2561,7 @@ export function checkStage(input: CheckStageInput, rigc: RigcRunner, bin: string
2559
2561
  log(` ${summaryText(r.requirements.summary)}`);
2560
2562
  }
2561
2563
  log(` gate: rig-play ${fig.gate_spine_html_green ? 'green' : 'RED'} (${fig.rigc_entry.entry}${fig.rigc_entry.spine_core === null ? ', rigc\'s own validator' : `, the spine-core ${fig.rigc_entry.spine_core} round trip`})`);
2562
- const wrote = checkWrote(r, input.out);
2564
+ const wrote = checkWrote(r, input.out, input.previewIdle);
2563
2565
  log(` wrote ${[...wrote.written.map((w) => join(input.out, w)), ...wrote.dirs.map((d) => `${join(input.out, d)}/`)].join(', ')}`);
2564
2566
  for (const p of r.problems) log(failLine(p));
2565
2567
  log(checkSummaryLine(r));
package/src/check.ts CHANGED
@@ -233,7 +233,7 @@ const STILL_FPS = 10;
233
233
 
234
234
  /** The caller's RGBA seam bar and maximum number of warm-up loops. */
235
235
  export type LoopSeamRequest = { channelDelta: number; pixelsAbove: number; cap: number };
236
-
236
+ export const COMPOSE_PREVIEW_LOOP_SEAM_DETAIL = 'found=preview, required=default or no-extremes. The check.json loop_seam record binds the first and wrap PNG paths and hashes under check/idle_frames/, which preview removes.';
237
237
  const LOOP_SEAM_SPEC = 'rigc-loop-seam/1';
238
238
  export const LOOP_SEAM_BAR_UNMET = 'LOOP_SEAM_BAR_UNMET';
239
239
  const LOOP_SEAM_FILE = 'loop-seam.json';
@@ -6970,6 +6970,7 @@ function renderExtremes(build: string, out: string, animations: readonly string[
6970
6970
  * or `motion_heat.png`). A declared `loopSeam` requires a positive idle and
6971
6971
  * binds Core's met wrap-seam report to the shipped render. The keyed reading
6972
6972
  * still runs. `source` (`--source`) adds {@link SOURCE_LINE}.
6973
+ * Compose preview reads the stock idle render as scratch and omits the idle diagnostics.
6973
6974
  *
6974
6975
  * `requirements` (`--requirements`, issue #93) is read with the rig directory
6975
6976
  * and resolved against it before anything is built ({@link readRequirements},
@@ -6979,9 +6980,14 @@ function renderExtremes(build: string, out: string, animations: readonly string[
6979
6980
  * MEASURABLE is a problem. Without it nothing here reads, writes or prints
6980
6981
  * anything it did not before.
6981
6982
  */
6982
- 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, _requirementsAs: string | undefined = requirements, config?: InputFileRecord, windBand?: string, noExtremes = false, supportSource?: string, supportFigure?: Mask, assemblyRules?: AssemblyRules, loopSeam?: LoopSeamRequest): CheckReport {
6983
+ 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, _requirementsAs: string | undefined = requirements, config?: InputFileRecord, windBand?: string, noExtremes = false, supportSource?: string, supportFigure?: Mask, assemblyRules?: AssemblyRules, loopSeam?: LoopSeamRequest, previewIdle = false): CheckReport {
6983
6984
  const out = resolve(outDir);
6984
- if (loopSeam !== undefined) rmSync(join(out, 'check.json'), { force: true });
6985
+ if (loopSeam !== undefined || previewIdle) rmSync(join(out, 'check.json'), { force: true });
6986
+ if (previewIdle && loopSeam !== undefined) throw new PartsError([{
6987
+ code: 'COMPOSE_PREVIEW_REQUIRED_CHECK',
6988
+ object: '--loop-seam-bar',
6989
+ detail: COMPOSE_PREVIEW_LOOP_SEAM_DETAIL,
6990
+ }]);
6985
6991
  const pageSize = parsePageSize(mode.pageSize);
6986
6992
  let inp: CheckInputs;
6987
6993
  let reqFile: RequirementsFile | null = null;
@@ -7069,7 +7075,8 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
7069
7075
  const animationNames = isRecord(inp.motion.animations) ? Object.keys(inp.motion.animations) : [];
7070
7076
  const selectedAlts = inp.parts === null || (set === undefined && !allSets) ? []
7071
7077
  : allSets ? inp.parts.alternates ?? [] : (inp.parts.alternates ?? []).filter(alt => alt.name === set);
7072
- preflightCheckPaths(animationNames, selectedAlts.map(alt => alt.name), reqFile, noExtremes);
7078
+ const omitExtremes = noExtremes || previewIdle;
7079
+ preflightCheckPaths(animationNames, selectedAlts.map(alt => alt.name), reqFile, omitExtremes);
7073
7080
  // A measured material failure is a check bar; unavailable data is a refusal.
7074
7081
  const rigcEntry = readRigcEntry(requireRigcVersion(rigc));
7075
7082
  /**
@@ -7102,6 +7109,9 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
7102
7109
  const seamMotionDir = join(out, MOTION_SEAM_SCRATCH);
7103
7110
  const windBandDir = join(out, WIND_BAND_SCRATCH);
7104
7111
  for (const d of [join(out, 'extremes'), join(out, '_extremes'), buildDir, buildReportPath, idleDir, stillDir, isoDir, loopDir, seamDir, keptDir, join(out, 'setup_still_auto'), foldDir, seamMotionDir, windBandDir]) rmSync(d, { recursive: true, force: true });
7112
+ if (previewIdle) {
7113
+ for (const name of ['contact.png', 'motion_heat.png']) rmSync(join(out, name), { force: true });
7114
+ }
7105
7115
  const written: string[] = [];
7106
7116
  const write = (name: string, data: string): void => {
7107
7117
  writeFileSync(join(out, name), data);
@@ -7221,7 +7231,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
7221
7231
  }
7222
7232
  loopSeamEvidence = checked?.report ?? null;
7223
7233
  const contact = join(idle.dir, 'contact.png');
7224
- if (existsSync(contact)) {
7234
+ if (!previewIdle && existsSync(contact)) {
7225
7235
  copyFileSync(contact, join(out, 'contact.png'));
7226
7236
  written.push('contact.png');
7227
7237
  }
@@ -7248,9 +7258,11 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
7248
7258
  loop = maxRgbDiff(kept.frames[0].image, keptLast.image);
7249
7259
  loopSet = kept;
7250
7260
  }
7251
- const idleImages = idle.frames.map((f) => f.image);
7252
- writePng(join(out, 'motion_heat.png'), motionHeat(idleImages));
7253
- written.push('motion_heat.png');
7261
+ if (!previewIdle) {
7262
+ const idleImages = idle.frames.map((f) => f.image);
7263
+ writePng(join(out, 'motion_heat.png'), motionHeat(idleImages));
7264
+ written.push('motion_heat.png');
7265
+ }
7254
7266
  }
7255
7267
 
7256
7268
  // 3a. every animation, the idle included, read for folds by rigc (issues #320, #333, #363) — only when there is one; at
@@ -7327,7 +7339,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
7327
7339
  level = levelLine(feet, inp.rig, levelReadings, fps, stripped.physics.length, levelProblems);
7328
7340
  }
7329
7341
  }
7330
- if (!noExtremes) extremesFrames = readJson(join(stripped === null ? foldDir : join(foldDir, 'on'), 'frames.json'), []);
7342
+ if (!omitExtremes) extremesFrames = readJson(join(stripped === null ? foldDir : join(foldDir, 'on'), 'frames.json'), []);
7331
7343
  } finally {
7332
7344
  rmSync(foldDir, { recursive: true, force: true });
7333
7345
  }
@@ -8019,13 +8031,14 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
8019
8031
  ...readings,
8020
8032
  PASS: problems.length === 0,
8021
8033
  };
8034
+ if (previewIdle) rmSync(idleDir, { recursive: true, force: true });
8022
8035
  const publishCheck = (): void => {
8023
8036
  publishMotionSeamCells(out, motionSeam.required, motionCellEvidence, () => write('check.json', serializeCheckRows(figures)));
8024
8037
  if (motionSeam.required?.cells !== undefined) written.push(MOTION_CELLS_FILE);
8025
8038
  };
8026
8039
  if (motionSeam.worlds === undefined) publishCheck();
8027
8040
  else publishMotionSeamWorlds(out, seamMotionDir, motionSeam.worlds, publishCheck);
8028
- const extremes = noExtremes ? [] : renderExtremes(buildDir, out, animationNames, idle === null ? extremesFrames : readJson(join(idleDir, 'frames.json'), []), extremesFrames, measured);
8041
+ const extremes = omitExtremes ? [] : renderExtremes(buildDir, out, animationNames, idle === null ? extremesFrames : readJson(join(idleDir, 'frames.json'), []), extremesFrames, measured);
8029
8042
  if (existsSync(join(out, 'extremes'))) written.push('extremes/');
8030
8043
  const bars: CheckReport['bars'] = { measured: ['gate'], skipped: [] };
8031
8044
  const tally = (bar: string, reason: string | null): void => {
@@ -8081,6 +8094,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
8081
8094
  ...(windBandRead === null ? {} : { windBand: windBandRead }),
8082
8095
  };
8083
8096
  } finally {
8097
+ if (previewIdle) rmSync(idleDir, { recursive: true, force: true });
8084
8098
  rmSync(seamMotionDir, { recursive: true, force: true });
8085
8099
  }
8086
8100
  }
package/src/runstamp.ts CHANGED
@@ -36,7 +36,7 @@ export interface RunStampFileEntry {
36
36
  sha256: string;
37
37
  }
38
38
 
39
- /** Compose's consumed inputs and opted-in placement, captured before its gate. */
39
+ /** Compose's consumed inputs and placement, with the output profile recorded on success. */
40
40
  export interface ComposeRun {
41
41
  spec: typeof COMPOSE_RUN_SPEC;
42
42
  scene: RunStampFileEntry;
@@ -52,6 +52,7 @@ export interface ComposeRun {
52
52
  }>;
53
53
  plate: RunStampFileEntry | null;
54
54
  plates: Array<{ name: string; path: string; sha256: string }>;
55
+ output_profile?: 'preview' | 'no-extremes';
55
56
  }
56
57
 
57
58
  export interface RunStampInputEntry<Role extends string = RunStampInputRole> {