@rig-c/parts 2.44.0 → 2.46.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 +142 -33
- package/docs/AUTHORING.md +441 -100
- package/docs/DEPTH.md +33 -6
- package/docs/MIGRATION.md +2 -0
- package/docs/STABILITY.md +405 -51
- package/package.json +5 -1
- package/src/assemble.ts +7 -2
- package/src/assembly-reading.ts +267 -0
- package/src/boundarydepth.ts +113 -0
- package/src/build.ts +27 -13
- package/src/check.ts +305 -81
- package/src/cloth.ts +14 -3
- package/src/config.ts +78 -11
- package/src/configrelocation.ts +48 -2
- package/src/configwrite.ts +9 -7
- 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 +48 -11
- package/src/plate.ts +2 -6
- package/src/propose.ts +169 -12
- 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/scene.ts +45 -9
- package/src/sceneclips.ts +60 -1
- package/src/turn.ts +24 -3
- package/tools/configwrite.ts +22 -14
- package/tools/edited-part-cli.ts +28 -8
- package/tools/neck-propose.ts +2 -0
package/src/check.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { refuseStaleAssembly, type AssemblyRules } from './assembly-reading.ts';
|
|
1
2
|
import { checkRow, checkSlotRow, checkSlotParts, serializeCheckRows } from './checkrow.ts';
|
|
2
3
|
import { readSetupFigureMask } from './setupfiguremask.ts';
|
|
3
4
|
import { readSetupBackdrop } from './setupbackdrop.ts';
|
|
@@ -47,9 +48,9 @@ import { baseAnchorMoves, type AnchorRegion } from './baseanchor.ts';
|
|
|
47
48
|
* | `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
49
|
* | `contact.png` | rigc's own contact sheet of that render, copied out |
|
|
49
50
|
* | `motion_heat.png` | frame 0 in grey with each pixel's largest change across the idle in red |
|
|
50
|
-
* | `extremes/<
|
|
51
|
+
* | `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
52
|
* | `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}) |
|
|
53
|
+
* | `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
54
|
*
|
|
54
55
|
* The acceptance bars are the reference implementation's (`check_rig.py`):
|
|
55
56
|
* both gate summaries `0 failed`; seam mean |d| <= 1.0 of 255 and at most 50
|
|
@@ -96,6 +97,7 @@ import { createRequire } from 'node:module';
|
|
|
96
97
|
import type { Candidate, Piece, Viewport as RootCoverageViewport } from '@rig-c/core/render-shared';
|
|
97
98
|
import { fillHoles } from './raster/morph.ts';
|
|
98
99
|
import { copyFileSync, cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
100
|
+
import { diagnosticSegment, diagnosticSiblings } from './outputpaths.ts';
|
|
99
101
|
import { basename, delimiter, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
100
102
|
import { measureRecomposite, type RecompositeFigures, recompositeRecord, scenePhrase, sourceInRig, figureSilhouette } from './assemble.ts';
|
|
101
103
|
import { type BoneTransform, computeExactFrameTransforms, cropToSpineY, normaliseDegrees, toBoneLocal } from './coords.ts';
|
|
@@ -1062,6 +1064,44 @@ function sidecarProblem(object: string, detail: string): never {
|
|
|
1062
1064
|
throw new Error('unreachable');
|
|
1063
1065
|
}
|
|
1064
1066
|
|
|
1067
|
+
/** Read and validate a complete retained sibling scope without touching outputs. */
|
|
1068
|
+
function retainedCheckRenderPlan(source: string) {
|
|
1069
|
+
const index = join(source, 'frames.json');
|
|
1070
|
+
const bytes = readFileSync(index, 'utf8');
|
|
1071
|
+
const raw: unknown = JSON.parse(bytes);
|
|
1072
|
+
if (!isRecord(raw) || !Array.isArray(raw.sets)) return sidecarProblem(index, 'requires a frames.json sets array to retain a render');
|
|
1073
|
+
const seen = new Set<string>();
|
|
1074
|
+
const sourceDirs: string[] = [];
|
|
1075
|
+
const names: Array<{ name: string; suffix?: string }> = [];
|
|
1076
|
+
const sets = raw.sets.map((set: unknown) => {
|
|
1077
|
+
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');
|
|
1078
|
+
// One render samples every set at the same rate. Preserve the rate suffix
|
|
1079
|
+
// on ordinary safe names, but never infer a public name from that suffix.
|
|
1080
|
+
const suffix = typeof set.fps === 'number' && set.fps !== IDLE_FPS ? `@${set.fps}fps` : '';
|
|
1081
|
+
const dir = typeof set.animation === 'string' ? diagnosticSegment(set.animation, suffix) : diagnosticSegment(set.dir);
|
|
1082
|
+
if (seen.has(dir)) return sidecarProblem(index, `retained set directory ${JSON.stringify(dir)} is repeated`);
|
|
1083
|
+
seen.add(dir);
|
|
1084
|
+
sourceDirs.push(set.dir);
|
|
1085
|
+
names.push(typeof set.animation === 'string' ? { name: set.animation, suffix } : { name: set.dir });
|
|
1086
|
+
return { ...set, dir };
|
|
1087
|
+
});
|
|
1088
|
+
diagnosticSiblings(names, 'retained render sets');
|
|
1089
|
+
return { bytes, raw, sets, sourceDirs };
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/** Copy a retained render and bind its index to portable set directories. */
|
|
1093
|
+
export function retainCheckRender(source: string, target: string): void {
|
|
1094
|
+
const { bytes, raw, sets, sourceDirs } = retainedCheckRenderPlan(source);
|
|
1095
|
+
mkdirSync(target, { recursive: true });
|
|
1096
|
+
// Root sidecars and set-local filenames are fixed renderer protocol names.
|
|
1097
|
+
for (const entry of readdirSync(source, { withFileTypes: true })) {
|
|
1098
|
+
if (entry.isFile() && entry.name !== 'frames.json') copyFileSync(join(source, entry.name), join(target, entry.name));
|
|
1099
|
+
}
|
|
1100
|
+
sourceDirs.forEach((dir, i) => cpSync(join(source, dir), join(target, sets[i].dir), { recursive: true }));
|
|
1101
|
+
const changed = sets.some((set, i) => set.dir !== sourceDirs[i]);
|
|
1102
|
+
writeFileSync(join(target, 'frames.json'), changed ? JSON.stringify({ ...raw, sets }, null, 2) + '\n' : bytes);
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1065
1105
|
/**
|
|
1066
1106
|
* A frame set as `rigc render` wrote it: either the `--out` directory
|
|
1067
1107
|
* (`frames.json` plus one set directory) or a set directory whose parent holds
|
|
@@ -2502,7 +2542,7 @@ function seamPairRowsFrom(seam: SeamFigures, parts: readonly PlacedAlpha[], rigS
|
|
|
2502
2542
|
return sorted.map((acc, i) => {
|
|
2503
2543
|
// A part over no other art is named first, then SEAM_NO_ART.
|
|
2504
2544
|
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
|
|
2545
|
+
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
2546
|
const subjects = pair.filter(p => p !== SEAM_NO_ART);
|
|
2507
2547
|
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
2548
|
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 +2756,19 @@ export type ReportedLine = { status: 'REPORTED'; [figure: string]: unknown } | {
|
|
|
2716
2756
|
/** The reported lines, after the judgement lines, in the order check.json and the console carry them. */
|
|
2717
2757
|
export const REPORTED_LINES = ['RECOMPOSITE_HOLES'] as const;
|
|
2718
2758
|
|
|
2719
|
-
|
|
2759
|
+
export const CHECK_SPEC = 'rig-parts-check/1';
|
|
2760
|
+
|
|
2761
|
+
/** The primary packed model document `check` read (`check/build/skeleton.model.json`). */
|
|
2762
|
+
export interface CheckBuildRecord {
|
|
2763
|
+
model_sha256: string;
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
/** The completed check.json, with its version, bar outcomes and build identity first and PASS last. */
|
|
2720
2767
|
export interface CheckFigures {
|
|
2768
|
+
spec: typeof CHECK_SPEC;
|
|
2769
|
+
bar_outcomes: CheckBarOutcomes;
|
|
2770
|
+
/** The primary `check/build/skeleton.model.json` `check` read (issue #1378): provenance, not a bar. */
|
|
2771
|
+
build: CheckBuildRecord;
|
|
2721
2772
|
gate_spine_html_green: boolean;
|
|
2722
2773
|
/** Which rigc entry gated the build ({@link readRigcEntry}): provenance, not a bar. */
|
|
2723
2774
|
rigc_entry: RigcEntryRecord;
|
|
@@ -3043,6 +3094,117 @@ export const MOTION_SEAM_LINE = 'SEAM_OVER_MOTION';
|
|
|
3043
3094
|
*/
|
|
3044
3095
|
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
3096
|
|
|
3097
|
+
function checkBarIds() {
|
|
3098
|
+
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;
|
|
3099
|
+
}
|
|
3100
|
+
export type CheckBarId = ReturnType<typeof checkBarIds>[number];
|
|
3101
|
+
|
|
3102
|
+
/** Reading-level reasons recorded where the legacy judgement chooses to skip. */
|
|
3103
|
+
export interface CheckBarSkipReasons {
|
|
3104
|
+
BREATH_VISIBLE?: 'no-eligible-region' | 'no-reading';
|
|
3105
|
+
BLINK_NO_HOLE?: 'no-eye-parts' | 'no-blink-track' | 'no-reading';
|
|
3106
|
+
TIP_OVER_ROOT?: 'no-swing-parts' | 'no-reading';
|
|
3107
|
+
STILL_REGIONS_DARK?: 'no-eligible-region' | 'no-reading';
|
|
3108
|
+
TEXTURE_STRETCH?: 'no-reading' | 'no-meshes' | 'no-visible-meshes';
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3111
|
+
export type CheckBarSkipReason = NonNullable<CheckBarSkipReasons[keyof CheckBarSkipReasons]>
|
|
3112
|
+
| 'no-idle' | 'no-parts' | 'no-comparable-tracks' | 'no-animation' | 'no-hanging-footwear' | 'no-posed-footwear'
|
|
3113
|
+
| 'no-handwear' | 'no-readable-binding' | 'no-limb-segments' | 'no-joint-range' | 'undeclared' | 'no-limit'
|
|
3114
|
+
| 'no-complete-threshold-reading' | 'no-root-gate' | 'no-complete-root-reading';
|
|
3115
|
+
|
|
3116
|
+
export type CheckBarOutcome = { status: 'PASS' | 'FAIL' } | { status: 'SKIP'; reason: CheckBarSkipReason };
|
|
3117
|
+
export type CheckBarOutcomes = Record<CheckBarId, CheckBarOutcome>;
|
|
3118
|
+
|
|
3119
|
+
function lineStatus(line: unknown): unknown {
|
|
3120
|
+
return typeof line === 'object' && line !== null ? (line as { status?: unknown }).status : undefined;
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
function seamFigureFailed(fig: Readonly<Record<string, unknown>>): boolean {
|
|
3124
|
+
// A check.json written before issue #216 used frame pixels, so absent scale means 1.
|
|
3125
|
+
return typeof fig.seam_mean === 'number' && typeof fig.seam_px_over_40 === 'number'
|
|
3126
|
+
&& seamFails(fig.seam_mean, fig.seam_px_over_40, typeof fig.seam_frame_scale === 'number' ? fig.seam_frame_scale : 1);
|
|
3127
|
+
}
|
|
3128
|
+
|
|
3129
|
+
/** Classify the legacy figures once for both the legacy and versioned views. */
|
|
3130
|
+
function checkBarStatus(fig: Readonly<Record<string, unknown>>, id: CheckBarId): CheckBarOutcome['status'] {
|
|
3131
|
+
switch (id) {
|
|
3132
|
+
case 'gate':
|
|
3133
|
+
return fig.gate_spine_html_green === true ? 'PASS' : 'FAIL';
|
|
3134
|
+
case 'loop':
|
|
3135
|
+
return typeof fig.loop_max_diff !== 'number' ? 'SKIP' : fig.loop_max_diff === LOOP_MAX_BAR ? 'PASS' : 'FAIL';
|
|
3136
|
+
case 'seam':
|
|
3137
|
+
if (seamFigureFailed(fig) || (isRecord(fig.sets) && Object.values(fig.sets).some(s => isRecord(s) && seamFigureFailed(s)))) return 'FAIL';
|
|
3138
|
+
return typeof fig.seam_mean === 'number' ? 'PASS' : 'SKIP';
|
|
3139
|
+
case MOTION_SEAM_LINE: {
|
|
3140
|
+
const motion = fig[id];
|
|
3141
|
+
if (!isRecord(motion)) return 'SKIP';
|
|
3142
|
+
const root = isRecord(motion.roots) ? motion.roots.status : undefined;
|
|
3143
|
+
const required = isRecord(motion.required) ? motion.required.status : undefined;
|
|
3144
|
+
if (root === 'FAIL' || required === 'FAIL') return 'FAIL';
|
|
3145
|
+
return required === 'PASS' || (motion.required === undefined && root === 'PASS') ? 'PASS' : 'SKIP';
|
|
3146
|
+
}
|
|
3147
|
+
default: {
|
|
3148
|
+
const status = lineStatus(fig[id]);
|
|
3149
|
+
return status === 'PASS' || status === 'FAIL' ? status : 'SKIP';
|
|
3150
|
+
}
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
|
|
3154
|
+
function checkBarSkipReason(fig: Readonly<Record<string, unknown>>, id: Exclude<CheckBarId, 'gate'>, readings: CheckBarSkipReasons): CheckBarSkipReason {
|
|
3155
|
+
const hasIdle = typeof fig.loop_max_diff === 'number';
|
|
3156
|
+
const hasParts = typeof fig.seam_mean === 'number';
|
|
3157
|
+
const hasAnimation = fig[FOLD_LINE] !== undefined;
|
|
3158
|
+
switch (id) {
|
|
3159
|
+
case 'loop': return 'no-idle';
|
|
3160
|
+
case 'seam': return 'no-parts';
|
|
3161
|
+
case 'BREATH_VISIBLE':
|
|
3162
|
+
case 'BLINK_NO_HOLE':
|
|
3163
|
+
case 'TIP_OVER_ROOT':
|
|
3164
|
+
case 'STILL_REGIONS_DARK':
|
|
3165
|
+
if (!hasIdle) return 'no-idle';
|
|
3166
|
+
if (!hasParts) return 'no-parts';
|
|
3167
|
+
break;
|
|
3168
|
+
case 'TEXTURE_STRETCH':
|
|
3169
|
+
if (!hasIdle) return 'no-idle';
|
|
3170
|
+
break;
|
|
3171
|
+
case 'CHAIN_LAG': return hasIdle ? 'no-comparable-tracks' : 'no-idle';
|
|
3172
|
+
case FOLD_LINE: return 'no-animation';
|
|
3173
|
+
case LEVEL_LINE: return !hasAnimation ? 'no-animation' : !hasParts ? 'no-parts' : fig[id] === undefined ? 'no-hanging-footwear' : 'no-posed-footwear';
|
|
3174
|
+
case STRESS_LINE: return !hasIdle ? 'no-idle' : !hasParts ? 'no-parts' : fig[id] === undefined ? 'no-handwear' : 'no-readable-binding';
|
|
3175
|
+
case LIMB_LINE: return hasParts ? 'no-limb-segments' : 'no-parts';
|
|
3176
|
+
case SWEEP_LINE: return hasParts ? 'no-joint-range' : 'no-parts';
|
|
3177
|
+
case ART_JOINT_LINE: return fig[id] === undefined ? 'undeclared' : 'no-limit';
|
|
3178
|
+
case CUT_MATERIAL_LINE:
|
|
3179
|
+
case BOUNDARY_COLOUR_LINE:
|
|
3180
|
+
return 'undeclared';
|
|
3181
|
+
case SETUP_PAINTING_LINE: {
|
|
3182
|
+
const painting = fig[id];
|
|
3183
|
+
return isRecord(painting) && 'regions' in painting ? 'no-limit' : 'undeclared';
|
|
3184
|
+
}
|
|
3185
|
+
case BEHIND_SEAM_LINE: return fig[id] === undefined ? 'undeclared' : 'no-complete-threshold-reading';
|
|
3186
|
+
case MOTION_SEAM_LINE: {
|
|
3187
|
+
const motion = fig[id];
|
|
3188
|
+
if (!isRecord(motion) || !isRecord(motion.roots)) return 'no-root-gate';
|
|
3189
|
+
return Array.isArray(motion.animations) && motion.animations.length === 0 ? 'no-animation' : 'no-complete-root-reading';
|
|
3190
|
+
}
|
|
3191
|
+
}
|
|
3192
|
+
const reason = readings[id];
|
|
3193
|
+
if (reason === undefined) throw new Error(`check bar ${id} skipped without a reading-level reason`);
|
|
3194
|
+
return reason;
|
|
3195
|
+
}
|
|
3196
|
+
|
|
3197
|
+
/** The ordered producer view. A degenerate rest edge can fail stretch even when no ratio was read. */
|
|
3198
|
+
export function checkBarOutcomes(fig: Readonly<Record<string, unknown>>, skipReasons: CheckBarSkipReasons, stretchFailedWithoutReading = false): CheckBarOutcomes {
|
|
3199
|
+
return Object.fromEntries(checkBarIds().map(id => {
|
|
3200
|
+
const status = id === 'TEXTURE_STRETCH' && stretchFailedWithoutReading ? 'FAIL' : checkBarStatus(fig, id);
|
|
3201
|
+
const outcome: CheckBarOutcome = status === 'SKIP' && id !== 'gate'
|
|
3202
|
+
? { status, reason: checkBarSkipReason(fig, id, skipReasons) }
|
|
3203
|
+
: { status: status === 'SKIP' ? 'FAIL' : status };
|
|
3204
|
+
return [id, outcome];
|
|
3205
|
+
})) as CheckBarOutcomes;
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3046
3208
|
/**
|
|
3047
3209
|
* The bars a `check.json`, as `check` writes it, says were not met, in
|
|
3048
3210
|
* {@link BARS} order: the gate when `gate_spine_html_green` is not true, the
|
|
@@ -3055,22 +3217,7 @@ export const ACCEPTABLE_BARS: readonly string[] = [...BARS.filter((b) => b !== '
|
|
|
3055
3217
|
* all a finished build leaves (issue #203).
|
|
3056
3218
|
*/
|
|
3057
3219
|
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;
|
|
3220
|
+
return checkBarIds().filter(id => id !== SETUP_PAINTING_LINE && checkBarStatus(fig, id) === 'FAIL');
|
|
3074
3221
|
}
|
|
3075
3222
|
|
|
3076
3223
|
/** 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 +3321,9 @@ export type CheckStatus = 'PASS' | 'FAIL' | 'SKIP' | 'WARN' | 'CLEAR' | 'REPORTE
|
|
|
3174
3321
|
* {@link SWEEP_LINE}, {@link MOTION_SEAM_LINE}, {@link CLOTH_LINE}, the reported lines, {@link SOURCE_LINE} and
|
|
3175
3322
|
* {@link WIND_BAND_LINE}, each where the file writes it. The `requirements` block's lines are not bars and are not read here.
|
|
3176
3323
|
*/
|
|
3177
|
-
export function checkStatuses(fig: CheckFigures): Record<string, CheckStatus> {
|
|
3178
|
-
const
|
|
3179
|
-
const bar = (
|
|
3324
|
+
export function checkStatuses(fig: Omit<CheckFigures, 'spec' | 'bar_outcomes' | 'build'>): Record<string, CheckStatus> {
|
|
3325
|
+
const raw = fig as unknown as Record<string, unknown>;
|
|
3326
|
+
const bar = (id: 'gate' | 'loop' | 'seam', measured: boolean): CheckStatus => (!measured ? 'SKIP' : checkBarStatus(raw, id) === 'FAIL' ? 'FAIL' : 'PASS');
|
|
3180
3327
|
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
3328
|
for (const n of JUDGEMENT_LINES) out[n] = fig[n].status;
|
|
3182
3329
|
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 +5288,7 @@ export function publishMotionSeamWorlds(out: string, scratch: string, worlds: Mo
|
|
|
5141
5288
|
}
|
|
5142
5289
|
}
|
|
5143
5290
|
refuseIfAny(problems);
|
|
5291
|
+
for (const name of names) retainedCheckRenderPlan(join(scratch, name));
|
|
5144
5292
|
const stage = join(scratch, '_publish');
|
|
5145
5293
|
const previous = join(scratch, '_previous');
|
|
5146
5294
|
const kept = join(out, MOTION_SEAM_DIR);
|
|
@@ -5148,7 +5296,7 @@ export function publishMotionSeamWorlds(out: string, scratch: string, worlds: Mo
|
|
|
5148
5296
|
const previousCheck = existsSync(check) ? readFileSync(check) : null;
|
|
5149
5297
|
mkdirSync(out, { recursive: true });
|
|
5150
5298
|
mkdirSync(stage, { recursive: true });
|
|
5151
|
-
for (const name of names)
|
|
5299
|
+
for (const name of names) retainCheckRender(join(scratch, name), join(stage, name));
|
|
5152
5300
|
const hadPrevious = existsSync(kept);
|
|
5153
5301
|
if (hadPrevious) renameSync(kept, previous);
|
|
5154
5302
|
try {
|
|
@@ -6571,6 +6719,7 @@ export function windBandLines(line: WindBandLine, plant: WindBandPlant = {}): st
|
|
|
6571
6719
|
*/
|
|
6572
6720
|
function renderExtremes(build: string, out: string, animations: readonly string[], frames: unknown, frameSets: unknown, render: RigcRunner): string[] {
|
|
6573
6721
|
if (animations.length === 0) return ['EXTREMES SKIP: CHECK_EXTREMES_NO_ANIMATIONS — no animation in motion.json'];
|
|
6722
|
+
diagnosticSiblings(animations.map(name => ({ name })), 'extremes');
|
|
6574
6723
|
const scratch = join(out, '_extremes');
|
|
6575
6724
|
const dest = join(out, 'extremes');
|
|
6576
6725
|
try {
|
|
@@ -6585,6 +6734,7 @@ function renderExtremes(build: string, out: string, animations: readonly string[
|
|
|
6585
6734
|
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
6735
|
const lines: string[] = [];
|
|
6587
6736
|
for (const animation of animations) {
|
|
6737
|
+
const target = join(dest, diagnosticSegment(animation));
|
|
6588
6738
|
const rendered = join(scratch, 'render');
|
|
6589
6739
|
const call = render(['render', '--candidate', build, '--animation', animation, '--fps', String(IDLE_FPS), '--viewport-from', grid, '--extremes-only', '--out', rendered]);
|
|
6590
6740
|
if (call.status !== 0) throw new Error(`render --extremes-only ${JSON.stringify(animation)} exited ${call.status}: ${call.out.trim()}${rigcRanClause(call)}`);
|
|
@@ -6595,7 +6745,7 @@ function renderExtremes(build: string, out: string, animations: readonly string[
|
|
|
6595
6745
|
const sets = isRecord(frameSets) && Array.isArray(frameSets.sets) ? frameSets.sets.filter(isRecord).filter(row => row.animation === animation) : [];
|
|
6596
6746
|
const dir = sets.length === 1 ? sets[0].dir : undefined;
|
|
6597
6747
|
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)
|
|
6748
|
+
const source = join(rendered, dir);
|
|
6599
6749
|
const observation: unknown = JSON.parse(readFileSync(join(source, 'extremes.json'), 'utf8'));
|
|
6600
6750
|
if (!isRecord(observation) || observation.animation !== animation) throw new Error(`render --extremes-only has no set for ${JSON.stringify(animation)}`);
|
|
6601
6751
|
mkdirSync(target, { recursive: true });
|
|
@@ -6606,9 +6756,10 @@ function renderExtremes(build: string, out: string, animations: readonly string[
|
|
|
6606
6756
|
}
|
|
6607
6757
|
return lines;
|
|
6608
6758
|
} catch (err) {
|
|
6609
|
-
//
|
|
6610
|
-
//
|
|
6759
|
+
// Invalid destination names are input refusals. Other diagnostic failures
|
|
6760
|
+
// leave the measured bars unchanged and mark the observation unavailable.
|
|
6611
6761
|
rmSync(dest, { recursive: true, force: true });
|
|
6762
|
+
if (err instanceof PartsError && err.problems.some(problem => problem.code === 'DIAGNOSTIC_PATH_SEGMENT')) throw err;
|
|
6612
6763
|
return [`EXTREMES SKIP: CHECK_EXTREMES_RENDER_FAILED — ${err instanceof Error ? err.message : String(err)}`];
|
|
6613
6764
|
} finally {
|
|
6614
6765
|
rmSync(scratch, { recursive: true, force: true });
|
|
@@ -6641,7 +6792,7 @@ function renderExtremes(build: string, out: string, animations: readonly string[
|
|
|
6641
6792
|
* MEASURABLE is a problem. Without it nothing here reads, writes or prints
|
|
6642
6793
|
* anything it did not before.
|
|
6643
6794
|
*/
|
|
6644
|
-
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): CheckReport {
|
|
6795
|
+
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 {
|
|
6645
6796
|
const pageSize = parsePageSize(mode.pageSize);
|
|
6646
6797
|
let inp: CheckInputs;
|
|
6647
6798
|
let reqFile: RequirementsFile | null = null;
|
|
@@ -6658,6 +6809,11 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6658
6809
|
return null;
|
|
6659
6810
|
}
|
|
6660
6811
|
};
|
|
6812
|
+
const readInputs = (): CheckInputs => {
|
|
6813
|
+
const inputs = readCheckInputs(rigDir, partsHome, source, set, allSets);
|
|
6814
|
+
if (config !== undefined && inputs.parts !== null) refuseStaleAssembly(config.path, inputs.parts, undefined, assemblyRules);
|
|
6815
|
+
return inputs;
|
|
6816
|
+
};
|
|
6661
6817
|
let setupBackdrop: Raster | undefined;
|
|
6662
6818
|
let setupFigureMask: Uint8Array | undefined;
|
|
6663
6819
|
// Issue #538: the schedule is read once, first, by rigc's own reader; refused, nothing is built or written.
|
|
@@ -6665,12 +6821,12 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6665
6821
|
// Issue #590: the steady-wind band spec is read and resolved before anything is built or written.
|
|
6666
6822
|
const wb = windBand === undefined ? null : take(() => readWindBand(windBand));
|
|
6667
6823
|
if (requirements === undefined) {
|
|
6668
|
-
const got = take(
|
|
6824
|
+
const got = take(readInputs);
|
|
6669
6825
|
if (got !== null && wb !== null) take(() => resolveWindBand(wb, got));
|
|
6670
6826
|
refuseIfAny(refused);
|
|
6671
6827
|
inp = got as CheckInputs;
|
|
6672
6828
|
} else {
|
|
6673
|
-
const got = take(
|
|
6829
|
+
const got = take(readInputs);
|
|
6674
6830
|
reqFile = take(() => readRequirements(requirements));
|
|
6675
6831
|
if (got === null || reqFile === null) {
|
|
6676
6832
|
if (got !== null && wb !== null) take(() => resolveWindBand(wb, got));
|
|
@@ -6716,6 +6872,10 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6716
6872
|
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
6873
|
const cutMaterialProblems: Problem[] = [];
|
|
6718
6874
|
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));
|
|
6875
|
+
const animationNames = isRecord(inp.motion.animations) ? Object.keys(inp.motion.animations) : [];
|
|
6876
|
+
const selectedAlts = inp.parts === null || (set === undefined && !allSets) ? []
|
|
6877
|
+
: allSets ? inp.parts.alternates ?? [] : (inp.parts.alternates ?? []).filter(alt => alt.name === set);
|
|
6878
|
+
preflightCheckPaths(animationNames, selectedAlts.map(alt => alt.name), reqFile, noExtremes);
|
|
6719
6879
|
// A measured material failure is a check bar; unavailable data is a refusal.
|
|
6720
6880
|
const rigcEntry = readRigcEntry(requireRigcVersion(rigc));
|
|
6721
6881
|
/**
|
|
@@ -6764,6 +6924,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6764
6924
|
const pack = parsePackLines(gateHtml);
|
|
6765
6925
|
refuseIfAny(packEdgeProblems(pack, mode));
|
|
6766
6926
|
const packOpaque = pack.filter((p) => existsSync(join(buildDir, p.page))).map((p) => ({ page: p.page, share: opaqueShare(readPng(join(buildDir, p.page))) }));
|
|
6927
|
+
const modelSha256 = createHash('sha256').update(readFileSync(join(buildDir, 'skeleton.model.json'))).digest('hex');
|
|
6767
6928
|
|
|
6768
6929
|
// 2. no second gate: `rigc validate --profile spine` of this build measured no rule the build's own two passes
|
|
6769
6930
|
// 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 +6935,11 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6774
6935
|
const full: FullInputs | null = inp.parts !== null && inp.idleDuration !== null ? { ...inp, parts: inp.parts, idleDuration: inp.idleDuration } : null;
|
|
6775
6936
|
const lacking = [inp.noParts, inp.noIdle].filter((r): r is string => r !== null).join('; ');
|
|
6776
6937
|
const problems: Problem[] = [];
|
|
6938
|
+
const skipReasons: CheckBarSkipReasons = {};
|
|
6939
|
+
const readingSkip = <Id extends keyof CheckBarSkipReasons>(id: Id): ReadingSkip<Id> => (reason, code) => {
|
|
6940
|
+
skipReasons[id] = code;
|
|
6941
|
+
return skip(reason);
|
|
6942
|
+
};
|
|
6777
6943
|
|
|
6778
6944
|
// 3. the idle, the loop, the heat — only when there is an idle
|
|
6779
6945
|
let idle: FrameSet | null = null;
|
|
@@ -6796,7 +6962,6 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6796
6962
|
keyed = join(loopDir, 'build');
|
|
6797
6963
|
return keyed;
|
|
6798
6964
|
};
|
|
6799
|
-
const animationNames = isRecord(inp.motion.animations) ? Object.keys(inp.motion.animations) : [];
|
|
6800
6965
|
const named = animationNames.filter((n) => n !== 'idle');
|
|
6801
6966
|
// Issue #590: steady-wind seam band sweep, only under --wind-band; run before idle/still renders so a refusal
|
|
6802
6967
|
// on an unbanded pair writes nothing.
|
|
@@ -7003,14 +7168,15 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7003
7168
|
let tip: JudgementLine = skip(lacking);
|
|
7004
7169
|
if (full !== null) {
|
|
7005
7170
|
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 });
|
|
7171
|
+
breath = breathLine(full, isolated, breathPair, problems, notPlanted, readingSkip('BREATH_VISIBLE'));
|
|
7172
|
+
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
7173
|
} finally {
|
|
7009
7174
|
rmSync(isoDir, { recursive: true, force: true });
|
|
7010
7175
|
}
|
|
7011
7176
|
}
|
|
7012
7177
|
let chain: JudgementLine = skip(inp.noIdle ?? '');
|
|
7013
7178
|
let stretch: JudgementLine = skip(inp.noIdle ?? '');
|
|
7179
|
+
let stretchFailedWithoutReading = false;
|
|
7014
7180
|
let still: JudgementLine = skip(lacking);
|
|
7015
7181
|
let idleGeometry: IdleGeometry | null = null;
|
|
7016
7182
|
if (idle !== null) {
|
|
@@ -7019,8 +7185,10 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7019
7185
|
const geometryPath = join(idle.dir, GEOMETRY_FILE);
|
|
7020
7186
|
const geometry = readGeometry(geometryPath, idle.written);
|
|
7021
7187
|
idleGeometry = geometry;
|
|
7022
|
-
|
|
7023
|
-
|
|
7188
|
+
const beforeStretch = problems.length;
|
|
7189
|
+
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'));
|
|
7190
|
+
stretchFailedWithoutReading = stretch.status === 'SKIP' && problems.length > beforeStretch;
|
|
7191
|
+
if (full !== null) still = stillLine(full, idle, geometry, geometryPath, problems, notPlanted, readingSkip('STILL_REGIONS_DARK'));
|
|
7024
7192
|
}
|
|
7025
7193
|
|
|
7026
7194
|
// 3c. a sleeve on one chain, its first link turned large (issue #347): a throwaway copy, physics left out, posed by rigc
|
|
@@ -7314,11 +7482,9 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7314
7482
|
}, problems);
|
|
7315
7483
|
}
|
|
7316
7484
|
seamViewport = stillSet.viewport;
|
|
7317
|
-
if (keepStills)
|
|
7485
|
+
if (keepStills) retainCheckRender(join(stillDir, 'render'), inp.parts === null ? keptDir : join(out, 'setup_still_auto'));
|
|
7318
7486
|
if (inp.parts !== null) {
|
|
7319
7487
|
// 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
7488
|
const setStillAnimations: Record<string, unknown> = { still: animations.still };
|
|
7323
7489
|
const setStillBase = { ...withoutSliders(inp.rig, setStillAnimations), images };
|
|
7324
7490
|
const setsJsonPath = join(inp.rigDir, SETS_FILE);
|
|
@@ -7328,7 +7494,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7328
7494
|
const entry = setsMap !== null && isRecord(setsMap[alt.name]) ? setsMap[alt.name] as Record<string, unknown> : null;
|
|
7329
7495
|
const drawn = entry !== null && isRecord(entry.drawn)
|
|
7330
7496
|
? 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);
|
|
7497
|
+
const dir = join(stillDir, 'set_' + diagnosticSegment(alt.name));
|
|
7332
7498
|
mkdirSync(dir, { recursive: true });
|
|
7333
7499
|
writeFileSync(join(dir, 'rig.json'), JSON.stringify(stillRigForSet(setStillBase, alt, drawn)));
|
|
7334
7500
|
writeFileSync(join(dir, 'motion.json'), JSON.stringify({ ...inp.motion, animations: setStillAnimations }));
|
|
@@ -7349,7 +7515,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7349
7515
|
};
|
|
7350
7516
|
const canonicalSet = canonical(join(stillDir, 'build'), join(stillDir, 'seam'));
|
|
7351
7517
|
seamViewport = canonicalSet.viewport;
|
|
7352
|
-
if (keepStills)
|
|
7518
|
+
if (keepStills) retainCheckRender(join(stillDir, 'seam'), keptDir);
|
|
7353
7519
|
const rigSlotOrder = (Array.isArray(inp.rig.slots) ? inp.rig.slots : []).filter(isRecord).map((sl) => String(sl.name));
|
|
7354
7520
|
const composite = flatComposite(inp.parts, inp.partsDir, stillSet.background, rigSlotOrder);
|
|
7355
7521
|
const autoSeam = seamFigures(composite, stillSet.frames[0].image, inp.stage, stillSet.viewport, stillSet.background, undefined, inp.parts.scene !== undefined);
|
|
@@ -7371,10 +7537,10 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7371
7537
|
const asr = rigc(['render', '--candidate', join(setDir, 'build'), '--animation', 'still', '--fps', String(STILL_FPS), '--max', String(maxSide), '--out', join(setDir, 'render')]);
|
|
7372
7538
|
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
7539
|
const altStillSet = readFrameSet(join(setDir, 'render'));
|
|
7374
|
-
if (keepStills)
|
|
7540
|
+
if (keepStills) retainCheckRender(join(setDir, 'render'), join(out, 'setup_still_auto', diagnosticSegment(alt.name)));
|
|
7375
7541
|
const altComposite = flatCompositeForSet(inp.parts, reference, inp.partsDir, altStillSet.background, rigSlotOrder);
|
|
7376
7542
|
const altCanonical = canonical(join(setDir, 'build'), join(setDir, 'seam'));
|
|
7377
|
-
if (keepStills)
|
|
7543
|
+
if (keepStills) retainCheckRender(join(setDir, 'seam'), join(keptDir, diagnosticSegment(alt.name)));
|
|
7378
7544
|
const altPlaced = resolvePlacedAlpha(setPlacements(inp.parts, reference, rigSlotOrder), inp.partsDir);
|
|
7379
7545
|
const altSupport = seamSupport(join(setDir, 'build'), join(setDir, 'rig.json'), altCanonical, altPlaced, seamStacks, inp.stage);
|
|
7380
7546
|
const effects = seamEffectSelection(baseSupport, altSupport);
|
|
@@ -7407,10 +7573,10 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7407
7573
|
let altPairs: SeamPairRow[] | null = null;
|
|
7408
7574
|
if (seamPairsAsked || altFailed) {
|
|
7409
7575
|
const split = population.rows(altSeam);
|
|
7410
|
-
const altSeamDir = join(seamDir, alt.name);
|
|
7576
|
+
const altSeamDir = join(seamDir, diagnosticSegment(alt.name));
|
|
7411
7577
|
mkdirSync(altSeamDir, { recursive: true });
|
|
7412
7578
|
for (const { row, pixels } of split) {
|
|
7413
|
-
row.picture = `${SEAM_DIR}/${alt.name}/${basename(row.picture)}`;
|
|
7579
|
+
row.picture = `${SEAM_DIR}/${diagnosticSegment(alt.name)}/${basename(row.picture)}`;
|
|
7414
7580
|
writePng(join(out, row.picture), seamPicture(altCanonical.frames[0].image, row, pixels));
|
|
7415
7581
|
}
|
|
7416
7582
|
altPairs = split.map((x) => x.row);
|
|
@@ -7453,12 +7619,14 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7453
7619
|
}
|
|
7454
7620
|
if (full !== null) {
|
|
7455
7621
|
const H = full.parts.rig_size[1];
|
|
7456
|
-
|
|
7457
|
-
|
|
7622
|
+
const blinkSkip = readingSkip('BLINK_NO_HOLE');
|
|
7623
|
+
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');
|
|
7624
|
+
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
7625
|
else {
|
|
7459
7626
|
const br = rigc(['render', '--candidate', join(stillDir, 'build'), '--animation', BLINK_ANIMATION, '--fps', String(STILL_FPS), '--max', String(maxSide), '--out', join(stillDir, 'blink')]);
|
|
7460
7627
|
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
7628
|
blink = blinkLine(full, eyes, shut, stillSet, readFrameSet(join(stillDir, 'blink')), idle as FrameSet, H, problems);
|
|
7629
|
+
if (blink.status === 'SKIP') skipReasons.BLINK_NO_HOLE = 'no-reading';
|
|
7462
7630
|
}
|
|
7463
7631
|
}
|
|
7464
7632
|
} finally {
|
|
@@ -7525,7 +7693,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7525
7693
|
const skipped: { loop?: string; seam?: string } = {};
|
|
7526
7694
|
if (inp.noIdle !== null) skipped.loop = inp.noIdle;
|
|
7527
7695
|
if (inp.noParts !== null) skipped.seam = inp.noParts;
|
|
7528
|
-
const
|
|
7696
|
+
const readings: Omit<CheckFigures, 'spec' | 'bar_outcomes' | 'build' | 'PASS'> = {
|
|
7529
7697
|
gate_spine_html_green: htmlGreen,
|
|
7530
7698
|
rigc_entry: rigcEntry,
|
|
7531
7699
|
pack_mode: { page_edges: mode.pageEdges, pack_shape: mode.packShape, ...(pageSize === undefined ? {} : { page_size: pageSize }) },
|
|
@@ -7566,7 +7734,6 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7566
7734
|
...(behindSeams === null ? {} : { [BEHIND_SEAM_LINE]: behindSeams }),
|
|
7567
7735
|
...(cutMaterial === null ? {} : { [CUT_MATERIAL_LINE]: cutMaterial }),
|
|
7568
7736
|
...(reqBlock === null ? {} : { requirements: reqBlock }),
|
|
7569
|
-
PASS: false,
|
|
7570
7737
|
};
|
|
7571
7738
|
const barProblems: Problem[] = [];
|
|
7572
7739
|
if (!htmlGreen) barProblems.push(...rigcFailed(packedBuildLabel(mode), build, gateHtml));
|
|
@@ -7578,13 +7745,13 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7578
7745
|
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
7746
|
});
|
|
7580
7747
|
}
|
|
7581
|
-
if (
|
|
7748
|
+
if (readings.seam_mean !== null && readings.seam_px_over_40 !== null && readings.seam_frame_scale !== null && seamFigureFailed(readings)) {
|
|
7582
7749
|
const worst = seamPairs === null || seamPairs.length === 0 ? null : seamPairs[0];
|
|
7583
7750
|
barProblems.push({
|
|
7584
7751
|
code: 'CHECK_SEAM_WITHIN_BAR',
|
|
7585
7752
|
object: 'the source-grid setup-pose render vs the flat composite of parts/ (base, judged once)',
|
|
7586
7753
|
detail:
|
|
7587
|
-
`mean |d| ${
|
|
7754
|
+
`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
7755
|
(worst === null
|
|
7589
7756
|
? `; no pixel is over ${SEAM_PX_LEVEL}, so the mean alone fails and there is no pair to name`
|
|
7590
7757
|
: `; 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 +7776,13 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7609
7776
|
problems.sort((a, b) => rank(a) - rank(b));
|
|
7610
7777
|
problems.unshift(...barProblems);
|
|
7611
7778
|
problems.push(...cutMaterialProblems, ...foldProblems, ...levelProblems, ...stressProblems, ...limbProblems, ...sweepProblems, ...motionRootProblems, ...reqProblems);
|
|
7612
|
-
figures
|
|
7779
|
+
const figures: CheckFigures = {
|
|
7780
|
+
spec: CHECK_SPEC,
|
|
7781
|
+
bar_outcomes: checkBarOutcomes(readings, skipReasons, stretchFailedWithoutReading),
|
|
7782
|
+
build: { model_sha256: modelSha256 },
|
|
7783
|
+
...readings,
|
|
7784
|
+
PASS: problems.length === 0,
|
|
7785
|
+
};
|
|
7613
7786
|
const publishCheck = (): void => {
|
|
7614
7787
|
publishMotionSeamCells(out, motionSeam.required, motionCellEvidence, () => write('check.json', serializeCheckRows(figures)));
|
|
7615
7788
|
if (motionSeam.required?.cells !== undefined) written.push(MOTION_CELLS_FILE);
|
|
@@ -7678,7 +7851,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7678
7851
|
// the scene's declared requirements (issue #93)
|
|
7679
7852
|
// ---------------------------------------------------------------------------
|
|
7680
7853
|
|
|
7681
|
-
/** Where `check` writes the requirement renders, under `--out`: `as-declared/<animation>/`, `released/<name>/`, `full/<name>/`. */
|
|
7854
|
+
/** Where `check` writes the requirement renders, under `--out`: `as-declared/<animation-segment>/`, `released/<name-segment>/`, `full/<name-segment>/`. */
|
|
7682
7855
|
export const REQUIREMENTS_DIR = 'requirements';
|
|
7683
7856
|
|
|
7684
7857
|
/**
|
|
@@ -7721,16 +7894,32 @@ export function inputFileRecord(bytes: Uint8Array, recorded: string): InputFileR
|
|
|
7721
7894
|
/** The throwaway copies' specs and builds, under `--out`; removed before the stage returns. */
|
|
7722
7895
|
const REQUIREMENTS_SCRATCH = '_requirements';
|
|
7723
7896
|
|
|
7897
|
+
/** All known name-derived sibling scopes, before check or requirement writes. */
|
|
7898
|
+
export function preflightCheckPaths(animations: readonly string[], alternateSets: readonly string[], requirements: RequirementsFile | null, noExtremes = false): void {
|
|
7899
|
+
if (!noExtremes) diagnosticSiblings(animations.map(name => ({ name })), 'extremes');
|
|
7900
|
+
diagnosticSiblings(animations.map(name => ({ name })), 'retained render sets');
|
|
7901
|
+
diagnosticSiblings(alternateSets.map(name => ({ name })), 'alternate set folders');
|
|
7902
|
+
if (requirements !== null) {
|
|
7903
|
+
const declared = requirementAnimations(requirements.requirements).map(name => ({ name }));
|
|
7904
|
+
diagnosticSiblings(declared, 'requirements/as-declared');
|
|
7905
|
+
const suffix = typeof requirements.fps === 'number' && requirements.fps !== IDLE_FPS ? `@${requirements.fps}fps` : '';
|
|
7906
|
+
diagnosticSiblings(declared.map(({ name }) => ({ name, suffix })), 'requirements retained render sets');
|
|
7907
|
+
const follows = requirements.requirements.filter(requirement => requirement.kind === 'follow').map(requirement => ({ name: requirement.name }));
|
|
7908
|
+
diagnosticSiblings(follows, 'requirements/released');
|
|
7909
|
+
diagnosticSiblings(follows, 'requirements/full');
|
|
7910
|
+
}
|
|
7911
|
+
}
|
|
7912
|
+
|
|
7724
7913
|
/**
|
|
7725
7914
|
* Measure every requirement of a file {@link resolveRequirements} has passed.
|
|
7726
7915
|
* Every pose is rig-c's: each animation a requirement names is rendered
|
|
7727
7916
|
* once with `--geometry` at the file's fps, from the rig under test's own
|
|
7728
7917
|
* build — or, when the file places scene targets for it, from a copy with
|
|
7729
7918
|
* them written in ({@link placeTargets}, built `--profile spine`, as the setup
|
|
7730
|
-
* still is) — into `requirements/as-declared/<animation>/`. Each `follow` adds
|
|
7919
|
+
* still is) — into `requirements/as-declared/<animation-segment>/`. Each `follow` adds
|
|
7731
7920
|
* 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
|
|
7921
|
+
* on both, rendered into `requirements/released/<name-segment>/` and
|
|
7922
|
+
* `requirements/full/<name-segment>/`. The released copy's constraint is muted
|
|
7734
7923
|
* throughout, which rig-c's A47 (ik) or A48 (transform) refuses unless
|
|
7735
7924
|
* the rig declares the mix consumer-driven: when the gate refuses that copy
|
|
7736
7925
|
* for that constraint and nothing else ({@link mutedOnly}), the copy — never
|
|
@@ -7740,6 +7929,7 @@ const REQUIREMENTS_SCRATCH = '_requirements';
|
|
|
7740
7929
|
* FAIL and NOT MEASURABLE into `problems`.
|
|
7741
7930
|
*/
|
|
7742
7931
|
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'> {
|
|
7932
|
+
preflightCheckPaths([], [], file, true);
|
|
7743
7933
|
const reqDir = join(out, REQUIREMENTS_DIR);
|
|
7744
7934
|
const scratch = join(out, REQUIREMENTS_SCRATCH);
|
|
7745
7935
|
for (const d of [reqDir, scratch]) rmSync(d, { recursive: true, force: true });
|
|
@@ -7760,8 +7950,11 @@ export function measureRequirements(inp: CheckInputs, file: RequirementsFile, bu
|
|
|
7760
7950
|
return b.dir;
|
|
7761
7951
|
};
|
|
7762
7952
|
const posesOf = (candidate: string, animation: string, dir: string, label: string): { poses: Poses; geo: IdleGeometry; path: string } => {
|
|
7763
|
-
const
|
|
7953
|
+
const staged = join(scratch, 'render');
|
|
7954
|
+
const r = render(['render', '--candidate', candidate, '--animation', animation, '--fps', String(file.fps), '--max', String(IDLE_MAX_PX), '--geometry', '--out', staged]);
|
|
7764
7955
|
if (r.status !== 0) refuseIfAny(rigcFailed(`render --animation ${animation} --geometry (${label})`, r, r.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
|
|
7956
|
+
retainCheckRender(staged, dir);
|
|
7957
|
+
rmSync(staged, { recursive: true, force: true });
|
|
7765
7958
|
const set = readFrameSet(dir);
|
|
7766
7959
|
if (set.written !== set.sampled || set.stride !== 1) {
|
|
7767
7960
|
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 +7993,7 @@ export function measureRequirements(inp: CheckInputs, file: RequirementsFile, bu
|
|
|
7800
7993
|
const scene = file.targets.some((t) => t.animation === animation);
|
|
7801
7994
|
const label = scene ? `as declared, the scene targets of "${animation}" placed` : 'as declared';
|
|
7802
7995
|
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));
|
|
7996
|
+
declared.set(animation, posesOf(candidate, animation, join(reqDir, 'as-declared', diagnosticSegment(animation)), label));
|
|
7804
7997
|
}
|
|
7805
7998
|
for (const r of file.requirements) {
|
|
7806
7999
|
const d = declared.get(r.animation) as { poses: Poses; geo: IdleGeometry; path: string };
|
|
@@ -7824,9 +8017,9 @@ export function measureRequirements(inp: CheckInputs, file: RequirementsFile, bu
|
|
|
7824
8017
|
relBuild = buildCopy(declareConsumerDriven(rel.rig, r), rel.motion);
|
|
7825
8018
|
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
8019
|
}
|
|
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');
|
|
8020
|
+
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
8021
|
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');
|
|
8022
|
+
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
8023
|
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
8024
|
if (!same(d.poses, released.poses) || !same(d.poses, full.poses)) {
|
|
7832
8025
|
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 +8086,12 @@ function boxText(h: { x: number; y: number; w: number; h: number }): string {
|
|
|
7893
8086
|
/** The throwaway animation that holds the blink tracks at their closed value, rendered beside the setup-pose still. */
|
|
7894
8087
|
export const BLINK_ANIMATION = 'blink_shut';
|
|
7895
8088
|
|
|
7896
|
-
function skip(reason: string): JudgementLine {
|
|
8089
|
+
function skip(reason: string): Extract<JudgementLine, { status: 'SKIP' }> {
|
|
7897
8090
|
return { status: 'SKIP', reason };
|
|
7898
8091
|
}
|
|
7899
8092
|
|
|
8093
|
+
type ReadingSkip<Id extends keyof CheckBarSkipReasons> = (reason: string, code: NonNullable<CheckBarSkipReasons[Id]>) => ReturnType<typeof skip>;
|
|
8094
|
+
|
|
7900
8095
|
function tagWords(tags: readonly BaseTag[]): string {
|
|
7901
8096
|
return tags.map((t) => `"${t}"`).join(' or ');
|
|
7902
8097
|
}
|
|
@@ -7999,20 +8194,20 @@ function noneHeldText(declared: readonly string[]): string {
|
|
|
7999
8194
|
* or a physics response to the world inside the torso's box passed the bar
|
|
8000
8195
|
* for a torso that did not breathe.
|
|
8001
8196
|
*/
|
|
8002
|
-
function breathLine(inp: FullInputs, isolated: Isolate, pair: BreathPairRender, problems: Problem[], notPlanted: readonly string[]
|
|
8197
|
+
function breathLine(inp: FullInputs, isolated: Isolate, pair: BreathPairRender, problems: Problem[], notPlanted: readonly string[], skipped: ReadingSkip<'BREATH_VISIBLE'>): JudgementLine {
|
|
8003
8198
|
const torso = partsTagged(inp.parts, TORSO_TAGS);
|
|
8004
8199
|
const { all: allFeet, held: feet, declared } = plantedFeet(inp.parts, notPlanted);
|
|
8005
8200
|
const noTorso = `no part comes from a See-through ${tagWords(TORSO_TAGS)} layer, so there is no torso to see breathe`;
|
|
8006
8201
|
const noFeet = `no part comes from a See-through ${tagWords(FEET_TAGS)} layer, so there are no feet to hold still`;
|
|
8007
8202
|
// 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, []);
|
|
8203
|
+
if (torso.length === 0 && feet.length === 0) return skipped(`${noTorso}${declared.length === 0 ? '' : `; ${declared.map((n) => `"${n}"`).join(', ')} declared not planted`}`, 'no-eligible-region');
|
|
8204
|
+
if (torso.length === 0) return oneHalf(inp, isolated, pair, problems, 'feet', feet, noTorso, declared, skipped);
|
|
8205
|
+
if (allFeet.length === 0) return oneHalf(inp, isolated, pair, problems, 'torso', torso, noFeet, [], skipped);
|
|
8011
8206
|
const H = inp.parts.rig_size[1];
|
|
8012
8207
|
const tr = torsoBreath(inp, torso, pair);
|
|
8013
8208
|
const fs = feet.length === 0 ? null : isolated('feet', feet);
|
|
8014
8209
|
const fb = fs === null ? null : frameBox(feet, H, inp.stage, fs.viewport);
|
|
8015
|
-
if ('skip' in tr || (fs !== null && fb === null)) return
|
|
8210
|
+
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
8211
|
const fh = fs === null || fb === null ? null : regionHeat(heatField(fs.frames.map((f) => f.image)), fs.viewport.pixelWidth, fb);
|
|
8017
8212
|
const mean = tr.mean;
|
|
8018
8213
|
const ok = mean >= BREATH_TORSO_MEAN_FLOOR && (fh === null || fh.max <= BREATH_FEET_MAX_CEILING);
|
|
@@ -8044,12 +8239,12 @@ function breathLine(inp: FullInputs, isolated: Isolate, pair: BreathPairRender,
|
|
|
8044
8239
|
* `halves_measured`, says `1 of 2` — after `declared_not_planted` when the scene
|
|
8045
8240
|
* file declares some of the feet read (issue #231), which stays the first.
|
|
8046
8241
|
*/
|
|
8047
|
-
function oneHalf(inp: FullInputs, isolated: Isolate, pair: BreathPairRender, problems: Problem[], half: 'torso' | 'feet', ps: readonly PartRecord[], reason: string, declared: readonly string[]): JudgementLine {
|
|
8242
|
+
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
8243
|
const H = inp.parts.rig_size[1];
|
|
8049
8244
|
if (half === 'torso') {
|
|
8050
8245
|
// Issue #411: the torso half is the breath alone.
|
|
8051
8246
|
const tr = torsoBreath(inp, ps, pair);
|
|
8052
|
-
if ('skip' in tr) return
|
|
8247
|
+
if ('skip' in tr) return skipped(`the ${half} box falls outside the idle frame, and ${reason}`, 'no-reading');
|
|
8053
8248
|
const mean = tr.mean;
|
|
8054
8249
|
const ok = mean >= BREATH_TORSO_MEAN_FLOOR;
|
|
8055
8250
|
if (!ok) problems.push(torsoProblem(ps, tr, `; the feet half not measured: ${reason}`));
|
|
@@ -8066,7 +8261,7 @@ function oneHalf(inp: FullInputs, isolated: Isolate, pair: BreathPairRender, pro
|
|
|
8066
8261
|
}
|
|
8067
8262
|
const fs = isolated(half, ps);
|
|
8068
8263
|
const box = frameBox(ps, H, inp.stage, fs.viewport);
|
|
8069
|
-
if (box === null) return
|
|
8264
|
+
if (box === null) return skipped(`the ${half} box falls outside the idle frame, and ${reason}`, 'no-reading');
|
|
8070
8265
|
const heat = regionHeat(heatField(fs.frames.map((f) => f.image)), fs.viewport.pixelWidth, box);
|
|
8071
8266
|
const ok = heat.max <= BREATH_FEET_MAX_CEILING;
|
|
8072
8267
|
if (!ok) {
|
|
@@ -8426,9 +8621,9 @@ export function carrierExcitation(rig: Record<string, unknown>, geo: IdleGeometr
|
|
|
8426
8621
|
* with CHECK_CARRIER_NOT_EXCITED; incomplete excitation data keeps the prior
|
|
8427
8622
|
* failure. Below-floor rows retain their policy and name the measured driver.
|
|
8428
8623
|
*/
|
|
8429
|
-
function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems: Problem[], excepted: TipExceptions
|
|
8624
|
+
function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems: Problem[], excepted: TipExceptions, skipped: ReadingSkip<'TIP_OVER_ROOT'>): JudgementLine {
|
|
8430
8625
|
const swing = partsTagged(inp.parts, SWING_TAGS);
|
|
8431
|
-
if (swing.length === 0) return
|
|
8626
|
+
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
8627
|
const poses = attachmentPoses(geometryPath, frames);
|
|
8433
8628
|
const idleGeo = readGeometry(geometryPath, frames);
|
|
8434
8629
|
// Issue #231: a part declared `rises` is read up only when the chain carrying it does rise, measured at the setup pose.
|
|
@@ -8528,7 +8723,7 @@ function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems
|
|
|
8528
8723
|
problems.push({
|
|
8529
8724
|
code: 'CHECK_TIP_OVER_ROOT',
|
|
8530
8725
|
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`,
|
|
8726
|
+
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
8727
|
});
|
|
8533
8728
|
} else if (!ok) {
|
|
8534
8729
|
failed = true;
|
|
@@ -8543,6 +8738,7 @@ function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems
|
|
|
8543
8738
|
const hangName = hang === null ? 'the bone the part hangs from' : `\`${hang}\`, the bone the part hangs from`;
|
|
8544
8739
|
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
8740
|
const heldRatio = carry === null ? '' : `ratio ${carry.root > 0 ? round3(carry.tip / carry.root) : 'undefined: the root moves only with it'}`;
|
|
8741
|
+
const chainRemedy = carry === null || carry.link ? '' : breathingSegmentRemedy(inp.rig, inp.motion, p.name, carry.bone, carry.keyed, hangName);
|
|
8546
8742
|
const why =
|
|
8547
8743
|
carry === null
|
|
8548
8744
|
? `${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 +8750,7 @@ function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems
|
|
|
8554
8750
|
problems.push({
|
|
8555
8751
|
code: 'CHECK_TIP_OVER_ROOT',
|
|
8556
8752
|
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' : ''}`,
|
|
8753
|
+
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
8754
|
});
|
|
8559
8755
|
}
|
|
8560
8756
|
}
|
|
@@ -8570,7 +8766,7 @@ function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems
|
|
|
8570
8766
|
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
8767
|
return `${String(r.part)}: ${String(r.unmeasured)}${travel}`;
|
|
8572
8768
|
});
|
|
8573
|
-
return {
|
|
8769
|
+
return { ...skipped(`none of ${quoteParts(swing)} could be measured: ${reasons.join('; ')}`, 'no-reading'),
|
|
8574
8770
|
...(belowGrid === 0 ? {} : figures) };
|
|
8575
8771
|
}
|
|
8576
8772
|
return { status: failed ? 'FAIL' : 'PASS', ...figures };
|
|
@@ -8764,6 +8960,33 @@ function breathCarrier(
|
|
|
8764
8960
|
return null;
|
|
8765
8961
|
}
|
|
8766
8962
|
|
|
8963
|
+
/** Issue #1358: options for a breathing mesh carrier below one keyed chain link, without guessing a binding. */
|
|
8964
|
+
function breathingSegmentRemedy(rig: Record<string, unknown>, motion: Record<string, unknown>, part: string, carrier: string, keyed: string, hangName: string): string {
|
|
8965
|
+
const { found, bound } = chainsCarrying(rig, motion, part);
|
|
8966
|
+
if (found.length !== 1) return '';
|
|
8967
|
+
const bones = (Array.isArray(rig.bones) ? rig.bones : []).filter(isRecord);
|
|
8968
|
+
const parent = new Map(bones.filter(b => typeof b.name === 'string').map(b => [String(b.name), typeof b.parent === 'string' ? b.parent : null]));
|
|
8969
|
+
const under = (bone: string, ancestor: string): boolean => {
|
|
8970
|
+
const seen = new Set<string>();
|
|
8971
|
+
for (let at: string | null = bone; at !== null && !seen.has(at); at = parent.get(at) ?? null) {
|
|
8972
|
+
if (at === ancestor) return true;
|
|
8973
|
+
seen.add(at);
|
|
8974
|
+
}
|
|
8975
|
+
return false;
|
|
8976
|
+
};
|
|
8977
|
+
const chain = found[0];
|
|
8978
|
+
const at = chain.findLastIndex(link => under(carrier, link));
|
|
8979
|
+
if (at < 0) return '';
|
|
8980
|
+
const next = chain[at + 1];
|
|
8981
|
+
const after = chain[at + 2];
|
|
8982
|
+
// Name only an existing bound carrier under the immediate next link, never an inferred control-twin mapping.
|
|
8983
|
+
const targets = next === undefined ? [] : [...bound].filter(bone => bone !== carrier && under(bone, next) && (after === undefined || !under(bone, after)));
|
|
8984
|
+
const rebind = targets.length === 1
|
|
8985
|
+
? `try rebinding the lower segment on \`${carrier}\` to its existing carrier \`${targets[0]}\` under the next keyed link \`${next}\`, or `
|
|
8986
|
+
: '';
|
|
8987
|
+
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`;
|
|
8988
|
+
}
|
|
8989
|
+
|
|
8767
8990
|
/** 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
8991
|
export interface SetupBone {
|
|
8769
8992
|
x: number;
|
|
@@ -9005,12 +9228,13 @@ interface StillHalf {
|
|
|
9005
9228
|
* features go; `footwear` on top) is reported per slot, `crossing`, with no
|
|
9006
9229
|
* bar ({@link crossingOf}). No render grid enters either half.
|
|
9007
9230
|
*/
|
|
9008
|
-
export function stillLine(inp: FullInputs, idle: FrameSet, geo: IdleGeometry | null, geometryPath: string, problems: Problem[], notPlanted: readonly string[] = []): JudgementLine {
|
|
9231
|
+
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
9232
|
const slotParts = checkSlotParts(inp.rig, inp.parts.parts.map(p => p.name), inp.parts.alternates?.map(set => set.name) ?? []);
|
|
9010
9233
|
const face = partsTagged(inp.parts, FACE_TAGS);
|
|
9011
9234
|
const { all: allFeet, held: feet, declared } = plantedFeet(inp.parts, notPlanted);
|
|
9012
|
-
|
|
9013
|
-
if (
|
|
9235
|
+
const eligible = face.length > 0 || feet.length > 0;
|
|
9236
|
+
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');
|
|
9237
|
+
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
9238
|
const H = inp.parts.rig_size[1];
|
|
9015
9239
|
const W = inp.parts.rig_size[0];
|
|
9016
9240
|
const poses = attachmentPoses(geometryPath, idle.written);
|
|
@@ -9166,7 +9390,7 @@ export function stillLine(inp: FullInputs, idle: FrameSet, geo: IdleGeometry | n
|
|
|
9166
9390
|
|
|
9167
9391
|
const f = faceHalf();
|
|
9168
9392
|
const t = feetHalf();
|
|
9169
|
-
if (typeof f === 'string' && typeof t === 'string') return
|
|
9393
|
+
if (typeof f === 'string' && typeof t === 'string') return skipped(`face: ${f}; feet: ${t}`, eligible ? 'no-reading' : 'no-eligible-region');
|
|
9170
9394
|
const failed = problems.some((q) => q.code === 'CHECK_STILL_REGIONS_DARK');
|
|
9171
9395
|
// Issue #231: a declaration is the feet half's first figure, measured or not.
|
|
9172
9396
|
const said = declared.length === 0 ? {} : { declared_not_planted: declared };
|
|
@@ -9690,9 +9914,9 @@ export function edgeBonesText(rig: Record<string, unknown>, motion: Record<strin
|
|
|
9690
9914
|
* bones its two vertices hang on and their chains ({@link edgeBonesText}, issue
|
|
9691
9915
|
* #314).
|
|
9692
9916
|
*/
|
|
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
|
|
9917
|
+
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 {
|
|
9918
|
+
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');
|
|
9919
|
+
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
9920
|
const figures = stretchFigures(geo.meshes, geo.frames);
|
|
9697
9921
|
const rows: Array<Record<string, unknown>> = [];
|
|
9698
9922
|
let worst: { mesh: (typeof figures)[number]; at: NonNullable<(typeof figures)[number]['max']>; severity: number } | null = null;
|
|
@@ -9730,7 +9954,7 @@ export function stretchLine(geo: IdleGeometry | null, path: string, problems: Pr
|
|
|
9730
9954
|
});
|
|
9731
9955
|
}
|
|
9732
9956
|
}
|
|
9733
|
-
if (worst === null) return
|
|
9957
|
+
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
9958
|
return {
|
|
9735
9959
|
status: failed ? 'FAIL' : 'PASS',
|
|
9736
9960
|
meshes: figures.length,
|