rig-parts 2.61.0 → 2.63.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 +54 -9
- package/docs/AUTHORING.md +212 -80
- package/docs/STABILITY.md +42 -9
- package/package.json +2 -2
- package/src/build.ts +29 -7
- package/src/check.ts +182 -27
- package/src/scene.ts +416 -12
- package/src/sceneclips.ts +300 -4
package/src/check.ts
CHANGED
|
@@ -229,6 +229,42 @@ export const IDLE_MAX_PX = 640;
|
|
|
229
229
|
const STILL_DURATION = 0.1;
|
|
230
230
|
const STILL_FPS = 10;
|
|
231
231
|
|
|
232
|
+
/** The caller's RGBA seam bar and maximum number of warm-up loops. */
|
|
233
|
+
export type LoopSeamRequest = { channelDelta: number; pixelsAbove: number; cap: number };
|
|
234
|
+
|
|
235
|
+
const LOOP_SEAM_SPEC = 'rigc-loop-seam/1';
|
|
236
|
+
export const LOOP_SEAM_BAR_UNMET = 'LOOP_SEAM_BAR_UNMET';
|
|
237
|
+
const LOOP_SEAM_FILE = 'loop-seam.json';
|
|
238
|
+
const LOOP_WRAP_FILE = 'loop-wrap.png';
|
|
239
|
+
|
|
240
|
+
interface LoopSeamPixels {
|
|
241
|
+
differingPixels: number;
|
|
242
|
+
maxChannelDelta: number;
|
|
243
|
+
pixelsAbove: number;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
interface LoopSeamEndpoint {
|
|
247
|
+
time: number;
|
|
248
|
+
path: string;
|
|
249
|
+
sha256: string;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** Core's met report for the shipped idle take, preserved as read. */
|
|
253
|
+
export interface LoopSeamReport extends LoopSeamPixels {
|
|
254
|
+
spec: typeof LOOP_SEAM_SPEC;
|
|
255
|
+
animation: 'idle';
|
|
256
|
+
period: number;
|
|
257
|
+
fps: number;
|
|
258
|
+
viewport: Viewport;
|
|
259
|
+
status: 'met';
|
|
260
|
+
warmup: number;
|
|
261
|
+
bar: Pick<LoopSeamRequest, 'channelDelta' | 'pixelsAbove'>;
|
|
262
|
+
cap: number;
|
|
263
|
+
first: LoopSeamEndpoint & { time: 0 };
|
|
264
|
+
wrap: LoopSeamEndpoint & { encoding: 'png' };
|
|
265
|
+
series: Array<LoopSeamPixels & { warmup: number }>;
|
|
266
|
+
}
|
|
267
|
+
|
|
232
268
|
/**
|
|
233
269
|
* The judgement lines' bars (issue #11). Each is derived from the two public
|
|
234
270
|
* examples by one stated rule, and AUTHORING §7 quotes what each example
|
|
@@ -1192,6 +1228,91 @@ export function readFrameSet(path: string): FrameSet {
|
|
|
1192
1228
|
};
|
|
1193
1229
|
}
|
|
1194
1230
|
|
|
1231
|
+
function readLoopSeamSidecar(path: string): Record<string, unknown> {
|
|
1232
|
+
let raw: unknown;
|
|
1233
|
+
try {
|
|
1234
|
+
raw = JSON.parse(readFileSync(path, 'utf8'));
|
|
1235
|
+
} catch (err) {
|
|
1236
|
+
return sidecarProblem(path, `cannot read the JSON sidecar: ${(err as Error).message}`);
|
|
1237
|
+
}
|
|
1238
|
+
return isRecord(raw) ? raw : sidecarProblem(path, 'a JSON object is required');
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
/** Bind Core's report to the retained take before any bar can use it. */
|
|
1242
|
+
function readLoopSeam(root: string, duration: number, request: LoopSeamRequest): { frames: FrameSet; report: LoopSeamReport } {
|
|
1243
|
+
const frameIndexPath = join(root, 'frames.json');
|
|
1244
|
+
const frameIndex = readLoopSeamSidecar(frameIndexPath);
|
|
1245
|
+
const set: unknown = Array.isArray(frameIndex.sets) && frameIndex.sets.length === 1 ? frameIndex.sets[0] : undefined;
|
|
1246
|
+
if (frameIndex.spec !== 'rigc-frames/1' || !isRecord(set) || typeof set.dir !== 'string' || unsafeSegmentReason(set.dir) !== null) {
|
|
1247
|
+
return sidecarProblem(frameIndexPath, 'the loop seam requires rigc-frames/1 with one set and a safe "dir" segment');
|
|
1248
|
+
}
|
|
1249
|
+
const frames = readFrameSet(root);
|
|
1250
|
+
const path = join(frames.dir, LOOP_SEAM_FILE);
|
|
1251
|
+
const report = readLoopSeamSidecar(path);
|
|
1252
|
+
const viewport = report.viewport;
|
|
1253
|
+
const period = report.period;
|
|
1254
|
+
if (report.spec !== LOOP_SEAM_SPEC || report.status !== 'met') {
|
|
1255
|
+
return sidecarProblem(path, `spec ${JSON.stringify(report.spec)}, status ${JSON.stringify(report.status)}; ${LOOP_SEAM_SPEC} with status "met" is required`);
|
|
1256
|
+
}
|
|
1257
|
+
if (report.animation !== 'idle' || frames.animation !== 'idle' || report.fps !== IDLE_FPS || frames.fps !== IDLE_FPS ||
|
|
1258
|
+
typeof period !== 'number' || !Number.isFinite(period) || period <= 0 ||
|
|
1259
|
+
Math.abs(period - duration) > TIME_SLACK || Math.abs(period - frames.duration) > TIME_SLACK) {
|
|
1260
|
+
return sidecarProblem(path,
|
|
1261
|
+
`report animation ${JSON.stringify(report.animation)}, fps ${JSON.stringify(report.fps)}, period ${JSON.stringify(period)}; ` +
|
|
1262
|
+
`frames.json animation ${JSON.stringify(frames.animation)}, fps ${frames.fps}, duration ${frames.duration}s; ` +
|
|
1263
|
+
`both must name idle at ${IDLE_FPS} fps and agree with the declared idle duration ${duration}s (within ${TIME_SLACK}s)`);
|
|
1264
|
+
}
|
|
1265
|
+
if (!isRecord(viewport) || (Object.keys(frames.viewport) as Array<keyof Viewport>).some(key => viewport[key] !== frames.viewport[key])) {
|
|
1266
|
+
return sidecarProblem(path, `viewport ${JSON.stringify(viewport)} must match frames.json viewport ${JSON.stringify(frames.viewport)}`);
|
|
1267
|
+
}
|
|
1268
|
+
const bar = report.bar;
|
|
1269
|
+
const { channelDelta, pixelsAbove, cap } = request;
|
|
1270
|
+
if (!isRecord(bar) || bar.channelDelta !== channelDelta || bar.pixelsAbove !== pixelsAbove || report.cap !== cap) {
|
|
1271
|
+
return sidecarProblem(path, `bar ${JSON.stringify(bar)}, cap ${JSON.stringify(report.cap)}; the requested bar is ${channelDelta},${pixelsAbove} with cap ${cap}`);
|
|
1272
|
+
}
|
|
1273
|
+
const whole = (n: unknown, max: number): n is number => typeof n === 'number' && Number.isSafeInteger(n) && n >= 0 && n <= max;
|
|
1274
|
+
const warmup = report.warmup;
|
|
1275
|
+
if (!whole(warmup, cap) || set.preroll !== (warmup === 0 ? undefined : warmup)) {
|
|
1276
|
+
return sidecarProblem(path, `warmup ${JSON.stringify(warmup)} must be within 0..${cap} and match frames.json preroll ${JSON.stringify(set.preroll)} (absent at zero)`);
|
|
1277
|
+
}
|
|
1278
|
+
const total = frames.viewport.pixelWidth * frames.viewport.pixelHeight;
|
|
1279
|
+
const pixelFigures = (row: unknown): row is Record<string, unknown> & LoopSeamPixels =>
|
|
1280
|
+
isRecord(row) && whole(row.differingPixels, total) && whole(row.maxChannelDelta, 255) &&
|
|
1281
|
+
whole(row.pixelsAbove, row.differingPixels) && (row.maxChannelDelta > 0) === (row.differingPixels > 0) &&
|
|
1282
|
+
(row.maxChannelDelta > channelDelta) === (row.pixelsAbove > 0);
|
|
1283
|
+
const series = report.series;
|
|
1284
|
+
if (!Array.isArray(series) || series.length !== warmup + 1 ||
|
|
1285
|
+
!series.every((row: unknown, index) => pixelFigures(row) && row.warmup === index && (row.pixelsAbove <= pixelsAbove) === (index === warmup))) {
|
|
1286
|
+
return sidecarProblem(path, `series must record each warm-up from 0 through ${warmup}, with the selected take the first to meet ${pixelsAbove} px over ${channelDelta}`);
|
|
1287
|
+
}
|
|
1288
|
+
const selected: unknown = series[warmup];
|
|
1289
|
+
if (!pixelFigures(report) || !pixelFigures(selected) || report.differingPixels !== selected.differingPixels ||
|
|
1290
|
+
report.maxChannelDelta !== selected.maxChannelDelta || report.pixelsAbove !== selected.pixelsAbove) {
|
|
1291
|
+
return sidecarProblem(path, `pixel figures must match the selected series entry at warm-up ${warmup}`);
|
|
1292
|
+
}
|
|
1293
|
+
if (frames.frames[0]?.name !== 'f0000.png') {
|
|
1294
|
+
return sidecarProblem(frameIndexPath, `the shipped idle starts at ${JSON.stringify(frames.frames[0]?.name)}; f0000.png is required`);
|
|
1295
|
+
}
|
|
1296
|
+
for (const [label, name, time] of [['first', 'f0000.png', 0], ['wrap', LOOP_WRAP_FILE, period]] as const) {
|
|
1297
|
+
const endpoint = report[label];
|
|
1298
|
+
const relativePath = `${set.dir}/${name}`;
|
|
1299
|
+
if (!isRecord(endpoint) || endpoint.path !== relativePath || endpoint.time !== time || (label === 'wrap' && endpoint.encoding !== 'png')) {
|
|
1300
|
+
return sidecarProblem(path, `${label} endpoint ${JSON.stringify(endpoint)} must name ${relativePath} at t = ${time}s${label === 'wrap' ? ' with png encoding' : ''}`);
|
|
1301
|
+
}
|
|
1302
|
+
let bytes: Buffer;
|
|
1303
|
+
try {
|
|
1304
|
+
bytes = readFileSync(join(frames.dir, name));
|
|
1305
|
+
} catch (err) {
|
|
1306
|
+
return sidecarProblem(path, `cannot read the ${label} endpoint ${relativePath}: ${(err as Error).message}`);
|
|
1307
|
+
}
|
|
1308
|
+
const sha256 = createHash('sha256').update(bytes).digest('hex');
|
|
1309
|
+
if (endpoint.sha256 !== sha256) {
|
|
1310
|
+
return sidecarProblem(path, `${label} endpoint ${relativePath} has SHA-256 ${sha256}; the report names ${JSON.stringify(endpoint.sha256)}`);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
return { frames, report: report as unknown as LoopSeamReport };
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1195
1316
|
// ---------------------------------------------------------------------------
|
|
1196
1317
|
// the keyed loop: physics left out (issue #183)
|
|
1197
1318
|
// ---------------------------------------------------------------------------
|
|
@@ -2817,14 +2938,16 @@ export interface CheckFigures {
|
|
|
2817
2938
|
* off them ({@link readCheckEnvironment}). Provenance, not a bar; without the flag no key is written.
|
|
2818
2939
|
*/
|
|
2819
2940
|
environment?: CheckEnvironment;
|
|
2820
|
-
/** Null when the rig has no idle (issue #77)
|
|
2941
|
+
/** The keyed RGB reading, with physics left out where declared. Null when the rig has no idle (issue #77). */
|
|
2821
2942
|
loop_max_diff: number | null;
|
|
2822
2943
|
/**
|
|
2823
2944
|
* Written only when the rig declares a physics constraint (issue #183):
|
|
2824
|
-
* each one {@link withoutPhysics} left out of the frames `loop_max_diff` was
|
|
2825
|
-
* read from.
|
|
2945
|
+
* each one {@link withoutPhysics} left out of the physics-off frames `loop_max_diff` was
|
|
2946
|
+
* read from. With a closed keyed loop and no declared seam bar, the loop outcome is `SKIP` (`physics-omitted`).
|
|
2826
2947
|
*/
|
|
2827
2948
|
loop_physics?: LoopPhysics[];
|
|
2949
|
+
/** Core's met RGBA wrap-seam report for the shipped idle when a loop seam bar was declared (issue #1590). */
|
|
2950
|
+
loop_seam?: LoopSeamReport;
|
|
2828
2951
|
/** The seam figures: null when there is no parts.json (issue #77); `skipped.seam` then says why. The two counts are frame pixels. */
|
|
2829
2952
|
seam_mean: number | null;
|
|
2830
2953
|
seam_px_over_40: number | null;
|
|
@@ -2882,11 +3005,10 @@ export interface CheckFigures {
|
|
|
2882
3005
|
/** Written only under `--wind-band` (issue #590): the steady-wind band each declared seam pair holds, REPORTED. */
|
|
2883
3006
|
[WIND_BAND_LINE]?: WindBandLine;
|
|
2884
3007
|
/**
|
|
2885
|
-
* Written only when the loop or the seam
|
|
2886
|
-
* reason for each, by the name its console line goes by
|
|
2887
|
-
* reported lines carry their own SKIP; these two bars have
|
|
2888
|
-
* status, so their reasons sit here, and a run that measured both writes
|
|
2889
|
-
* the keys it always wrote.
|
|
3008
|
+
* Written only when the loop or the seam did not measure the shipped frames (issues #77, #1590): the
|
|
3009
|
+
* reason for each, by the name its console line goes by (including when `loop_physics` omitted physics constraints
|
|
3010
|
+
* and the physics-off loop closed). The judgement and reported lines carry their own SKIP; these two bars have
|
|
3011
|
+
* figures, not a status, so their reasons sit here, and a run that measured both writes the keys it always wrote.
|
|
2890
3012
|
*/
|
|
2891
3013
|
skipped?: { loop?: string; seam?: string };
|
|
2892
3014
|
/** Written only under `--set` or `--all-sets` (issue #454): each checked alternate set's setup-pose seam and recomposite figures, keyed by set name. */
|
|
@@ -3149,7 +3271,7 @@ export interface CheckBarSkipReasons {
|
|
|
3149
3271
|
}
|
|
3150
3272
|
|
|
3151
3273
|
export type CheckBarSkipReason = NonNullable<CheckBarSkipReasons[keyof CheckBarSkipReasons]>
|
|
3152
|
-
| 'no-idle' | 'no-parts' | 'no-comparable-tracks' | 'no-animation' | 'no-hanging-footwear' | 'no-posed-footwear'
|
|
3274
|
+
| 'no-idle' | 'physics-omitted' | 'no-parts' | 'no-comparable-tracks' | 'no-animation' | 'no-hanging-footwear' | 'no-posed-footwear'
|
|
3153
3275
|
| 'no-handwear' | 'no-readable-binding' | 'no-limb-segments' | 'no-joint-range' | 'undeclared' | 'no-limit'
|
|
3154
3276
|
| 'no-complete-threshold-reading' | 'no-root-gate' | 'no-complete-root-reading';
|
|
3155
3277
|
|
|
@@ -3171,8 +3293,15 @@ function checkBarStatus(fig: Readonly<Record<string, unknown>>, id: CheckBarId):
|
|
|
3171
3293
|
switch (id) {
|
|
3172
3294
|
case 'gate':
|
|
3173
3295
|
return fig.gate_spine_html_green === true ? 'PASS' : 'FAIL';
|
|
3174
|
-
case 'loop':
|
|
3175
|
-
|
|
3296
|
+
case 'loop': {
|
|
3297
|
+
const seam = fig.loop_seam;
|
|
3298
|
+
if (seam !== undefined) {
|
|
3299
|
+
return fig.loop_max_diff === LOOP_MAX_BAR && isRecord(seam) && seam.spec === LOOP_SEAM_SPEC && seam.status === 'met' ? 'PASS' : 'FAIL';
|
|
3300
|
+
}
|
|
3301
|
+
if (typeof fig.loop_max_diff !== 'number') return 'SKIP';
|
|
3302
|
+
if (fig.loop_max_diff !== LOOP_MAX_BAR) return 'FAIL';
|
|
3303
|
+
return Array.isArray(fig.loop_physics) && fig.loop_physics.length > 0 ? 'SKIP' : 'PASS';
|
|
3304
|
+
}
|
|
3176
3305
|
case 'seam':
|
|
3177
3306
|
if (seamFigureFailed(fig) || (isRecord(fig.sets) && Object.values(fig.sets).some(s => isRecord(s) && seamFigureFailed(s)))) return 'FAIL';
|
|
3178
3307
|
return typeof fig.seam_mean === 'number' ? 'PASS' : 'SKIP';
|
|
@@ -3196,7 +3325,7 @@ function checkBarSkipReason(fig: Readonly<Record<string, unknown>>, id: Exclude<
|
|
|
3196
3325
|
const hasParts = typeof fig.seam_mean === 'number';
|
|
3197
3326
|
const hasAnimation = fig[FOLD_LINE] !== undefined;
|
|
3198
3327
|
switch (id) {
|
|
3199
|
-
case 'loop': return 'no-idle';
|
|
3328
|
+
case 'loop': return hasIdle ? 'physics-omitted' : 'no-idle';
|
|
3200
3329
|
case 'seam': return 'no-parts';
|
|
3201
3330
|
case 'BREATH_VISIBLE':
|
|
3202
3331
|
case 'BLINK_NO_HOLE':
|
|
@@ -3248,7 +3377,7 @@ export function checkBarOutcomes(fig: Readonly<Record<string, unknown>>, skipRea
|
|
|
3248
3377
|
/**
|
|
3249
3378
|
* The bars a `check.json`, as `check` writes it, says were not met, in
|
|
3250
3379
|
* {@link BARS} order: the gate when `gate_spine_html_green` is not true, the
|
|
3251
|
-
* loop when
|
|
3380
|
+
* loop when its keyed reading fails or its seam evidence has no met verdict, the
|
|
3252
3381
|
* seam when its figures fail {@link seamFails}, and each judgement line whose
|
|
3253
3382
|
* status is `FAIL`, then {@link FOLD_LINE} when it is written and `FAIL`
|
|
3254
3383
|
* (issue #320), then {@link LEVEL_LINE} the same way (issue #348), then {@link STRESS_LINE} likewise (issue #347), then
|
|
@@ -3356,8 +3485,9 @@ export type CheckStatus = 'PASS' | 'FAIL' | 'SKIP' | 'WARN' | 'CLEAR' | 'REPORTE
|
|
|
3356
3485
|
/**
|
|
3357
3486
|
* Every block's status as `check.json` records it (issue #541), read off the figures object `check.json` is written
|
|
3358
3487
|
* from, in the file's order, one entry per block the file holds. The three bars with figures and no `status` key are
|
|
3359
|
-
* read the way {@link
|
|
3360
|
-
* never skipped); `loop`
|
|
3488
|
+
* read the way {@link checkBarStatus} reads the file: `gate` PASS when `gate_spine_html_green` is true, else FAIL (it is
|
|
3489
|
+
* never skipped); `loop` reads the keyed result and any declared seam verdict, and skips a closed physics-off
|
|
3490
|
+
* loop without seam evidence or a rig with no idle (issue #1590). `seam` SKIP when `seam_mean` is null and no set failed, otherwise FAIL when
|
|
3361
3491
|
* {@link barsNotMet} names it and PASS when it does not. Every other block carries its own `status` key and is copied:
|
|
3362
3492
|
* the judgement lines, then {@link FOLD_LINE}, {@link LEVEL_LINE}, {@link STRESS_LINE}, {@link LIMB_LINE},
|
|
3363
3493
|
* {@link SWEEP_LINE}, {@link MOTION_SEAM_LINE}, {@link CLOTH_LINE}, {@link PHYSICS_CONTRIBUTES_LINE}, the reported lines, {@link SOURCE_LINE} and
|
|
@@ -3365,8 +3495,7 @@ export type CheckStatus = 'PASS' | 'FAIL' | 'SKIP' | 'WARN' | 'CLEAR' | 'REPORTE
|
|
|
3365
3495
|
*/
|
|
3366
3496
|
export function checkStatuses(fig: Omit<CheckFigures, 'spec' | 'bar_outcomes' | 'build'>): Record<string, CheckStatus> {
|
|
3367
3497
|
const raw = fig as unknown as Record<string, unknown>;
|
|
3368
|
-
const
|
|
3369
|
-
const out: Record<string, CheckStatus> = { gate: bar('gate', true), loop: bar('loop', fig.loop_max_diff !== null), seam: bar('seam', fig.seam_mean !== null) };
|
|
3498
|
+
const out: Record<string, CheckStatus> = { gate: checkBarStatus(raw, 'gate'), loop: checkBarStatus(raw, 'loop'), seam: checkBarStatus(raw, 'seam') };
|
|
3370
3499
|
for (const n of JUDGEMENT_LINES) out[n] = fig[n].status;
|
|
3371
3500
|
for (const n of [FOLD_LINE, LEVEL_LINE, STRESS_LINE, LIMB_LINE, SWEEP_LINE, MOTION_SEAM_LINE, CLOTH_LINE, PHYSICS_CONTRIBUTES_LINE, ...REPORTED_LINES, 'figure_openings', SOURCE_LINE, WIND_BAND_LINE, ART_JOINT_LINE, CUT_MATERIAL_LINE, SETUP_PAINTING_LINE, BOUNDARY_COLOUR_LINE, BEHIND_SEAM_LINE, SOURCE_EXPOSURE_LINE, COINCIDE_LINE] as const) {
|
|
3372
3501
|
const l = fig[n];
|
|
@@ -5574,8 +5703,8 @@ export function motionSeamLine(pairs: MotionSeamPair[], animations: string[], fp
|
|
|
5574
5703
|
...(rootReasons.length === 0 && reason === undefined ? {} : { reason: unmeasured.length === 0 ? (reason ?? missing.join('; ')) : [reason, ...rootReasons].filter(r => r !== undefined).join('; ') }),
|
|
5575
5704
|
...(unmeasured.length === 0 ? {} : { unmeasured }),
|
|
5576
5705
|
};
|
|
5577
|
-
const read = rows.some((r) => r.status === 'read');
|
|
5578
|
-
const
|
|
5706
|
+
const read = rows.some((r) => r.status === 'read' && r.banded > 0);
|
|
5707
|
+
const legacySkipWhy =
|
|
5579
5708
|
reason ??
|
|
5580
5709
|
(pairs.length === 0 && unmeasured.length > 0 ? rootGate?.reason : undefined) ??
|
|
5581
5710
|
(read
|
|
@@ -5583,9 +5712,13 @@ export function motionSeamLine(pairs: MotionSeamPair[], animations: string[], fp
|
|
|
5583
5712
|
: pairs.every((p) => p.unread !== undefined)
|
|
5584
5713
|
? `no declared pair is read: ${pairs.map((p) => `"${p.pair}" ${String(p.unread)}`).join('; ')}`
|
|
5585
5714
|
: `rigc read no band on any frame of any declared pair in any animation — nothing measured, which is not a seam that held`);
|
|
5715
|
+
// The renderer reader requires one row per animation for every pair with both slots available.
|
|
5716
|
+
const partial = pairs.some(p => p.unread !== undefined) || rows.some(r => r.status === 'skip' || r.banded <= 0);
|
|
5717
|
+
const status = rootGate?.status === 'FAIL' ? 'FAIL'
|
|
5718
|
+
: legacySkipWhy !== undefined ? 'SKIP' : warnings > 0 ? 'WARN' : partial ? 'SKIP' : 'CLEAR';
|
|
5586
5719
|
return {
|
|
5587
|
-
status
|
|
5588
|
-
...(
|
|
5720
|
+
status,
|
|
5721
|
+
...(status === 'SKIP' ? { reason: legacySkipWhy ?? 'one or more declared pair/animation readings are unmeasured' } : {}),
|
|
5589
5722
|
fps,
|
|
5590
5723
|
floor: MOTION_SEAM_FLOOR,
|
|
5591
5724
|
pairs: pairs.map(p => ({ ...p, ...checkRow('SEAM_OVER_MOTION.pairs', 'pair', false, [p.a, p.b]) })),
|
|
@@ -6832,7 +6965,9 @@ function renderExtremes(build: string, out: string, animations: readonly string[
|
|
|
6832
6965
|
* judgement lines that choose regions by tag and `RECOMPOSITE_HOLES` say SKIP
|
|
6833
6966
|
* with the reason; without an `idle` the loop and every line that reads idle
|
|
6834
6967
|
* frames say SKIP, and no idle is rendered (no `idle_frames/`, `contact.png`
|
|
6835
|
-
* or `motion_heat.png`). `
|
|
6968
|
+
* or `motion_heat.png`). A declared `loopSeam` requires a positive idle and
|
|
6969
|
+
* binds Core's met wrap-seam report to the shipped render. The keyed reading
|
|
6970
|
+
* still runs. `source` (`--source`) adds {@link SOURCE_LINE}.
|
|
6836
6971
|
*
|
|
6837
6972
|
* `requirements` (`--requirements`, issue #93) is read with the rig directory
|
|
6838
6973
|
* and resolved against it before anything is built ({@link readRequirements},
|
|
@@ -6842,7 +6977,9 @@ function renderExtremes(build: string, out: string, animations: readonly string[
|
|
|
6842
6977
|
* MEASURABLE is a problem. Without it nothing here reads, writes or prints
|
|
6843
6978
|
* anything it did not before.
|
|
6844
6979
|
*/
|
|
6845
|
-
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): CheckReport {
|
|
6980
|
+
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 {
|
|
6981
|
+
const out = resolve(outDir);
|
|
6982
|
+
if (loopSeam !== undefined) rmSync(join(out, 'check.json'), { force: true });
|
|
6846
6983
|
const pageSize = parsePageSize(mode.pageSize);
|
|
6847
6984
|
let inp: CheckInputs;
|
|
6848
6985
|
let reqFile: RequirementsFile | null = null;
|
|
@@ -6861,6 +6998,9 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6861
6998
|
};
|
|
6862
6999
|
const readInputs = (): CheckInputs => {
|
|
6863
7000
|
const inputs = readCheckInputs(rigDir, partsHome, source, set, allSets);
|
|
7001
|
+
if (loopSeam !== undefined && inputs.idleDuration === null) {
|
|
7002
|
+
throw new PartsError([{ code: 'CHECK_IDLE_PRESENT', object: `${inputs.motionPath} animation "idle"`, detail: `--loop-seam-bar requires an idle with positive duration; ${inputs.noIdle}` }]);
|
|
7003
|
+
}
|
|
6864
7004
|
if (config !== undefined && inputs.parts !== null) refuseStaleAssembly(config.path, inputs.parts, undefined, assemblyRules);
|
|
6865
7005
|
return inputs;
|
|
6866
7006
|
};
|
|
@@ -6947,7 +7087,6 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6947
7087
|
}
|
|
6948
7088
|
return call;
|
|
6949
7089
|
};
|
|
6950
|
-
const out = resolve(outDir);
|
|
6951
7090
|
const outExisted = existsSync(out);
|
|
6952
7091
|
mkdirSync(out, { recursive: true });
|
|
6953
7092
|
const buildDir = join(out, 'build'), buildReportPath = join(out, BUILD_REPORT_FILE);
|
|
@@ -6998,6 +7137,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6998
7137
|
let loop: { max: number; x: number; y: number } | null = null;
|
|
6999
7138
|
let loopSet: FrameSet | null = null;
|
|
7000
7139
|
let loopPhysics: LoopPhysics[] | null = null;
|
|
7140
|
+
let loopSeamEvidence: LoopSeamReport | null = null;
|
|
7001
7141
|
// The keyed build (issues #183, #320): with a physics constraint, the same rig and motion with every one left out,
|
|
7002
7142
|
// built once the same way for the loop and the physics-off reading of the remaining animations.
|
|
7003
7143
|
const stripped = withoutPhysics(inp.rig, inp.motion);
|
|
@@ -7053,9 +7193,18 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7053
7193
|
const levelProblems: Problem[] = [];
|
|
7054
7194
|
try {
|
|
7055
7195
|
if (inp.idleDuration !== null) {
|
|
7056
|
-
const
|
|
7057
|
-
|
|
7058
|
-
|
|
7196
|
+
const seamArgs = loopSeam === undefined ? [] :
|
|
7197
|
+
['--loop-seam-bar', `${loopSeam.channelDelta},${loopSeam.pixelsAbove}`, '--loop-seam-cap', String(loopSeam.cap)];
|
|
7198
|
+
const render = measured(['render', '--candidate', buildDir, '--animation', 'idle', '--fps', String(IDLE_FPS), '--max', String(IDLE_MAX_PX), '--geometry', '--out', idleDir, ...seamArgs]);
|
|
7199
|
+
if (render.status !== 0) {
|
|
7200
|
+
if (loopSeam !== undefined) {
|
|
7201
|
+
const unmet = render.out.split(/\r?\n/).map(line => line.replace(/^rigc: /, '')).find(line => line.startsWith(`${LOOP_SEAM_BAR_UNMET}:`));
|
|
7202
|
+
if (unmet !== undefined) throw new PartsError([{ code: LOOP_SEAM_BAR_UNMET, object: 'idle', detail: ` loop: FAIL — ${unmet}` }]);
|
|
7203
|
+
}
|
|
7204
|
+
refuseIfAny(rigcFailed('render --animation idle --geometry', render, render.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
|
|
7205
|
+
}
|
|
7206
|
+
const checked = loopSeam === undefined ? null : readLoopSeam(idleDir, inp.idleDuration, loopSeam);
|
|
7207
|
+
idle = checked?.frames ?? readFrameSet(idleDir);
|
|
7059
7208
|
const last = idle.frames[idle.frames.length - 1];
|
|
7060
7209
|
// Issue #244: the last frame's time and the duration are compared within TIME_SLACK, not with `!==` — a whole
|
|
7061
7210
|
// number of frames (40/12 s) is not exact in binary, and rigc writes its last frame at 40 * (1/12), one ulp off.
|
|
@@ -7068,6 +7217,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7068
7217
|
},
|
|
7069
7218
|
]);
|
|
7070
7219
|
}
|
|
7220
|
+
loopSeamEvidence = checked?.report ?? null;
|
|
7071
7221
|
const contact = join(idle.dir, 'contact.png');
|
|
7072
7222
|
if (existsSync(contact)) {
|
|
7073
7223
|
copyFileSync(contact, join(out, 'contact.png'));
|
|
@@ -7182,6 +7332,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7182
7332
|
}
|
|
7183
7333
|
} finally {
|
|
7184
7334
|
rmSync(loopDir, { recursive: true, force: true });
|
|
7335
|
+
if (loopSeam !== undefined && loopSeamEvidence === null) rmSync(idleDir, { recursive: true, force: true });
|
|
7185
7336
|
}
|
|
7186
7337
|
|
|
7187
7338
|
// 3b. the parts a judgement reads alone: each rendered by its own slots, on the whole rig's grid
|
|
@@ -7768,6 +7919,9 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7768
7919
|
|
|
7769
7920
|
const skipped: { loop?: string; seam?: string } = {};
|
|
7770
7921
|
if (inp.noIdle !== null) skipped.loop = inp.noIdle;
|
|
7922
|
+
else if (loopSeamEvidence === null && loop !== null && loop.max === LOOP_MAX_BAR && loopPhysics !== null && loopPhysics.length > 0) {
|
|
7923
|
+
skipped.loop = `physics-on idle frames not measured; ${loopPhysics.length} physics constraint(s) omitted`;
|
|
7924
|
+
}
|
|
7771
7925
|
if (inp.noParts !== null) skipped.seam = inp.noParts;
|
|
7772
7926
|
const recordedEnv: CheckEnvironment | null = env === null ? null : { ...env, path: argvPathFromOut(env.path, outDir, process.cwd()) };
|
|
7773
7927
|
const readings: Omit<CheckFigures, 'spec' | 'bar_outcomes' | 'build' | 'PASS'> = {
|
|
@@ -7777,6 +7931,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7777
7931
|
...(recordedEnv === null ? {} : { environment: recordedEnv }),
|
|
7778
7932
|
loop_max_diff: loop === null ? null : loop.max,
|
|
7779
7933
|
...(loopPhysics === null ? {} : { loop_physics: loopPhysics.map(row => ({ ...row, ...checkRow('loop_physics', 'rig', false, []) })) }),
|
|
7934
|
+
...(loopSeamEvidence === null ? {} : { loop_seam: loopSeamEvidence }),
|
|
7780
7935
|
seam_mean: seam === null ? null : round3(seam.mean),
|
|
7781
7936
|
seam_px_over_40: seam === null ? null : seam.over40,
|
|
7782
7937
|
seam_px_over_80: seam === null ? null : seam.over80,
|