@rig-c/parts 2.43.0 → 2.45.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/README.md +2 -0
- package/cli.ts +141 -36
- package/docs/AUTHORING.md +541 -70
- package/docs/DEPTH.md +44 -3
- package/docs/MIGRATION.md +2 -0
- package/docs/STABILITY.md +357 -39
- package/package.json +1 -1
- package/src/boundarydepth.ts +113 -0
- package/src/check.ts +296 -78
- package/src/cloth.ts +14 -3
- package/src/config.ts +78 -11
- package/src/configwrite.ts +3 -3
- package/src/diffdrafts.ts +593 -0
- package/src/editedparts.ts +11 -2
- package/src/externalreceipt.ts +130 -0
- package/src/maskvalues.ts +21 -0
- package/src/outputpaths.ts +40 -0
- package/src/parts.ts +14 -5
- package/src/plate.ts +2 -6
- package/src/propose.ts +165 -8
- package/src/receiptproducer.ts +41 -0
- package/src/remesh-api.ts +33 -0
- package/src/remesh.ts +197 -19
- package/src/remeshdelta.ts +143 -30
- package/src/rig.ts +95 -21
- package/src/runstamp.ts +16 -0
- package/src/scene.ts +440 -54
- package/src/sceneclips.ts +198 -0
- package/src/turn.ts +24 -3
- package/tools/edited-part-cli.ts +12 -3
package/src/check.ts
CHANGED
|
@@ -47,9 +47,9 @@ import { baseAnchorMoves, type AnchorRegion } from './baseanchor.ts';
|
|
|
47
47
|
* | `idle_frames/` | `rigc render --animation idle --fps 12 --max 640 --geometry`: `frames.json` + `idle/f*.png` + `idle/geometry.json` (each mesh's skinned vertices, which `TEXTURE_STRETCH` reads, every attachment's posed triangles, which `TIP_OVER_ROOT` and both halves of `STILL_REGIONS_DARK` read since issues #118 and #123, and every bone's world transform, which the face half reads its head bone from) |
|
|
48
48
|
* | `contact.png` | rigc's own contact sheet of that render, copied out |
|
|
49
49
|
* | `motion_heat.png` | frame 0 in grey with each pixel's largest change across the idle in red |
|
|
50
|
-
* | `extremes/<
|
|
50
|
+
* | `extremes/<segment>/extremes.png`, `extremes.json` | core min/max/diff observations at 12 fps, scale 1; static geometry writes a named SKIP and JSON only; `--no-extremes` removes stale diagnostics and runs no extra render |
|
|
51
51
|
* | `check.json` | the figures below and `PASS` |
|
|
52
|
-
* | `requirements/` | under `--requirements` only (issue #93): `as-declared/<animation>/`, and per follow `released/<name>/` and `full/<name>/` — rigc renders with `--geometry` ({@link measureRequirements}) |
|
|
52
|
+
* | `requirements/` | under `--requirements` only (issue #93): `as-declared/<animation-segment>/`, and per follow `released/<name-segment>/` and `full/<name-segment>/` — rigc renders with `--geometry` ({@link measureRequirements}) |
|
|
53
53
|
*
|
|
54
54
|
* The acceptance bars are the reference implementation's (`check_rig.py`):
|
|
55
55
|
* both gate summaries `0 failed`; seam mean |d| <= 1.0 of 255 and at most 50
|
|
@@ -96,6 +96,7 @@ import { createRequire } from 'node:module';
|
|
|
96
96
|
import type { Candidate, Piece, Viewport as RootCoverageViewport } from '@rig-c/core/render-shared';
|
|
97
97
|
import { fillHoles } from './raster/morph.ts';
|
|
98
98
|
import { copyFileSync, cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
99
|
+
import { diagnosticSegment, diagnosticSiblings } from './outputpaths.ts';
|
|
99
100
|
import { basename, delimiter, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
100
101
|
import { measureRecomposite, type RecompositeFigures, recompositeRecord, scenePhrase, sourceInRig, figureSilhouette } from './assemble.ts';
|
|
101
102
|
import { type BoneTransform, computeExactFrameTransforms, cropToSpineY, normaliseDegrees, toBoneLocal } from './coords.ts';
|
|
@@ -1062,6 +1063,44 @@ function sidecarProblem(object: string, detail: string): never {
|
|
|
1062
1063
|
throw new Error('unreachable');
|
|
1063
1064
|
}
|
|
1064
1065
|
|
|
1066
|
+
/** Read and validate a complete retained sibling scope without touching outputs. */
|
|
1067
|
+
function retainedCheckRenderPlan(source: string) {
|
|
1068
|
+
const index = join(source, 'frames.json');
|
|
1069
|
+
const bytes = readFileSync(index, 'utf8');
|
|
1070
|
+
const raw: unknown = JSON.parse(bytes);
|
|
1071
|
+
if (!isRecord(raw) || !Array.isArray(raw.sets)) return sidecarProblem(index, 'requires a frames.json sets array to retain a render');
|
|
1072
|
+
const seen = new Set<string>();
|
|
1073
|
+
const sourceDirs: string[] = [];
|
|
1074
|
+
const names: Array<{ name: string; suffix?: string }> = [];
|
|
1075
|
+
const sets = raw.sets.map((set: unknown) => {
|
|
1076
|
+
if (!isRecord(set) || typeof set.dir !== 'string' || set.dir.length === 0 || isAbsolute(set.dir) || set.dir.split(/[\\/]/).includes('..')) return sidecarProblem(index, 'requires local set directories to retain a render');
|
|
1077
|
+
// One render samples every set at the same rate. Preserve the rate suffix
|
|
1078
|
+
// on ordinary safe names, but never infer a public name from that suffix.
|
|
1079
|
+
const suffix = typeof set.fps === 'number' && set.fps !== IDLE_FPS ? `@${set.fps}fps` : '';
|
|
1080
|
+
const dir = typeof set.animation === 'string' ? diagnosticSegment(set.animation, suffix) : diagnosticSegment(set.dir);
|
|
1081
|
+
if (seen.has(dir)) return sidecarProblem(index, `retained set directory ${JSON.stringify(dir)} is repeated`);
|
|
1082
|
+
seen.add(dir);
|
|
1083
|
+
sourceDirs.push(set.dir);
|
|
1084
|
+
names.push(typeof set.animation === 'string' ? { name: set.animation, suffix } : { name: set.dir });
|
|
1085
|
+
return { ...set, dir };
|
|
1086
|
+
});
|
|
1087
|
+
diagnosticSiblings(names, 'retained render sets');
|
|
1088
|
+
return { bytes, raw, sets, sourceDirs };
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/** Copy a retained render and bind its index to portable set directories. */
|
|
1092
|
+
export function retainCheckRender(source: string, target: string): void {
|
|
1093
|
+
const { bytes, raw, sets, sourceDirs } = retainedCheckRenderPlan(source);
|
|
1094
|
+
mkdirSync(target, { recursive: true });
|
|
1095
|
+
// Root sidecars and set-local filenames are fixed renderer protocol names.
|
|
1096
|
+
for (const entry of readdirSync(source, { withFileTypes: true })) {
|
|
1097
|
+
if (entry.isFile() && entry.name !== 'frames.json') copyFileSync(join(source, entry.name), join(target, entry.name));
|
|
1098
|
+
}
|
|
1099
|
+
sourceDirs.forEach((dir, i) => cpSync(join(source, dir), join(target, sets[i].dir), { recursive: true }));
|
|
1100
|
+
const changed = sets.some((set, i) => set.dir !== sourceDirs[i]);
|
|
1101
|
+
writeFileSync(join(target, 'frames.json'), changed ? JSON.stringify({ ...raw, sets }, null, 2) + '\n' : bytes);
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1065
1104
|
/**
|
|
1066
1105
|
* A frame set as `rigc render` wrote it: either the `--out` directory
|
|
1067
1106
|
* (`frames.json` plus one set directory) or a set directory whose parent holds
|
|
@@ -2502,7 +2541,7 @@ function seamPairRowsFrom(seam: SeamFigures, parts: readonly PlacedAlpha[], rigS
|
|
|
2502
2541
|
return sorted.map((acc, i) => {
|
|
2503
2542
|
// A part over no other art is named first, then SEAM_NO_ART.
|
|
2504
2543
|
const pair: [string, string] = acc.a < 0 ? [name(acc.b), SEAM_NO_ART] : [name(acc.a), name(acc.b)];
|
|
2505
|
-
const file = `${String(i + 1).padStart(Math.max(2, width), '0')}_${pair.map((n) => (n === SEAM_NO_ART ? 'no-art' : n)).join('_')}.png
|
|
2544
|
+
const file = diagnosticSegment(`${String(i + 1).padStart(Math.max(2, width), '0')}_${pair.map((n) => (n === SEAM_NO_ART ? 'no-art' : n)).join('_')}`, '.png');
|
|
2506
2545
|
const subjects = pair.filter(p => p !== SEAM_NO_ART);
|
|
2507
2546
|
const cut = acc.a >= 0 && parts[acc.a].from === parts[acc.b].from ? { cut: { from: parts[acc.a].from, differing_copies_px: acc.differing } } : {};
|
|
2508
2547
|
return { row: { ...checkRow('seam_pairs', subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair', false, subjects), parts: pair, px_over_40: acc.over40,
|
|
@@ -2716,8 +2755,19 @@ export type ReportedLine = { status: 'REPORTED'; [figure: string]: unknown } | {
|
|
|
2716
2755
|
/** The reported lines, after the judgement lines, in the order check.json and the console carry them. */
|
|
2717
2756
|
export const REPORTED_LINES = ['RECOMPOSITE_HOLES'] as const;
|
|
2718
2757
|
|
|
2719
|
-
|
|
2758
|
+
export const CHECK_SPEC = 'rig-parts-check/1';
|
|
2759
|
+
|
|
2760
|
+
/** The primary packed model document `check` read (`check/build/skeleton.model.json`). */
|
|
2761
|
+
export interface CheckBuildRecord {
|
|
2762
|
+
model_sha256: string;
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
/** The completed check.json, with its version, bar outcomes and build identity first and PASS last. */
|
|
2720
2766
|
export interface CheckFigures {
|
|
2767
|
+
spec: typeof CHECK_SPEC;
|
|
2768
|
+
bar_outcomes: CheckBarOutcomes;
|
|
2769
|
+
/** The primary `check/build/skeleton.model.json` `check` read (issue #1378): provenance, not a bar. */
|
|
2770
|
+
build: CheckBuildRecord;
|
|
2721
2771
|
gate_spine_html_green: boolean;
|
|
2722
2772
|
/** Which rigc entry gated the build ({@link readRigcEntry}): provenance, not a bar. */
|
|
2723
2773
|
rigc_entry: RigcEntryRecord;
|
|
@@ -3043,6 +3093,117 @@ export const MOTION_SEAM_LINE = 'SEAM_OVER_MOTION';
|
|
|
3043
3093
|
*/
|
|
3044
3094
|
export const ACCEPTABLE_BARS: readonly string[] = [...BARS.filter((b) => b !== 'gate'), FOLD_LINE, LEVEL_LINE, STRESS_LINE, LIMB_LINE, SWEEP_LINE, MOTION_SEAM_LINE];
|
|
3045
3095
|
|
|
3096
|
+
function checkBarIds() {
|
|
3097
|
+
return [...BARS, FOLD_LINE, LEVEL_LINE, STRESS_LINE, LIMB_LINE, SWEEP_LINE, ART_JOINT_LINE, CUT_MATERIAL_LINE, SETUP_PAINTING_LINE, BOUNDARY_COLOUR_LINE, BEHIND_SEAM_LINE, MOTION_SEAM_LINE] as const;
|
|
3098
|
+
}
|
|
3099
|
+
export type CheckBarId = ReturnType<typeof checkBarIds>[number];
|
|
3100
|
+
|
|
3101
|
+
/** Reading-level reasons recorded where the legacy judgement chooses to skip. */
|
|
3102
|
+
export interface CheckBarSkipReasons {
|
|
3103
|
+
BREATH_VISIBLE?: 'no-eligible-region' | 'no-reading';
|
|
3104
|
+
BLINK_NO_HOLE?: 'no-eye-parts' | 'no-blink-track' | 'no-reading';
|
|
3105
|
+
TIP_OVER_ROOT?: 'no-swing-parts' | 'no-reading';
|
|
3106
|
+
STILL_REGIONS_DARK?: 'no-eligible-region' | 'no-reading';
|
|
3107
|
+
TEXTURE_STRETCH?: 'no-reading' | 'no-meshes' | 'no-visible-meshes';
|
|
3108
|
+
}
|
|
3109
|
+
|
|
3110
|
+
export type CheckBarSkipReason = NonNullable<CheckBarSkipReasons[keyof CheckBarSkipReasons]>
|
|
3111
|
+
| 'no-idle' | 'no-parts' | 'no-comparable-tracks' | 'no-animation' | 'no-hanging-footwear' | 'no-posed-footwear'
|
|
3112
|
+
| 'no-handwear' | 'no-readable-binding' | 'no-limb-segments' | 'no-joint-range' | 'undeclared' | 'no-limit'
|
|
3113
|
+
| 'no-complete-threshold-reading' | 'no-root-gate' | 'no-complete-root-reading';
|
|
3114
|
+
|
|
3115
|
+
export type CheckBarOutcome = { status: 'PASS' | 'FAIL' } | { status: 'SKIP'; reason: CheckBarSkipReason };
|
|
3116
|
+
export type CheckBarOutcomes = Record<CheckBarId, CheckBarOutcome>;
|
|
3117
|
+
|
|
3118
|
+
function lineStatus(line: unknown): unknown {
|
|
3119
|
+
return typeof line === 'object' && line !== null ? (line as { status?: unknown }).status : undefined;
|
|
3120
|
+
}
|
|
3121
|
+
|
|
3122
|
+
function seamFigureFailed(fig: Readonly<Record<string, unknown>>): boolean {
|
|
3123
|
+
// A check.json written before issue #216 used frame pixels, so absent scale means 1.
|
|
3124
|
+
return typeof fig.seam_mean === 'number' && typeof fig.seam_px_over_40 === 'number'
|
|
3125
|
+
&& seamFails(fig.seam_mean, fig.seam_px_over_40, typeof fig.seam_frame_scale === 'number' ? fig.seam_frame_scale : 1);
|
|
3126
|
+
}
|
|
3127
|
+
|
|
3128
|
+
/** Classify the legacy figures once for both the legacy and versioned views. */
|
|
3129
|
+
function checkBarStatus(fig: Readonly<Record<string, unknown>>, id: CheckBarId): CheckBarOutcome['status'] {
|
|
3130
|
+
switch (id) {
|
|
3131
|
+
case 'gate':
|
|
3132
|
+
return fig.gate_spine_html_green === true ? 'PASS' : 'FAIL';
|
|
3133
|
+
case 'loop':
|
|
3134
|
+
return typeof fig.loop_max_diff !== 'number' ? 'SKIP' : fig.loop_max_diff === LOOP_MAX_BAR ? 'PASS' : 'FAIL';
|
|
3135
|
+
case 'seam':
|
|
3136
|
+
if (seamFigureFailed(fig) || (isRecord(fig.sets) && Object.values(fig.sets).some(s => isRecord(s) && seamFigureFailed(s)))) return 'FAIL';
|
|
3137
|
+
return typeof fig.seam_mean === 'number' ? 'PASS' : 'SKIP';
|
|
3138
|
+
case MOTION_SEAM_LINE: {
|
|
3139
|
+
const motion = fig[id];
|
|
3140
|
+
if (!isRecord(motion)) return 'SKIP';
|
|
3141
|
+
const root = isRecord(motion.roots) ? motion.roots.status : undefined;
|
|
3142
|
+
const required = isRecord(motion.required) ? motion.required.status : undefined;
|
|
3143
|
+
if (root === 'FAIL' || required === 'FAIL') return 'FAIL';
|
|
3144
|
+
return required === 'PASS' || (motion.required === undefined && root === 'PASS') ? 'PASS' : 'SKIP';
|
|
3145
|
+
}
|
|
3146
|
+
default: {
|
|
3147
|
+
const status = lineStatus(fig[id]);
|
|
3148
|
+
return status === 'PASS' || status === 'FAIL' ? status : 'SKIP';
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
|
|
3153
|
+
function checkBarSkipReason(fig: Readonly<Record<string, unknown>>, id: Exclude<CheckBarId, 'gate'>, readings: CheckBarSkipReasons): CheckBarSkipReason {
|
|
3154
|
+
const hasIdle = typeof fig.loop_max_diff === 'number';
|
|
3155
|
+
const hasParts = typeof fig.seam_mean === 'number';
|
|
3156
|
+
const hasAnimation = fig[FOLD_LINE] !== undefined;
|
|
3157
|
+
switch (id) {
|
|
3158
|
+
case 'loop': return 'no-idle';
|
|
3159
|
+
case 'seam': return 'no-parts';
|
|
3160
|
+
case 'BREATH_VISIBLE':
|
|
3161
|
+
case 'BLINK_NO_HOLE':
|
|
3162
|
+
case 'TIP_OVER_ROOT':
|
|
3163
|
+
case 'STILL_REGIONS_DARK':
|
|
3164
|
+
if (!hasIdle) return 'no-idle';
|
|
3165
|
+
if (!hasParts) return 'no-parts';
|
|
3166
|
+
break;
|
|
3167
|
+
case 'TEXTURE_STRETCH':
|
|
3168
|
+
if (!hasIdle) return 'no-idle';
|
|
3169
|
+
break;
|
|
3170
|
+
case 'CHAIN_LAG': return hasIdle ? 'no-comparable-tracks' : 'no-idle';
|
|
3171
|
+
case FOLD_LINE: return 'no-animation';
|
|
3172
|
+
case LEVEL_LINE: return !hasAnimation ? 'no-animation' : !hasParts ? 'no-parts' : fig[id] === undefined ? 'no-hanging-footwear' : 'no-posed-footwear';
|
|
3173
|
+
case STRESS_LINE: return !hasIdle ? 'no-idle' : !hasParts ? 'no-parts' : fig[id] === undefined ? 'no-handwear' : 'no-readable-binding';
|
|
3174
|
+
case LIMB_LINE: return hasParts ? 'no-limb-segments' : 'no-parts';
|
|
3175
|
+
case SWEEP_LINE: return hasParts ? 'no-joint-range' : 'no-parts';
|
|
3176
|
+
case ART_JOINT_LINE: return fig[id] === undefined ? 'undeclared' : 'no-limit';
|
|
3177
|
+
case CUT_MATERIAL_LINE:
|
|
3178
|
+
case BOUNDARY_COLOUR_LINE:
|
|
3179
|
+
return 'undeclared';
|
|
3180
|
+
case SETUP_PAINTING_LINE: {
|
|
3181
|
+
const painting = fig[id];
|
|
3182
|
+
return isRecord(painting) && 'regions' in painting ? 'no-limit' : 'undeclared';
|
|
3183
|
+
}
|
|
3184
|
+
case BEHIND_SEAM_LINE: return fig[id] === undefined ? 'undeclared' : 'no-complete-threshold-reading';
|
|
3185
|
+
case MOTION_SEAM_LINE: {
|
|
3186
|
+
const motion = fig[id];
|
|
3187
|
+
if (!isRecord(motion) || !isRecord(motion.roots)) return 'no-root-gate';
|
|
3188
|
+
return Array.isArray(motion.animations) && motion.animations.length === 0 ? 'no-animation' : 'no-complete-root-reading';
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3191
|
+
const reason = readings[id];
|
|
3192
|
+
if (reason === undefined) throw new Error(`check bar ${id} skipped without a reading-level reason`);
|
|
3193
|
+
return reason;
|
|
3194
|
+
}
|
|
3195
|
+
|
|
3196
|
+
/** The ordered producer view. A degenerate rest edge can fail stretch even when no ratio was read. */
|
|
3197
|
+
export function checkBarOutcomes(fig: Readonly<Record<string, unknown>>, skipReasons: CheckBarSkipReasons, stretchFailedWithoutReading = false): CheckBarOutcomes {
|
|
3198
|
+
return Object.fromEntries(checkBarIds().map(id => {
|
|
3199
|
+
const status = id === 'TEXTURE_STRETCH' && stretchFailedWithoutReading ? 'FAIL' : checkBarStatus(fig, id);
|
|
3200
|
+
const outcome: CheckBarOutcome = status === 'SKIP' && id !== 'gate'
|
|
3201
|
+
? { status, reason: checkBarSkipReason(fig, id, skipReasons) }
|
|
3202
|
+
: { status: status === 'SKIP' ? 'FAIL' : status };
|
|
3203
|
+
return [id, outcome];
|
|
3204
|
+
})) as CheckBarOutcomes;
|
|
3205
|
+
}
|
|
3206
|
+
|
|
3046
3207
|
/**
|
|
3047
3208
|
* The bars a `check.json`, as `check` writes it, says were not met, in
|
|
3048
3209
|
* {@link BARS} order: the gate when `gate_spine_html_green` is not true, the
|
|
@@ -3055,22 +3216,7 @@ export const ACCEPTABLE_BARS: readonly string[] = [...BARS.filter((b) => b !== '
|
|
|
3055
3216
|
* all a finished build leaves (issue #203).
|
|
3056
3217
|
*/
|
|
3057
3218
|
export function barsNotMet(fig: Readonly<Record<string, unknown>>): string[] {
|
|
3058
|
-
|
|
3059
|
-
if (fig.gate_spine_html_green !== true) out.push('gate');
|
|
3060
|
-
if (typeof fig.loop_max_diff === 'number' && fig.loop_max_diff !== LOOP_MAX_BAR) out.push('loop');
|
|
3061
|
-
// A check.json written before issue #216 has no seam_frame_scale; it is read by the frame count, the bar it was written under.
|
|
3062
|
-
const scale = typeof fig.seam_frame_scale === 'number' ? fig.seam_frame_scale : 1;
|
|
3063
|
-
const setFailed =
|
|
3064
|
-
isRecord(fig.sets) &&
|
|
3065
|
-
Object.values(fig.sets).some((s) => isRecord(s) && typeof s.seam_mean === 'number' && typeof s.seam_px_over_40 === 'number' && seamFails(s.seam_mean, s.seam_px_over_40, typeof s.seam_frame_scale === 'number' ? s.seam_frame_scale : 1));
|
|
3066
|
-
if ((typeof fig.seam_mean === 'number' && typeof fig.seam_px_over_40 === 'number' && seamFails(fig.seam_mean, fig.seam_px_over_40, scale)) || setFailed) out.push('seam');
|
|
3067
|
-
for (const n of [...JUDGEMENT_LINES, FOLD_LINE, LEVEL_LINE, STRESS_LINE, LIMB_LINE, SWEEP_LINE, ART_JOINT_LINE, CUT_MATERIAL_LINE, BOUNDARY_COLOUR_LINE, BEHIND_SEAM_LINE]) {
|
|
3068
|
-
const l = fig[n];
|
|
3069
|
-
if (typeof l === 'object' && l !== null && (l as { status?: unknown }).status === 'FAIL') out.push(n);
|
|
3070
|
-
}
|
|
3071
|
-
const motion = fig[MOTION_SEAM_LINE];
|
|
3072
|
-
if (isRecord(motion) && ((isRecord(motion.roots) && motion.roots.status === 'FAIL') || (isRecord(motion.required) && motion.required.status === 'FAIL'))) out.push(MOTION_SEAM_LINE);
|
|
3073
|
-
return out;
|
|
3219
|
+
return checkBarIds().filter(id => id !== SETUP_PAINTING_LINE && checkBarStatus(fig, id) === 'FAIL');
|
|
3074
3220
|
}
|
|
3075
3221
|
|
|
3076
3222
|
/** The declared requirements a `check.json` says were not PASS (FAIL or NOT MEASURABLE), by name, in the file's order; none without a `requirements` block. */
|
|
@@ -3174,9 +3320,9 @@ export type CheckStatus = 'PASS' | 'FAIL' | 'SKIP' | 'WARN' | 'CLEAR' | 'REPORTE
|
|
|
3174
3320
|
* {@link SWEEP_LINE}, {@link MOTION_SEAM_LINE}, {@link CLOTH_LINE}, the reported lines, {@link SOURCE_LINE} and
|
|
3175
3321
|
* {@link WIND_BAND_LINE}, each where the file writes it. The `requirements` block's lines are not bars and are not read here.
|
|
3176
3322
|
*/
|
|
3177
|
-
export function checkStatuses(fig: CheckFigures): Record<string, CheckStatus> {
|
|
3178
|
-
const
|
|
3179
|
-
const bar = (
|
|
3323
|
+
export function checkStatuses(fig: Omit<CheckFigures, 'spec' | 'bar_outcomes' | 'build'>): Record<string, CheckStatus> {
|
|
3324
|
+
const raw = fig as unknown as Record<string, unknown>;
|
|
3325
|
+
const bar = (id: 'gate' | 'loop' | 'seam', measured: boolean): CheckStatus => (!measured ? 'SKIP' : checkBarStatus(raw, id) === 'FAIL' ? 'FAIL' : 'PASS');
|
|
3180
3326
|
const out: Record<string, CheckStatus> = { gate: bar('gate', true), loop: bar('loop', fig.loop_max_diff !== null), seam: bar('seam', fig.seam_mean !== null) };
|
|
3181
3327
|
for (const n of JUDGEMENT_LINES) out[n] = fig[n].status;
|
|
3182
3328
|
for (const n of [FOLD_LINE, LEVEL_LINE, STRESS_LINE, LIMB_LINE, SWEEP_LINE, MOTION_SEAM_LINE, CLOTH_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, COINCIDE_LINE] as const) {
|
|
@@ -5141,6 +5287,7 @@ export function publishMotionSeamWorlds(out: string, scratch: string, worlds: Mo
|
|
|
5141
5287
|
}
|
|
5142
5288
|
}
|
|
5143
5289
|
refuseIfAny(problems);
|
|
5290
|
+
for (const name of names) retainedCheckRenderPlan(join(scratch, name));
|
|
5144
5291
|
const stage = join(scratch, '_publish');
|
|
5145
5292
|
const previous = join(scratch, '_previous');
|
|
5146
5293
|
const kept = join(out, MOTION_SEAM_DIR);
|
|
@@ -5148,7 +5295,7 @@ export function publishMotionSeamWorlds(out: string, scratch: string, worlds: Mo
|
|
|
5148
5295
|
const previousCheck = existsSync(check) ? readFileSync(check) : null;
|
|
5149
5296
|
mkdirSync(out, { recursive: true });
|
|
5150
5297
|
mkdirSync(stage, { recursive: true });
|
|
5151
|
-
for (const name of names)
|
|
5298
|
+
for (const name of names) retainCheckRender(join(scratch, name), join(stage, name));
|
|
5152
5299
|
const hadPrevious = existsSync(kept);
|
|
5153
5300
|
if (hadPrevious) renameSync(kept, previous);
|
|
5154
5301
|
try {
|
|
@@ -6571,6 +6718,7 @@ export function windBandLines(line: WindBandLine, plant: WindBandPlant = {}): st
|
|
|
6571
6718
|
*/
|
|
6572
6719
|
function renderExtremes(build: string, out: string, animations: readonly string[], frames: unknown, frameSets: unknown, render: RigcRunner): string[] {
|
|
6573
6720
|
if (animations.length === 0) return ['EXTREMES SKIP: CHECK_EXTREMES_NO_ANIMATIONS — no animation in motion.json'];
|
|
6721
|
+
diagnosticSiblings(animations.map(name => ({ name })), 'extremes');
|
|
6574
6722
|
const scratch = join(out, '_extremes');
|
|
6575
6723
|
const dest = join(out, 'extremes');
|
|
6576
6724
|
try {
|
|
@@ -6585,6 +6733,7 @@ function renderExtremes(build: string, out: string, animations: readonly string[
|
|
|
6585
6733
|
writeFileSync(grid, JSON.stringify({ spec: 'rigc-frames/1', viewport: { ...vp, scale: 1, pixelWidth: Math.max(1, Math.round(vp.width as number)), pixelHeight: Math.max(1, Math.round(vp.height as number)) } }));
|
|
6586
6734
|
const lines: string[] = [];
|
|
6587
6735
|
for (const animation of animations) {
|
|
6736
|
+
const target = join(dest, diagnosticSegment(animation));
|
|
6588
6737
|
const rendered = join(scratch, 'render');
|
|
6589
6738
|
const call = render(['render', '--candidate', build, '--animation', animation, '--fps', String(IDLE_FPS), '--viewport-from', grid, '--extremes-only', '--out', rendered]);
|
|
6590
6739
|
if (call.status !== 0) throw new Error(`render --extremes-only ${JSON.stringify(animation)} exited ${call.status}: ${call.out.trim()}${rigcRanClause(call)}`);
|
|
@@ -6595,7 +6744,7 @@ function renderExtremes(build: string, out: string, animations: readonly string[
|
|
|
6595
6744
|
const sets = isRecord(frameSets) && Array.isArray(frameSets.sets) ? frameSets.sets.filter(isRecord).filter(row => row.animation === animation) : [];
|
|
6596
6745
|
const dir = sets.length === 1 ? sets[0].dir : undefined;
|
|
6597
6746
|
if (typeof dir !== 'string' || dir.length === 0 || isAbsolute(dir) || dir.split(/[\\/]/).includes('..')) throw new Error(`the existing render has no local set for ${JSON.stringify(animation)}`);
|
|
6598
|
-
const source = join(rendered, dir)
|
|
6747
|
+
const source = join(rendered, dir);
|
|
6599
6748
|
const observation: unknown = JSON.parse(readFileSync(join(source, 'extremes.json'), 'utf8'));
|
|
6600
6749
|
if (!isRecord(observation) || observation.animation !== animation) throw new Error(`render --extremes-only has no set for ${JSON.stringify(animation)}`);
|
|
6601
6750
|
mkdirSync(target, { recursive: true });
|
|
@@ -6606,9 +6755,10 @@ function renderExtremes(build: string, out: string, animations: readonly string[
|
|
|
6606
6755
|
}
|
|
6607
6756
|
return lines;
|
|
6608
6757
|
} catch (err) {
|
|
6609
|
-
//
|
|
6610
|
-
//
|
|
6758
|
+
// Invalid destination names are input refusals. Other diagnostic failures
|
|
6759
|
+
// leave the measured bars unchanged and mark the observation unavailable.
|
|
6611
6760
|
rmSync(dest, { recursive: true, force: true });
|
|
6761
|
+
if (err instanceof PartsError && err.problems.some(problem => problem.code === 'DIAGNOSTIC_PATH_SEGMENT')) throw err;
|
|
6612
6762
|
return [`EXTREMES SKIP: CHECK_EXTREMES_RENDER_FAILED — ${err instanceof Error ? err.message : String(err)}`];
|
|
6613
6763
|
} finally {
|
|
6614
6764
|
rmSync(scratch, { recursive: true, force: true });
|
|
@@ -6716,6 +6866,10 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6716
6866
|
if (reqFile?.cut_material !== undefined && (set !== undefined || allSets)) refuseIfAny([{code: 'CHECK_CUT_MATERIAL_MEASURED', object: 'cut_material', detail: 'source evidence binds base assembly only; run check on its base parts without --set/--all-sets; alternate-set coverage requires its own original source instrument'}]);
|
|
6717
6867
|
const cutMaterialProblems: Problem[] = [];
|
|
6718
6868
|
const cutMaterial = reqFile?.cut_material === undefined ? null : checkJointMaterial(reqFile.cut_material, inp.parts, name => readPng(join(dirname(inp.partsDir), partImageReference((inp.parts as PartsFile).parts.find(p => p.name === name) as PartRecord).path)), cutMaterialProblems, inp.parts === null ? undefined : readMaterialSources(dirname(inp.partsDir), inp.parts));
|
|
6869
|
+
const animationNames = isRecord(inp.motion.animations) ? Object.keys(inp.motion.animations) : [];
|
|
6870
|
+
const selectedAlts = inp.parts === null || (set === undefined && !allSets) ? []
|
|
6871
|
+
: allSets ? inp.parts.alternates ?? [] : (inp.parts.alternates ?? []).filter(alt => alt.name === set);
|
|
6872
|
+
preflightCheckPaths(animationNames, selectedAlts.map(alt => alt.name), reqFile, noExtremes);
|
|
6719
6873
|
// A measured material failure is a check bar; unavailable data is a refusal.
|
|
6720
6874
|
const rigcEntry = readRigcEntry(requireRigcVersion(rigc));
|
|
6721
6875
|
/**
|
|
@@ -6764,6 +6918,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6764
6918
|
const pack = parsePackLines(gateHtml);
|
|
6765
6919
|
refuseIfAny(packEdgeProblems(pack, mode));
|
|
6766
6920
|
const packOpaque = pack.filter((p) => existsSync(join(buildDir, p.page))).map((p) => ({ page: p.page, share: opaqueShare(readPng(join(buildDir, p.page))) }));
|
|
6921
|
+
const modelSha256 = createHash('sha256').update(readFileSync(join(buildDir, 'skeleton.model.json'))).digest('hex');
|
|
6767
6922
|
|
|
6768
6923
|
// 2. no second gate: `rigc validate --profile spine` of this build measured no rule the build's own two passes
|
|
6769
6924
|
// had not (14 of the build's 23 on the demo, rigc 1.5.1 and 2.0.3 alike; selftest CH09 holds it), and on rigc's
|
|
@@ -6774,6 +6929,11 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6774
6929
|
const full: FullInputs | null = inp.parts !== null && inp.idleDuration !== null ? { ...inp, parts: inp.parts, idleDuration: inp.idleDuration } : null;
|
|
6775
6930
|
const lacking = [inp.noParts, inp.noIdle].filter((r): r is string => r !== null).join('; ');
|
|
6776
6931
|
const problems: Problem[] = [];
|
|
6932
|
+
const skipReasons: CheckBarSkipReasons = {};
|
|
6933
|
+
const readingSkip = <Id extends keyof CheckBarSkipReasons>(id: Id): ReadingSkip<Id> => (reason, code) => {
|
|
6934
|
+
skipReasons[id] = code;
|
|
6935
|
+
return skip(reason);
|
|
6936
|
+
};
|
|
6777
6937
|
|
|
6778
6938
|
// 3. the idle, the loop, the heat — only when there is an idle
|
|
6779
6939
|
let idle: FrameSet | null = null;
|
|
@@ -6796,7 +6956,6 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6796
6956
|
keyed = join(loopDir, 'build');
|
|
6797
6957
|
return keyed;
|
|
6798
6958
|
};
|
|
6799
|
-
const animationNames = isRecord(inp.motion.animations) ? Object.keys(inp.motion.animations) : [];
|
|
6800
6959
|
const named = animationNames.filter((n) => n !== 'idle');
|
|
6801
6960
|
// Issue #590: steady-wind seam band sweep, only under --wind-band; run before idle/still renders so a refusal
|
|
6802
6961
|
// on an unbanded pair writes nothing.
|
|
@@ -7003,14 +7162,15 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7003
7162
|
let tip: JudgementLine = skip(lacking);
|
|
7004
7163
|
if (full !== null) {
|
|
7005
7164
|
try {
|
|
7006
|
-
breath = breathLine(full, isolated, breathPair, problems, notPlanted);
|
|
7007
|
-
if (idle !== null) tip = tipLine(full, join(idle.dir, GEOMETRY_FILE), idle.written, problems, reqFile === null ? NO_TIP_EXCEPTIONS : { path: reqFile.path, not_swinging: reqFile.not_swinging, rises: reqFile.rises, rests: reqFile.rests });
|
|
7165
|
+
breath = breathLine(full, isolated, breathPair, problems, notPlanted, readingSkip('BREATH_VISIBLE'));
|
|
7166
|
+
if (idle !== null) tip = tipLine(full, join(idle.dir, GEOMETRY_FILE), idle.written, problems, reqFile === null ? NO_TIP_EXCEPTIONS : { path: reqFile.path, not_swinging: reqFile.not_swinging, rises: reqFile.rises, rests: reqFile.rests }, readingSkip('TIP_OVER_ROOT'));
|
|
7008
7167
|
} finally {
|
|
7009
7168
|
rmSync(isoDir, { recursive: true, force: true });
|
|
7010
7169
|
}
|
|
7011
7170
|
}
|
|
7012
7171
|
let chain: JudgementLine = skip(inp.noIdle ?? '');
|
|
7013
7172
|
let stretch: JudgementLine = skip(inp.noIdle ?? '');
|
|
7173
|
+
let stretchFailedWithoutReading = false;
|
|
7014
7174
|
let still: JudgementLine = skip(lacking);
|
|
7015
7175
|
let idleGeometry: IdleGeometry | null = null;
|
|
7016
7176
|
if (idle !== null) {
|
|
@@ -7019,8 +7179,10 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7019
7179
|
const geometryPath = join(idle.dir, GEOMETRY_FILE);
|
|
7020
7180
|
const geometry = readGeometry(geometryPath, idle.written);
|
|
7021
7181
|
idleGeometry = geometry;
|
|
7022
|
-
|
|
7023
|
-
|
|
7182
|
+
const beforeStretch = problems.length;
|
|
7183
|
+
stretch = stretchLine(geometry, geometryPath, problems, { ...inp, config }, checkSlotParts(inp.rig, inp.parts?.parts.map(p => p.name) ?? [], inp.parts?.alternates?.map(set => set.name) ?? []), readingSkip('TEXTURE_STRETCH'));
|
|
7184
|
+
stretchFailedWithoutReading = stretch.status === 'SKIP' && problems.length > beforeStretch;
|
|
7185
|
+
if (full !== null) still = stillLine(full, idle, geometry, geometryPath, problems, notPlanted, readingSkip('STILL_REGIONS_DARK'));
|
|
7024
7186
|
}
|
|
7025
7187
|
|
|
7026
7188
|
// 3c. a sleeve on one chain, its first link turned large (issue #347): a throwaway copy, physics left out, posed by rigc
|
|
@@ -7314,11 +7476,9 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7314
7476
|
}, problems);
|
|
7315
7477
|
}
|
|
7316
7478
|
seamViewport = stillSet.viewport;
|
|
7317
|
-
if (keepStills)
|
|
7479
|
+
if (keepStills) retainCheckRender(join(stillDir, 'render'), inp.parts === null ? keptDir : join(out, 'setup_still_auto'));
|
|
7318
7480
|
if (inp.parts !== null) {
|
|
7319
7481
|
// Stage existing gated files, not decoded pages/poses. No second build or gate.
|
|
7320
|
-
const selectedAlts = set !== undefined || allSets
|
|
7321
|
-
? (allSets ? (inp.parts.alternates ?? []) : (inp.parts.alternates ?? []).filter(a => a.name === set)) : [];
|
|
7322
7482
|
const setStillAnimations: Record<string, unknown> = { still: animations.still };
|
|
7323
7483
|
const setStillBase = { ...withoutSliders(inp.rig, setStillAnimations), images };
|
|
7324
7484
|
const setsJsonPath = join(inp.rigDir, SETS_FILE);
|
|
@@ -7328,7 +7488,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7328
7488
|
const entry = setsMap !== null && isRecord(setsMap[alt.name]) ? setsMap[alt.name] as Record<string, unknown> : null;
|
|
7329
7489
|
const drawn = entry !== null && isRecord(entry.drawn)
|
|
7330
7490
|
? Object.fromEntries(Object.entries(entry.drawn).filter((e): e is [string, number] => typeof e[1] === 'number' && Number.isFinite(e[1]))) : alt.drawn;
|
|
7331
|
-
const dir = join(stillDir, 'set_' + alt.name);
|
|
7491
|
+
const dir = join(stillDir, 'set_' + diagnosticSegment(alt.name));
|
|
7332
7492
|
mkdirSync(dir, { recursive: true });
|
|
7333
7493
|
writeFileSync(join(dir, 'rig.json'), JSON.stringify(stillRigForSet(setStillBase, alt, drawn)));
|
|
7334
7494
|
writeFileSync(join(dir, 'motion.json'), JSON.stringify({ ...inp.motion, animations: setStillAnimations }));
|
|
@@ -7349,7 +7509,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7349
7509
|
};
|
|
7350
7510
|
const canonicalSet = canonical(join(stillDir, 'build'), join(stillDir, 'seam'));
|
|
7351
7511
|
seamViewport = canonicalSet.viewport;
|
|
7352
|
-
if (keepStills)
|
|
7512
|
+
if (keepStills) retainCheckRender(join(stillDir, 'seam'), keptDir);
|
|
7353
7513
|
const rigSlotOrder = (Array.isArray(inp.rig.slots) ? inp.rig.slots : []).filter(isRecord).map((sl) => String(sl.name));
|
|
7354
7514
|
const composite = flatComposite(inp.parts, inp.partsDir, stillSet.background, rigSlotOrder);
|
|
7355
7515
|
const autoSeam = seamFigures(composite, stillSet.frames[0].image, inp.stage, stillSet.viewport, stillSet.background, undefined, inp.parts.scene !== undefined);
|
|
@@ -7371,10 +7531,10 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7371
7531
|
const asr = rigc(['render', '--candidate', join(setDir, 'build'), '--animation', 'still', '--fps', String(STILL_FPS), '--max', String(maxSide), '--out', join(setDir, 'render')]);
|
|
7372
7532
|
if (asr.status !== 0) refuseIfAny(rigcFailed(`render (the setup-pose still of set "${alt.name}")`, asr, asr.out.split('\n').filter((l) => l.includes('FAIL'))));
|
|
7373
7533
|
const altStillSet = readFrameSet(join(setDir, 'render'));
|
|
7374
|
-
if (keepStills)
|
|
7534
|
+
if (keepStills) retainCheckRender(join(setDir, 'render'), join(out, 'setup_still_auto', diagnosticSegment(alt.name)));
|
|
7375
7535
|
const altComposite = flatCompositeForSet(inp.parts, reference, inp.partsDir, altStillSet.background, rigSlotOrder);
|
|
7376
7536
|
const altCanonical = canonical(join(setDir, 'build'), join(setDir, 'seam'));
|
|
7377
|
-
if (keepStills)
|
|
7537
|
+
if (keepStills) retainCheckRender(join(setDir, 'seam'), join(keptDir, diagnosticSegment(alt.name)));
|
|
7378
7538
|
const altPlaced = resolvePlacedAlpha(setPlacements(inp.parts, reference, rigSlotOrder), inp.partsDir);
|
|
7379
7539
|
const altSupport = seamSupport(join(setDir, 'build'), join(setDir, 'rig.json'), altCanonical, altPlaced, seamStacks, inp.stage);
|
|
7380
7540
|
const effects = seamEffectSelection(baseSupport, altSupport);
|
|
@@ -7407,10 +7567,10 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7407
7567
|
let altPairs: SeamPairRow[] | null = null;
|
|
7408
7568
|
if (seamPairsAsked || altFailed) {
|
|
7409
7569
|
const split = population.rows(altSeam);
|
|
7410
|
-
const altSeamDir = join(seamDir, alt.name);
|
|
7570
|
+
const altSeamDir = join(seamDir, diagnosticSegment(alt.name));
|
|
7411
7571
|
mkdirSync(altSeamDir, { recursive: true });
|
|
7412
7572
|
for (const { row, pixels } of split) {
|
|
7413
|
-
row.picture = `${SEAM_DIR}/${alt.name}/${basename(row.picture)}`;
|
|
7573
|
+
row.picture = `${SEAM_DIR}/${diagnosticSegment(alt.name)}/${basename(row.picture)}`;
|
|
7414
7574
|
writePng(join(out, row.picture), seamPicture(altCanonical.frames[0].image, row, pixels));
|
|
7415
7575
|
}
|
|
7416
7576
|
altPairs = split.map((x) => x.row);
|
|
@@ -7453,12 +7613,14 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7453
7613
|
}
|
|
7454
7614
|
if (full !== null) {
|
|
7455
7615
|
const H = full.parts.rig_size[1];
|
|
7456
|
-
|
|
7457
|
-
|
|
7616
|
+
const blinkSkip = readingSkip('BLINK_NO_HOLE');
|
|
7617
|
+
if (eyes.length === 0) blink = blinkSkip(`no part comes from a See-through ${tagWords(EYE_TAGS)} layer, so there is no eye to look behind`, 'no-eye-parts');
|
|
7618
|
+
else if (shut.length === 0) blink = blinkSkip(`no idle "scaley" track on the bones of ${quoteParts(eyes)} goes below its first key, so the idle has no blink`, 'no-blink-track');
|
|
7458
7619
|
else {
|
|
7459
7620
|
const br = rigc(['render', '--candidate', join(stillDir, 'build'), '--animation', BLINK_ANIMATION, '--fps', String(STILL_FPS), '--max', String(maxSide), '--out', join(stillDir, 'blink')]);
|
|
7460
7621
|
if (br.status !== 0) refuseIfAny(rigcFailed(`render (the setup pose with the eyes shut, "${BLINK_ANIMATION}")`, br, br.out.split('\n').filter((l) => l.includes('FAIL'))));
|
|
7461
7622
|
blink = blinkLine(full, eyes, shut, stillSet, readFrameSet(join(stillDir, 'blink')), idle as FrameSet, H, problems);
|
|
7623
|
+
if (blink.status === 'SKIP') skipReasons.BLINK_NO_HOLE = 'no-reading';
|
|
7462
7624
|
}
|
|
7463
7625
|
}
|
|
7464
7626
|
} finally {
|
|
@@ -7525,7 +7687,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7525
7687
|
const skipped: { loop?: string; seam?: string } = {};
|
|
7526
7688
|
if (inp.noIdle !== null) skipped.loop = inp.noIdle;
|
|
7527
7689
|
if (inp.noParts !== null) skipped.seam = inp.noParts;
|
|
7528
|
-
const
|
|
7690
|
+
const readings: Omit<CheckFigures, 'spec' | 'bar_outcomes' | 'build' | 'PASS'> = {
|
|
7529
7691
|
gate_spine_html_green: htmlGreen,
|
|
7530
7692
|
rigc_entry: rigcEntry,
|
|
7531
7693
|
pack_mode: { page_edges: mode.pageEdges, pack_shape: mode.packShape, ...(pageSize === undefined ? {} : { page_size: pageSize }) },
|
|
@@ -7566,7 +7728,6 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7566
7728
|
...(behindSeams === null ? {} : { [BEHIND_SEAM_LINE]: behindSeams }),
|
|
7567
7729
|
...(cutMaterial === null ? {} : { [CUT_MATERIAL_LINE]: cutMaterial }),
|
|
7568
7730
|
...(reqBlock === null ? {} : { requirements: reqBlock }),
|
|
7569
|
-
PASS: false,
|
|
7570
7731
|
};
|
|
7571
7732
|
const barProblems: Problem[] = [];
|
|
7572
7733
|
if (!htmlGreen) barProblems.push(...rigcFailed(packedBuildLabel(mode), build, gateHtml));
|
|
@@ -7578,13 +7739,13 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7578
7739
|
detail: `max |d| ${loop.max}/255, first at pixel ${loop.x},${loop.y} of ${loopSet.viewport.pixelWidth}x${loopSet.viewport.pixelHeight}; ${LOOP_MAX_BAR} is required — the idle's last key must equal its first`,
|
|
7579
7740
|
});
|
|
7580
7741
|
}
|
|
7581
|
-
if (
|
|
7742
|
+
if (readings.seam_mean !== null && readings.seam_px_over_40 !== null && readings.seam_frame_scale !== null && seamFigureFailed(readings)) {
|
|
7582
7743
|
const worst = seamPairs === null || seamPairs.length === 0 ? null : seamPairs[0];
|
|
7583
7744
|
barProblems.push({
|
|
7584
7745
|
code: 'CHECK_SEAM_WITHIN_BAR',
|
|
7585
7746
|
object: 'the source-grid setup-pose render vs the flat composite of parts/ (base, judged once)',
|
|
7586
7747
|
detail:
|
|
7587
|
-
`mean |d| ${
|
|
7748
|
+
`mean |d| ${readings.seam_mean}/255 and ${readings.seam_px_over_40} frame px over ${SEAM_PX_LEVEL} (${readings.seam_px_over_80} over ${SEAM_PX_LEVEL_HIGH}) at frame scale ${readings.seam_frame_scale}, ${seamRigPxText(readings.seam_px_over_40, readings.seam_frame_scale)} rig px (the count / s²); mean <= ${SEAM_MEAN_BAR.toFixed(1)} and <= ${SEAM_PX_BAR} rig px over ${SEAM_PX_LEVEL} are required` +
|
|
7588
7749
|
(worst === null
|
|
7589
7750
|
? `; no pixel is over ${SEAM_PX_LEVEL}, so the mean alone fails and there is no pair to name`
|
|
7590
7751
|
: `; worst of ${(seamPairs as SeamPairRow[]).length} pair(s): ${seamPairText(worst)} — every pair is a \`seam pair\` line above and a row of check.json's seam_pairs`),
|
|
@@ -7609,7 +7770,13 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7609
7770
|
problems.sort((a, b) => rank(a) - rank(b));
|
|
7610
7771
|
problems.unshift(...barProblems);
|
|
7611
7772
|
problems.push(...cutMaterialProblems, ...foldProblems, ...levelProblems, ...stressProblems, ...limbProblems, ...sweepProblems, ...motionRootProblems, ...reqProblems);
|
|
7612
|
-
figures
|
|
7773
|
+
const figures: CheckFigures = {
|
|
7774
|
+
spec: CHECK_SPEC,
|
|
7775
|
+
bar_outcomes: checkBarOutcomes(readings, skipReasons, stretchFailedWithoutReading),
|
|
7776
|
+
build: { model_sha256: modelSha256 },
|
|
7777
|
+
...readings,
|
|
7778
|
+
PASS: problems.length === 0,
|
|
7779
|
+
};
|
|
7613
7780
|
const publishCheck = (): void => {
|
|
7614
7781
|
publishMotionSeamCells(out, motionSeam.required, motionCellEvidence, () => write('check.json', serializeCheckRows(figures)));
|
|
7615
7782
|
if (motionSeam.required?.cells !== undefined) written.push(MOTION_CELLS_FILE);
|
|
@@ -7678,7 +7845,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7678
7845
|
// the scene's declared requirements (issue #93)
|
|
7679
7846
|
// ---------------------------------------------------------------------------
|
|
7680
7847
|
|
|
7681
|
-
/** Where `check` writes the requirement renders, under `--out`: `as-declared/<animation>/`, `released/<name>/`, `full/<name>/`. */
|
|
7848
|
+
/** Where `check` writes the requirement renders, under `--out`: `as-declared/<animation-segment>/`, `released/<name-segment>/`, `full/<name-segment>/`. */
|
|
7682
7849
|
export const REQUIREMENTS_DIR = 'requirements';
|
|
7683
7850
|
|
|
7684
7851
|
/**
|
|
@@ -7721,16 +7888,32 @@ export function inputFileRecord(bytes: Uint8Array, recorded: string): InputFileR
|
|
|
7721
7888
|
/** The throwaway copies' specs and builds, under `--out`; removed before the stage returns. */
|
|
7722
7889
|
const REQUIREMENTS_SCRATCH = '_requirements';
|
|
7723
7890
|
|
|
7891
|
+
/** All known name-derived sibling scopes, before check or requirement writes. */
|
|
7892
|
+
export function preflightCheckPaths(animations: readonly string[], alternateSets: readonly string[], requirements: RequirementsFile | null, noExtremes = false): void {
|
|
7893
|
+
if (!noExtremes) diagnosticSiblings(animations.map(name => ({ name })), 'extremes');
|
|
7894
|
+
diagnosticSiblings(animations.map(name => ({ name })), 'retained render sets');
|
|
7895
|
+
diagnosticSiblings(alternateSets.map(name => ({ name })), 'alternate set folders');
|
|
7896
|
+
if (requirements !== null) {
|
|
7897
|
+
const declared = requirementAnimations(requirements.requirements).map(name => ({ name }));
|
|
7898
|
+
diagnosticSiblings(declared, 'requirements/as-declared');
|
|
7899
|
+
const suffix = typeof requirements.fps === 'number' && requirements.fps !== IDLE_FPS ? `@${requirements.fps}fps` : '';
|
|
7900
|
+
diagnosticSiblings(declared.map(({ name }) => ({ name, suffix })), 'requirements retained render sets');
|
|
7901
|
+
const follows = requirements.requirements.filter(requirement => requirement.kind === 'follow').map(requirement => ({ name: requirement.name }));
|
|
7902
|
+
diagnosticSiblings(follows, 'requirements/released');
|
|
7903
|
+
diagnosticSiblings(follows, 'requirements/full');
|
|
7904
|
+
}
|
|
7905
|
+
}
|
|
7906
|
+
|
|
7724
7907
|
/**
|
|
7725
7908
|
* Measure every requirement of a file {@link resolveRequirements} has passed.
|
|
7726
7909
|
* Every pose is rig-c's: each animation a requirement names is rendered
|
|
7727
7910
|
* once with `--geometry` at the file's fps, from the rig under test's own
|
|
7728
7911
|
* build — or, when the file places scene targets for it, from a copy with
|
|
7729
7912
|
* them written in ({@link placeTargets}, built `--profile spine`, as the setup
|
|
7730
|
-
* still is) — into `requirements/as-declared/<animation>/`. Each `follow` adds
|
|
7913
|
+
* still is) — into `requirements/as-declared/<animation-segment>/`. Each `follow` adds
|
|
7731
7914
|
* two copies, released and full ({@link forceMix}), the scene targets placed
|
|
7732
|
-
* on both, rendered into `requirements/released/<name>/` and
|
|
7733
|
-
* `requirements/full/<name>/`. The released copy's constraint is muted
|
|
7915
|
+
* on both, rendered into `requirements/released/<name-segment>/` and
|
|
7916
|
+
* `requirements/full/<name-segment>/`. The released copy's constraint is muted
|
|
7734
7917
|
* throughout, which rig-c's A47 (ik) or A48 (transform) refuses unless
|
|
7735
7918
|
* the rig declares the mix consumer-driven: when the gate refuses that copy
|
|
7736
7919
|
* for that constraint and nothing else ({@link mutedOnly}), the copy — never
|
|
@@ -7740,6 +7923,7 @@ const REQUIREMENTS_SCRATCH = '_requirements';
|
|
|
7740
7923
|
* FAIL and NOT MEASURABLE into `problems`.
|
|
7741
7924
|
*/
|
|
7742
7925
|
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): Omit<RequirementsBlock, 'file'> {
|
|
7926
|
+
preflightCheckPaths([], [], file, true);
|
|
7743
7927
|
const reqDir = join(out, REQUIREMENTS_DIR);
|
|
7744
7928
|
const scratch = join(out, REQUIREMENTS_SCRATCH);
|
|
7745
7929
|
for (const d of [reqDir, scratch]) rmSync(d, { recursive: true, force: true });
|
|
@@ -7760,8 +7944,11 @@ export function measureRequirements(inp: CheckInputs, file: RequirementsFile, bu
|
|
|
7760
7944
|
return b.dir;
|
|
7761
7945
|
};
|
|
7762
7946
|
const posesOf = (candidate: string, animation: string, dir: string, label: string): { poses: Poses; geo: IdleGeometry; path: string } => {
|
|
7763
|
-
const
|
|
7947
|
+
const staged = join(scratch, 'render');
|
|
7948
|
+
const r = render(['render', '--candidate', candidate, '--animation', animation, '--fps', String(file.fps), '--max', String(IDLE_MAX_PX), '--geometry', '--out', staged]);
|
|
7764
7949
|
if (r.status !== 0) refuseIfAny(rigcFailed(`render --animation ${animation} --geometry (${label})`, r, r.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
|
|
7950
|
+
retainCheckRender(staged, dir);
|
|
7951
|
+
rmSync(staged, { recursive: true, force: true });
|
|
7765
7952
|
const set = readFrameSet(dir);
|
|
7766
7953
|
if (set.written !== set.sampled || set.stride !== 1) {
|
|
7767
7954
|
refuseIfAny([{ code: 'CHECK_REQUIREMENTS_FRAMES', object: `${dir} (${label})`, detail: `rigc sampled ${set.sampled} frame(s) and wrote ${set.written} at stride ${set.stride}; every sampled frame is required, since a requirement holds over all of them` }]);
|
|
@@ -7800,7 +7987,7 @@ export function measureRequirements(inp: CheckInputs, file: RequirementsFile, bu
|
|
|
7800
7987
|
const scene = file.targets.some((t) => t.animation === animation);
|
|
7801
7988
|
const label = scene ? `as declared, the scene targets of "${animation}" placed` : 'as declared';
|
|
7802
7989
|
const candidate = scene ? green(buildCopy(placedFor(animation).rig, placedFor(animation).motion), `the rig ${label}`) : buildDir;
|
|
7803
|
-
declared.set(animation, posesOf(candidate, animation, join(reqDir, 'as-declared', animation), label));
|
|
7990
|
+
declared.set(animation, posesOf(candidate, animation, join(reqDir, 'as-declared', diagnosticSegment(animation)), label));
|
|
7804
7991
|
}
|
|
7805
7992
|
for (const r of file.requirements) {
|
|
7806
7993
|
const d = declared.get(r.animation) as { poses: Poses; geo: IdleGeometry; path: string };
|
|
@@ -7824,9 +8011,9 @@ export function measureRequirements(inp: CheckInputs, file: RequirementsFile, bu
|
|
|
7824
8011
|
relBuild = buildCopy(declareConsumerDriven(rel.rig, r), rel.motion);
|
|
7825
8012
|
door = `${mutedLine(r).rule} refused the released copy (its mix is 0 throughout), so that copy alone declares ${r.constraint_type} constraint "${r.constraint}" in invariants.consumerDrivenMix`;
|
|
7826
8013
|
}
|
|
7827
|
-
const released = posesOf(green(relBuild, `the released copy of "${r.name}": ${r.constraint_type} constraint "${r.constraint}" ${r.property} mix forced to 0`), r.animation, join(reqDir, 'released', r.name), 'released');
|
|
8014
|
+
const released = posesOf(green(relBuild, `the released copy of "${r.name}": ${r.constraint_type} constraint "${r.constraint}" ${r.property} mix forced to 0`), r.animation, join(reqDir, 'released', diagnosticSegment(r.name)), 'released');
|
|
7828
8015
|
const fullCopy = forceMix(scene.rig, scene.motion, r, 1);
|
|
7829
|
-
const full = posesOf(green(buildCopy(fullCopy.rig, fullCopy.motion), `the full copy of "${r.name}": ${r.constraint_type} constraint "${r.constraint}" ${r.property} mix forced to 1`), r.animation, join(reqDir, 'full', r.name), 'full');
|
|
8016
|
+
const full = posesOf(green(buildCopy(fullCopy.rig, fullCopy.motion), `the full copy of "${r.name}": ${r.constraint_type} constraint "${r.constraint}" ${r.property} mix forced to 1`), r.animation, join(reqDir, 'full', diagnosticSegment(r.name)), 'full');
|
|
7830
8017
|
const same = (a: Poses, b: Poses): boolean => a.times.length === b.times.length && a.times.every((t, i) => t === b.times[i] && a.indices[i] === b.indices[i]);
|
|
7831
8018
|
if (!same(d.poses, released.poses) || !same(d.poses, full.poses)) {
|
|
7832
8019
|
refuseIfAny([{ code: 'CHECK_REQUIREMENTS_FRAMES', object: `requirement "${r.name}"`, detail: `the as-declared, released and full renders of "${r.animation}" sample frames at [${d.poses.times.join(', ')}], [${released.poses.times.join(', ')}] and [${full.poses.times.join(', ')}] s; the follow is read frame by frame across the three, so the same frames are required` }]);
|
|
@@ -7893,10 +8080,12 @@ function boxText(h: { x: number; y: number; w: number; h: number }): string {
|
|
|
7893
8080
|
/** The throwaway animation that holds the blink tracks at their closed value, rendered beside the setup-pose still. */
|
|
7894
8081
|
export const BLINK_ANIMATION = 'blink_shut';
|
|
7895
8082
|
|
|
7896
|
-
function skip(reason: string): JudgementLine {
|
|
8083
|
+
function skip(reason: string): Extract<JudgementLine, { status: 'SKIP' }> {
|
|
7897
8084
|
return { status: 'SKIP', reason };
|
|
7898
8085
|
}
|
|
7899
8086
|
|
|
8087
|
+
type ReadingSkip<Id extends keyof CheckBarSkipReasons> = (reason: string, code: NonNullable<CheckBarSkipReasons[Id]>) => ReturnType<typeof skip>;
|
|
8088
|
+
|
|
7900
8089
|
function tagWords(tags: readonly BaseTag[]): string {
|
|
7901
8090
|
return tags.map((t) => `"${t}"`).join(' or ');
|
|
7902
8091
|
}
|
|
@@ -7999,20 +8188,20 @@ function noneHeldText(declared: readonly string[]): string {
|
|
|
7999
8188
|
* or a physics response to the world inside the torso's box passed the bar
|
|
8000
8189
|
* for a torso that did not breathe.
|
|
8001
8190
|
*/
|
|
8002
|
-
function breathLine(inp: FullInputs, isolated: Isolate, pair: BreathPairRender, problems: Problem[], notPlanted: readonly string[]
|
|
8191
|
+
function breathLine(inp: FullInputs, isolated: Isolate, pair: BreathPairRender, problems: Problem[], notPlanted: readonly string[], skipped: ReadingSkip<'BREATH_VISIBLE'>): JudgementLine {
|
|
8003
8192
|
const torso = partsTagged(inp.parts, TORSO_TAGS);
|
|
8004
8193
|
const { all: allFeet, held: feet, declared } = plantedFeet(inp.parts, notPlanted);
|
|
8005
8194
|
const noTorso = `no part comes from a See-through ${tagWords(TORSO_TAGS)} layer, so there is no torso to see breathe`;
|
|
8006
8195
|
const noFeet = `no part comes from a See-through ${tagWords(FEET_TAGS)} layer, so there are no feet to hold still`;
|
|
8007
8196
|
// Issue #323: a figure without one of the two halves still has the other read; with neither, the SKIP it always was.
|
|
8008
|
-
if (torso.length === 0 && feet.length === 0) return
|
|
8009
|
-
if (torso.length === 0) return oneHalf(inp, isolated, pair, problems, 'feet', feet, noTorso, declared);
|
|
8010
|
-
if (allFeet.length === 0) return oneHalf(inp, isolated, pair, problems, 'torso', torso, noFeet, []);
|
|
8197
|
+
if (torso.length === 0 && feet.length === 0) return skipped(`${noTorso}${declared.length === 0 ? '' : `; ${declared.map((n) => `"${n}"`).join(', ')} declared not planted`}`, 'no-eligible-region');
|
|
8198
|
+
if (torso.length === 0) return oneHalf(inp, isolated, pair, problems, 'feet', feet, noTorso, declared, skipped);
|
|
8199
|
+
if (allFeet.length === 0) return oneHalf(inp, isolated, pair, problems, 'torso', torso, noFeet, [], skipped);
|
|
8011
8200
|
const H = inp.parts.rig_size[1];
|
|
8012
8201
|
const tr = torsoBreath(inp, torso, pair);
|
|
8013
8202
|
const fs = feet.length === 0 ? null : isolated('feet', feet);
|
|
8014
8203
|
const fb = fs === null ? null : frameBox(feet, H, inp.stage, fs.viewport);
|
|
8015
|
-
if ('skip' in tr || (fs !== null && fb === null)) return
|
|
8204
|
+
if ('skip' in tr || (fs !== null && fb === null)) return skipped(`the ${'skip' in tr ? 'torso' : 'feet'} box falls outside the idle frame`, 'no-reading');
|
|
8016
8205
|
const fh = fs === null || fb === null ? null : regionHeat(heatField(fs.frames.map((f) => f.image)), fs.viewport.pixelWidth, fb);
|
|
8017
8206
|
const mean = tr.mean;
|
|
8018
8207
|
const ok = mean >= BREATH_TORSO_MEAN_FLOOR && (fh === null || fh.max <= BREATH_FEET_MAX_CEILING);
|
|
@@ -8044,12 +8233,12 @@ function breathLine(inp: FullInputs, isolated: Isolate, pair: BreathPairRender,
|
|
|
8044
8233
|
* `halves_measured`, says `1 of 2` — after `declared_not_planted` when the scene
|
|
8045
8234
|
* file declares some of the feet read (issue #231), which stays the first.
|
|
8046
8235
|
*/
|
|
8047
|
-
function oneHalf(inp: FullInputs, isolated: Isolate, pair: BreathPairRender, problems: Problem[], half: 'torso' | 'feet', ps: readonly PartRecord[], reason: string, declared: readonly string[]): JudgementLine {
|
|
8236
|
+
function oneHalf(inp: FullInputs, isolated: Isolate, pair: BreathPairRender, problems: Problem[], half: 'torso' | 'feet', ps: readonly PartRecord[], reason: string, declared: readonly string[], skipped: ReadingSkip<'BREATH_VISIBLE'>): JudgementLine {
|
|
8048
8237
|
const H = inp.parts.rig_size[1];
|
|
8049
8238
|
if (half === 'torso') {
|
|
8050
8239
|
// Issue #411: the torso half is the breath alone.
|
|
8051
8240
|
const tr = torsoBreath(inp, ps, pair);
|
|
8052
|
-
if ('skip' in tr) return
|
|
8241
|
+
if ('skip' in tr) return skipped(`the ${half} box falls outside the idle frame, and ${reason}`, 'no-reading');
|
|
8053
8242
|
const mean = tr.mean;
|
|
8054
8243
|
const ok = mean >= BREATH_TORSO_MEAN_FLOOR;
|
|
8055
8244
|
if (!ok) problems.push(torsoProblem(ps, tr, `; the feet half not measured: ${reason}`));
|
|
@@ -8066,7 +8255,7 @@ function oneHalf(inp: FullInputs, isolated: Isolate, pair: BreathPairRender, pro
|
|
|
8066
8255
|
}
|
|
8067
8256
|
const fs = isolated(half, ps);
|
|
8068
8257
|
const box = frameBox(ps, H, inp.stage, fs.viewport);
|
|
8069
|
-
if (box === null) return
|
|
8258
|
+
if (box === null) return skipped(`the ${half} box falls outside the idle frame, and ${reason}`, 'no-reading');
|
|
8070
8259
|
const heat = regionHeat(heatField(fs.frames.map((f) => f.image)), fs.viewport.pixelWidth, box);
|
|
8071
8260
|
const ok = heat.max <= BREATH_FEET_MAX_CEILING;
|
|
8072
8261
|
if (!ok) {
|
|
@@ -8426,9 +8615,9 @@ export function carrierExcitation(rig: Record<string, unknown>, geo: IdleGeometr
|
|
|
8426
8615
|
* with CHECK_CARRIER_NOT_EXCITED; incomplete excitation data keeps the prior
|
|
8427
8616
|
* failure. Below-floor rows retain their policy and name the measured driver.
|
|
8428
8617
|
*/
|
|
8429
|
-
function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems: Problem[], excepted: TipExceptions
|
|
8618
|
+
function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems: Problem[], excepted: TipExceptions, skipped: ReadingSkip<'TIP_OVER_ROOT'>): JudgementLine {
|
|
8430
8619
|
const swing = partsTagged(inp.parts, SWING_TAGS);
|
|
8431
|
-
if (swing.length === 0) return
|
|
8620
|
+
if (swing.length === 0) return skipped(`no part comes from a See-through ${tagWords(SWING_TAGS)} layer, so there is no hem or sleeve to swing`, 'no-swing-parts');
|
|
8432
8621
|
const poses = attachmentPoses(geometryPath, frames);
|
|
8433
8622
|
const idleGeo = readGeometry(geometryPath, frames);
|
|
8434
8623
|
// Issue #231: a part declared `rises` is read up only when the chain carrying it does rise, measured at the setup pose.
|
|
@@ -8528,7 +8717,7 @@ function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems
|
|
|
8528
8717
|
problems.push({
|
|
8529
8718
|
code: 'CHECK_TIP_OVER_ROOT',
|
|
8530
8719
|
object: `part "${p.name}", box ${p.x},${p.y} ${p.w}x${p.h} rig px, posed by the idle's geometry, declared rests${rises ? ' and rises' : ''}`,
|
|
8531
|
-
detail: `${travels} (ratio ${ratio ?? 'undefined: the root does not move'}${inWorld}); the scene file's rests declares its tip at rest, so a ratio <= ${TIP_REST_RATIO_CEILING} is required — the tip swings: the chain's amplitudes grow toward the tip, or the tip of the mesh is weighted to a bone the idle swings`,
|
|
8720
|
+
detail: `${travels} (ratio ${ratio ?? 'undefined: the root does not move'}${inWorld}); the scene file's rests declares its tip at rest, so a ratio <= ${TIP_REST_RATIO_CEILING} is required — the tip swings: the chain's amplitudes grow toward the tip, or the tip of the mesh is weighted to a bone the idle swings; re-check STRESS_OFF_CHAIN after every remedy`,
|
|
8532
8721
|
});
|
|
8533
8722
|
} else if (!ok) {
|
|
8534
8723
|
failed = true;
|
|
@@ -8543,6 +8732,7 @@ function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems
|
|
|
8543
8732
|
const hangName = hang === null ? 'the bone the part hangs from' : `\`${hang}\`, the bone the part hangs from`;
|
|
8544
8733
|
const held = carry === null ? '' : `the root travels with the breath (${round3(t.root)} px of ${round3(carry.breath)} px): it is carried by \`${carry.bone}\`, which moves it more than the tip; with \`${carry.keyed}\`'s translate held still the root travels ${round3(carry.root)} rig px and the tip ${round3(carry.tip)}`;
|
|
8545
8734
|
const heldRatio = carry === null ? '' : `ratio ${carry.root > 0 ? round3(carry.tip / carry.root) : 'undefined: the root moves only with it'}`;
|
|
8735
|
+
const chainRemedy = carry === null || carry.link ? '' : breathingSegmentRemedy(inp.rig, inp.motion, p.name, carry.bone, carry.keyed, hangName);
|
|
8546
8736
|
const why =
|
|
8547
8737
|
carry === null
|
|
8548
8738
|
? `${t.root === 0 && t.tip === 0 && hang !== null ? `nothing in it moves against \`${hang}\`: it rides that bone whole; ` : ''}the chain's amplitudes do not grow toward the tip, or the mesh is not weighted to the chain${offChain === null ? '' : `; ${offChain}`}`
|
|
@@ -8554,7 +8744,7 @@ function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems
|
|
|
8554
8744
|
problems.push({
|
|
8555
8745
|
code: 'CHECK_TIP_OVER_ROOT',
|
|
8556
8746
|
object: `part "${p.name}", box ${p.x},${p.y} ${p.w}x${p.h} rig px, posed by the idle's geometry${rises ? ', declared rises' : ''}`,
|
|
8557
|
-
detail: `${travels} (ratio ${ratio ?? (hang === null ? 'undefined: nothing moves' : `undefined: nothing moves against \`${hang}\``)}${inWorld}); a ratio >= ${TIP_RATIO_FLOOR} is required — ${misplaced ?? why}${rigid && rests ? '; declare it in `not_swinging` if it is meant to ride rigidly' : ''}`,
|
|
8747
|
+
detail: `${travels} (ratio ${ratio ?? (hang === null ? 'undefined: nothing moves' : `undefined: nothing moves against \`${hang}\``)}${inWorld}); a ratio >= ${TIP_RATIO_FLOOR} is required — ${misplaced ?? why}${chainRemedy}${rigid && rests ? '; declare it in `not_swinging` if it is meant to ride rigidly' : ''}; re-check STRESS_OFF_CHAIN after every remedy`,
|
|
8558
8748
|
});
|
|
8559
8749
|
}
|
|
8560
8750
|
}
|
|
@@ -8570,7 +8760,7 @@ function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems
|
|
|
8570
8760
|
const travel = r.travel_floor_rig_px === undefined ? '' : `; root ${String(r.root_rig_px)} rig px, tip ${String(r.tip_rig_px)} rig px, floor ${String(r.travel_floor_rig_px)} rig px; measured driver ${String(r.measured_driver)}`;
|
|
8571
8761
|
return `${String(r.part)}: ${String(r.unmeasured)}${travel}`;
|
|
8572
8762
|
});
|
|
8573
|
-
return {
|
|
8763
|
+
return { ...skipped(`none of ${quoteParts(swing)} could be measured: ${reasons.join('; ')}`, 'no-reading'),
|
|
8574
8764
|
...(belowGrid === 0 ? {} : figures) };
|
|
8575
8765
|
}
|
|
8576
8766
|
return { status: failed ? 'FAIL' : 'PASS', ...figures };
|
|
@@ -8764,6 +8954,33 @@ function breathCarrier(
|
|
|
8764
8954
|
return null;
|
|
8765
8955
|
}
|
|
8766
8956
|
|
|
8957
|
+
/** Issue #1358: options for a breathing mesh carrier below one keyed chain link, without guessing a binding. */
|
|
8958
|
+
function breathingSegmentRemedy(rig: Record<string, unknown>, motion: Record<string, unknown>, part: string, carrier: string, keyed: string, hangName: string): string {
|
|
8959
|
+
const { found, bound } = chainsCarrying(rig, motion, part);
|
|
8960
|
+
if (found.length !== 1) return '';
|
|
8961
|
+
const bones = (Array.isArray(rig.bones) ? rig.bones : []).filter(isRecord);
|
|
8962
|
+
const parent = new Map(bones.filter(b => typeof b.name === 'string').map(b => [String(b.name), typeof b.parent === 'string' ? b.parent : null]));
|
|
8963
|
+
const under = (bone: string, ancestor: string): boolean => {
|
|
8964
|
+
const seen = new Set<string>();
|
|
8965
|
+
for (let at: string | null = bone; at !== null && !seen.has(at); at = parent.get(at) ?? null) {
|
|
8966
|
+
if (at === ancestor) return true;
|
|
8967
|
+
seen.add(at);
|
|
8968
|
+
}
|
|
8969
|
+
return false;
|
|
8970
|
+
};
|
|
8971
|
+
const chain = found[0];
|
|
8972
|
+
const at = chain.findLastIndex(link => under(carrier, link));
|
|
8973
|
+
if (at < 0) return '';
|
|
8974
|
+
const next = chain[at + 1];
|
|
8975
|
+
const after = chain[at + 2];
|
|
8976
|
+
// Name only an existing bound carrier under the immediate next link, never an inferred control-twin mapping.
|
|
8977
|
+
const targets = next === undefined ? [] : [...bound].filter(bone => bone !== carrier && under(bone, next) && (after === undefined || !under(bone, after)));
|
|
8978
|
+
const rebind = targets.length === 1
|
|
8979
|
+
? `try rebinding the lower segment on \`${carrier}\` to its existing carrier \`${targets[0]}\` under the next keyed link \`${next}\`, or `
|
|
8980
|
+
: '';
|
|
8981
|
+
return `; this breathing carrier is inside the keyed chain: binding it to ${hangName} can fail STRESS_OFF_CHAIN while passing TIP_OVER_ROOT; ${rebind}try moving \`${keyed}\`'s translate to ${hangName} or an ancestor; these options must be measured on this rig`;
|
|
8982
|
+
}
|
|
8983
|
+
|
|
8767
8984
|
/** A bone at the setup pose off the idle's geometry: its world origin, and its world x axis (a, c) when the file gives it. */
|
|
8768
8985
|
export interface SetupBone {
|
|
8769
8986
|
x: number;
|
|
@@ -9005,12 +9222,13 @@ interface StillHalf {
|
|
|
9005
9222
|
* features go; `footwear` on top) is reported per slot, `crossing`, with no
|
|
9006
9223
|
* bar ({@link crossingOf}). No render grid enters either half.
|
|
9007
9224
|
*/
|
|
9008
|
-
export function stillLine(inp: FullInputs, idle: FrameSet, geo: IdleGeometry | null, geometryPath: string, problems: Problem[], notPlanted: readonly string[] = []): JudgementLine {
|
|
9225
|
+
export function stillLine(inp: FullInputs, idle: FrameSet, geo: IdleGeometry | null, geometryPath: string, problems: Problem[], notPlanted: readonly string[] = [], skipped: ReadingSkip<'STILL_REGIONS_DARK'> = skip): JudgementLine {
|
|
9009
9226
|
const slotParts = checkSlotParts(inp.rig, inp.parts.parts.map(p => p.name), inp.parts.alternates?.map(set => set.name) ?? []);
|
|
9010
9227
|
const face = partsTagged(inp.parts, FACE_TAGS);
|
|
9011
9228
|
const { all: allFeet, held: feet, declared } = plantedFeet(inp.parts, notPlanted);
|
|
9012
|
-
|
|
9013
|
-
if (
|
|
9229
|
+
const eligible = face.length > 0 || feet.length > 0;
|
|
9230
|
+
if (face.length === 0 && allFeet.length === 0) return skipped(`no part comes from a See-through ${tagWords([...FACE_TAGS, ...FEET_TAGS])} layer, so there is no still region to read`, 'no-eligible-region');
|
|
9231
|
+
if (geo === null) return skipped(`${geometryPath} does not exist; \`rigc render --geometry\` (rig-c ${RIGC_GEOMETRY_VERSION} or later) writes it, and the still regions are read off it`, eligible ? 'no-reading' : 'no-eligible-region');
|
|
9014
9232
|
const H = inp.parts.rig_size[1];
|
|
9015
9233
|
const W = inp.parts.rig_size[0];
|
|
9016
9234
|
const poses = attachmentPoses(geometryPath, idle.written);
|
|
@@ -9166,7 +9384,7 @@ export function stillLine(inp: FullInputs, idle: FrameSet, geo: IdleGeometry | n
|
|
|
9166
9384
|
|
|
9167
9385
|
const f = faceHalf();
|
|
9168
9386
|
const t = feetHalf();
|
|
9169
|
-
if (typeof f === 'string' && typeof t === 'string') return
|
|
9387
|
+
if (typeof f === 'string' && typeof t === 'string') return skipped(`face: ${f}; feet: ${t}`, eligible ? 'no-reading' : 'no-eligible-region');
|
|
9170
9388
|
const failed = problems.some((q) => q.code === 'CHECK_STILL_REGIONS_DARK');
|
|
9171
9389
|
// Issue #231: a declaration is the feet half's first figure, measured or not.
|
|
9172
9390
|
const said = declared.length === 0 ? {} : { declared_not_planted: declared };
|
|
@@ -9690,9 +9908,9 @@ export function edgeBonesText(rig: Record<string, unknown>, motion: Record<strin
|
|
|
9690
9908
|
* bones its two vertices hang on and their chains ({@link edgeBonesText}, issue
|
|
9691
9909
|
* #314).
|
|
9692
9910
|
*/
|
|
9693
|
-
export function stretchLine(geo: IdleGeometry | null, path: string, problems: Problem[], bound?: Pick<CheckInputs, 'rig' | 'motion'> & WeightStepContext, slotParts?: ReadonlyMap<string, string>): JudgementLine {
|
|
9694
|
-
if (geo === null) return
|
|
9695
|
-
if (geo.meshes.length === 0) return
|
|
9911
|
+
export function stretchLine(geo: IdleGeometry | null, path: string, problems: Problem[], bound?: Pick<CheckInputs, 'rig' | 'motion'> & WeightStepContext, slotParts?: ReadonlyMap<string, string>, skipped: ReadingSkip<'TEXTURE_STRETCH'> = skip): JudgementLine {
|
|
9912
|
+
if (geo === null) return skipped(`${path} does not exist; \`rigc render --geometry\` (rig-c ${RIGC_GEOMETRY_VERSION} or later) writes it, and the skinned mesh vertices are read from it`, 'no-reading');
|
|
9913
|
+
if (geo.meshes.length === 0) return skipped('the rig draws no mesh attachment (every slot is a region), so there is no triangle to stretch', 'no-meshes');
|
|
9696
9914
|
const figures = stretchFigures(geo.meshes, geo.frames);
|
|
9697
9915
|
const rows: Array<Record<string, unknown>> = [];
|
|
9698
9916
|
let worst: { mesh: (typeof figures)[number]; at: NonNullable<(typeof figures)[number]['max']>; severity: number } | null = null;
|
|
@@ -9730,7 +9948,7 @@ export function stretchLine(geo: IdleGeometry | null, path: string, problems: Pr
|
|
|
9730
9948
|
});
|
|
9731
9949
|
}
|
|
9732
9950
|
}
|
|
9733
|
-
if (worst === null) return
|
|
9951
|
+
if (worst === null) return skipped(`no idle frame shows any of the rig's ${figures.length} mesh(es): ${figures.map((m) => `"${m.slot}"`).join(', ')}`, 'no-visible-meshes');
|
|
9734
9952
|
return {
|
|
9735
9953
|
status: failed ? 'FAIL' : 'PASS',
|
|
9736
9954
|
meshes: figures.length,
|