@rig-c/parts 2.41.0 → 2.42.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 +1 -0
- package/cli.ts +76 -20
- package/docs/AUTHORING.md +323 -53
- package/docs/STABILITY.md +128 -10
- package/package.json +4 -2
- package/src/behindseams.ts +622 -0
- package/src/build.ts +76 -9
- package/src/check.ts +134 -18
- package/src/checkrow.ts +21 -0
- package/src/configrelocation.ts +25 -0
- package/src/configwrite.ts +20 -2
- package/src/depthworkflow.ts +3 -4
- package/src/meshdraft.ts +10 -10
- package/src/remesh.ts +18 -12
- package/src/requirements.ts +30 -4
- package/src/retune.ts +8 -5
- package/src/runstamp.ts +54 -1
- package/tools/configwrite.ts +83 -1
- package/tools/edited-part-cli.ts +61 -0
package/src/build.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { DEFAULT_PROJECT_RULE } from './projectrule.ts';
|
|
|
11
11
|
import { type PaintingAllocationReading, type PaintingAllocationEvent, EDGE_CONTRAST, PAINTING_ALLOCATION_FILE, PAINTING_EDGE_COVERAGE_TRANSFER } from './paintingedges.ts';
|
|
12
12
|
import { SETUP_PAINTING_LINE, setupPaintingLines } from './setuppainting.ts';
|
|
13
13
|
import { boundaryColourLines } from './boundarycolour.ts';
|
|
14
|
+
import { behindSeamLines } from './behindseams.ts';
|
|
14
15
|
import { writeMaterialSources } from './cutmaterialio.ts';
|
|
15
16
|
import { CUT_MATERIAL_LINE, CUT_MATERIAL_SOURCES, materialLines } from './cutmaterial.ts';
|
|
16
17
|
import { ART_JOINT_LINE, artJointLines } from './artjoints.ts';
|
|
@@ -96,8 +97,8 @@ import {
|
|
|
96
97
|
splitSchedule,
|
|
97
98
|
untestedIntervals,
|
|
98
99
|
} from './autoreplay.ts';
|
|
99
|
-
import { besideIdleLine, checkSummaryLine, inputFileRecord, type InputFileRecord, CLOTH_LINE, type ClothLine, clothWarnText, figureOpeningLines, frameRuns, MOTION_SEAM_LINE, type MotionSeamLine, type MotionSeamPlant, motionSeamRequiredLine, motionSeamWarnText, motionJointContactLines, FOLD_LINE, type FoldsLine, LEVEL_LINE, type LevelLine, LIMB_LINE, type LimbLine, STRESS_LINE, SWEEP_LINE, type SweepLine, buildGateLines, causeLines, environmentLine, IDLE_FPS, IDLE_MAX_PX, maxRgbDiff, REQUIREMENTS_DIR, type CheckReport, type PackLine, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, GATE_PROFILE, JUDGEMENT_LINES, type JudgementLine, packedBuildArgs, packedBuildLabel, type PackMode, readCheckEnvironment, readWindBand, type PackShape, type PageEdges, readFrameSet, rigcFailed, rigcIdentity, rigcRanClause, REPORTED_LINES, type ReportedLine, type RigcRunner, runCheck, SEAM_DIR, SEAM_MEAN_BAR, seamPairText, seamRigPxText, SOURCE_LINE, SEAM_PX_BAR, SEAM_PX_LEVEL, SEAM_PX_LEVEL_HIGH, SPINEBOY_YARDSTICK, STILL_DIR, WIND_BAND_LINE, windBandLines } from './check.ts';
|
|
100
|
-
import { type Cut, type Extend, type Limb, loadConfigAndAnimations, loadConfigWithBytes, loadEarlyConfig, type Patch, type PlanEntry } from './config.ts';
|
|
100
|
+
import { besideIdleLine, checkSummaryLine, inputFileRecord, type InputFileRecord, CLOTH_LINE, type ClothLine, clothWarnText, figureOpeningLines, frameRuns, MOTION_SEAM_LINE, type MotionSeamLine, type MotionSeamPlant, motionSeamRequiredLine, motionSeamWarnText, motionJointContactLines, FOLD_LINE, type FoldsLine, LEVEL_LINE, type LevelLine, LIMB_LINE, type LimbLine, STRESS_LINE, SWEEP_LINE, type SweepLine, buildGateLines, causeLines, environmentLine, IDLE_FPS, IDLE_MAX_PX, maxRgbDiff, REQUIREMENTS_DIR, type CheckReport, type PackLine, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, GATE_PROFILE, JUDGEMENT_LINES, type JudgementLine, packedBuildArgs, packedBuildLabel, type PackMode, parsePageSize, readCheckEnvironment, readWindBand, type PackShape, type PageEdges, readFrameSet, rigcFailed, rigcIdentity, rigcRanClause, REPORTED_LINES, type ReportedLine, type RigcRunner, runCheck, SEAM_DIR, SEAM_MEAN_BAR, seamPairText, seamRigPxText, SOURCE_LINE, SEAM_PX_BAR, SEAM_PX_LEVEL, SEAM_PX_LEVEL_HIGH, SPINEBOY_YARDSTICK, STILL_DIR, WIND_BAND_LINE, windBandLines } from './check.ts';
|
|
101
|
+
import { type CharacterConfig, type Cut, type Extend, type Limb, loadConfigAndAnimations, loadConfigWithBytes, loadEarlyConfig, type Patch, type PlanEntry } from './config.ts';
|
|
101
102
|
import { coreCompileGuideLine, failLine, foldName, PartsError, type Problem, refuseIfAny } from './errors.ts';
|
|
102
103
|
import { editedConfigImages, editedRunImages, missingReceipts, readEditorReceipts } from './editreceipt.ts';
|
|
103
104
|
import { untracedPartSources } from './partsource.ts';
|
|
@@ -118,7 +119,7 @@ import { pinholesRequired, readRequirements, type RequirementLine, summaryText }
|
|
|
118
119
|
import { type AutoMeshReport, buildRig, DEFAULT_IDLE_KEYS, type FaceAxis, type IdleKeys, type MeshReport, type RigCommand, rigJsonText, type RigOutput, type RigSpec, SETS_FILE, type StrayCleared, type TurnRow } from './rig.ts';
|
|
119
120
|
import { KEYPOINT_NAMES, type KeypointName, type PosePoints } from './skeleton.ts';
|
|
120
121
|
import { AUTHOR_NO_ROLE, isAuthorTag } from './tags.ts';
|
|
121
|
-
import { TURN_BONE } from './turn.ts';
|
|
122
|
+
import { BODY_TURN_ANIM, TURN_BONE } from './turn.ts';
|
|
122
123
|
import { pyRound } from './round.ts';
|
|
123
124
|
import { LAYOUT_FILE, layoutCompanion, refreshLimbLayout } from './limblayout.ts';
|
|
124
125
|
|
|
@@ -1410,6 +1411,60 @@ export function ctlRemedies(lines: readonly string[], controls: readonly string[
|
|
|
1410
1411
|
return out;
|
|
1411
1412
|
}
|
|
1412
1413
|
|
|
1414
|
+
export const RIG_CONTOUR_BODY_TURN_WINDING = 'RIG_CONTOUR_BODY_TURN_WINDING';
|
|
1415
|
+
|
|
1416
|
+
/**
|
|
1417
|
+
* Add config context to A39's measured failure, never another winding check.
|
|
1418
|
+
* Match the installed core's key/span sentence and the generated body-turn's
|
|
1419
|
+
* actual deform address. Blended bindings can acquire a body surface role in
|
|
1420
|
+
* the producer, so a role absent from the authored body block is not a miss.
|
|
1421
|
+
* Each failure frame gets one sentence even when core repeats its gate line.
|
|
1422
|
+
* If core changes its wording, its original refusal still reaches the author.
|
|
1423
|
+
*/
|
|
1424
|
+
export function contourBodyTurnRemedies(lines: readonly string[], cfg: CharacterConfig, rig: RigOutput): string[] {
|
|
1425
|
+
const record = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
1426
|
+
const animation = rig.motion.animations[BODY_TURN_ANIM];
|
|
1427
|
+
if (cfg.turn?.body === undefined || !record(animation) || !Array.isArray(animation.deform)) return [];
|
|
1428
|
+
const number = '-?\\d+(?:\\.\\d+)?(?:e[+-]?\\d+)?';
|
|
1429
|
+
const triangle = `\\d+ \\[\\d+,\\d+,\\d+\\] ${number} -> ${number}px²`;
|
|
1430
|
+
const measured = new RegExp(`^([1-9]\\d* of [1-9]\\d* triangle\\(s\\) reverse winding — triangle ${triangle}(?:; triangle ${triangle}){0,3}(?:, and [1-9]\\d* more)?)\\. (?:The mesh has turned inside out there and draws its texture backwards|NO KEY LANDS THERE: )`);
|
|
1431
|
+
const keyAt = new RegExp(`^key (\\d+) \\(t=(${number})s\\): `);
|
|
1432
|
+
const spanAt = new RegExp(`^BETWEEN key (\\d+) \\(t=(${number})s\\) and key (\\d+) \\(t=(${number})s\\), at t=(${number})s(?: \\(a stepped segment\\)| — \\d+\\.\\d% of the way from one to the other): `);
|
|
1433
|
+
const seen = new Set<string>();
|
|
1434
|
+
const out: string[] = [];
|
|
1435
|
+
for (const line of lines) {
|
|
1436
|
+
const head = /^FAIL {2}A39_DEFORM_KEEPS_TRIANGLE_WINDING: animation "body_turn"(?<frame> \(applied by slider "(?<slider>[^"\r\n]+)", not played on a track\))? deform (?<slot>[^/\s]+)\/(?<attachment>[^/\s]+) (?<detail>.+)$/.exec(line.trim())?.groups;
|
|
1437
|
+
if (head === undefined) continue;
|
|
1438
|
+
const { slot, attachment, detail } = head;
|
|
1439
|
+
const owners = Object.keys(cfg.meshes).filter(p => slot === p || slot.startsWith(`${p}__island`));
|
|
1440
|
+
const part = owners.includes(slot) ? slot : owners.length === 1 ? owners[0] : undefined;
|
|
1441
|
+
if (part === undefined || !('contour' in cfg.meshes[part]) || !rig.meshReport.some(row => row.part === part && 'mode' in row && row.mode === 'contour')) continue;
|
|
1442
|
+
const att = rig.rig.skins.default[slot]?.[attachment];
|
|
1443
|
+
if (!rig.rig.slots.some(s => s.name === slot) || att === undefined || !('type' in att) || att.type !== 'mesh' || att.generator !== undefined) continue;
|
|
1444
|
+
const timeline = animation.deform.find((d: unknown) => record(d) && (d.skin === undefined || d.skin === 'default') && d.slot === slot && d.attachment === attachment);
|
|
1445
|
+
if (!record(timeline) || !Array.isArray(timeline.keys)) continue;
|
|
1446
|
+
const keys: unknown[] = timeline.keys;
|
|
1447
|
+
if (head.slider !== undefined && !rig.rig.constraints?.some(c => c.type === 'slider' && c.name === head.slider && c.animation === BODY_TURN_ANIM)) continue;
|
|
1448
|
+
const key = keyAt.exec(detail);
|
|
1449
|
+
const span = key === null ? spanAt.exec(detail) : null;
|
|
1450
|
+
const at = key ?? span;
|
|
1451
|
+
if (at === null) continue;
|
|
1452
|
+
const hasKey = (index: string, time: string): boolean => {
|
|
1453
|
+
const k = keys[Number(index)];
|
|
1454
|
+
return record(k) && k.t === Number(time);
|
|
1455
|
+
};
|
|
1456
|
+
if (!hasKey(at[1], at[2]) || (span !== null && !hasKey(span[3], span[4]))) continue;
|
|
1457
|
+
const witness = measured.exec(detail.slice(at[0].length));
|
|
1458
|
+
if (witness === null) continue;
|
|
1459
|
+
const frame = `animation "${BODY_TURN_ANIM}"${head.frame ?? ''} deform ${slot}/${attachment} ${at[0].slice(0, -2)}`;
|
|
1460
|
+
if (seen.has(frame)) continue;
|
|
1461
|
+
seen.add(frame);
|
|
1462
|
+
const depth = rig.depthReferences?.find(d => d.part === part)?.depth.image;
|
|
1463
|
+
out.push(`${RIG_CONTOUR_BODY_TURN_WINDING}: part "${part}", ${frame}: ${witness[1]}; inspect meshes.${part}.contour.maxEdge, meshes.${part}.contour.margin, meshes.${part}.contour.tolerance and part "${part}" depth sheet${depth === undefined ? '' : ` "${depth}"`}; the outcome is not monotone in any field; only rerunning rigc's gate decides whether the candidate passes (see rig-parts guide ${RIG_CONTOUR_BODY_TURN_WINDING})`);
|
|
1464
|
+
}
|
|
1465
|
+
return out;
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1413
1468
|
export interface RigStageInput {
|
|
1414
1469
|
config: string;
|
|
1415
1470
|
/** The directory holding parts.json and parts/<name>.png. */
|
|
@@ -1421,6 +1476,8 @@ export interface RigStageInput {
|
|
|
1421
1476
|
pageEdges?: PageEdges;
|
|
1422
1477
|
/** The gate build's `--pack-shape`; {@link DEFAULT_PACK_SHAPE} when absent. */
|
|
1423
1478
|
packShape?: PackShape;
|
|
1479
|
+
/** The gate build's `--page-size`; rigc's default when absent (issue #1273). */
|
|
1480
|
+
pageSize?: number;
|
|
1424
1481
|
/** The command running the stage, which {@link ctlRemedies} names beside the flag; `rig` when absent. It moves no byte written. */
|
|
1425
1482
|
command?: RigCommand;
|
|
1426
1483
|
/**
|
|
@@ -1834,6 +1891,7 @@ export function rigOutputTexts(r: RigOutput, animations: Parameters<typeof withA
|
|
|
1834
1891
|
}
|
|
1835
1892
|
|
|
1836
1893
|
export function rigStage(input: RigStageInput, rigc: RigcRunner, scratch: string, log: Log): RigOutput {
|
|
1894
|
+
const pageSize = parsePageSize(input.pageSize);
|
|
1837
1895
|
const { cfg, from, parts, images } = readRigInputs(input.config, input.parts);
|
|
1838
1896
|
const first = buildRig(cfg, parts, images, undefined, input.idleKeys ?? DEFAULT_IDLE_KEYS, input.reduce);
|
|
1839
1897
|
const textsOf = (r: RigOutput): Array<[string, string]> => rigOutputTexts(r, from === null ? null : from.table);
|
|
@@ -1842,7 +1900,7 @@ export function rigStage(input: RigStageInput, rigc: RigcRunner, scratch: string
|
|
|
1842
1900
|
// gate compares the model document of this very build, the one written (issue #126 item 3). mesh_report.json is staged
|
|
1843
1901
|
// as buildRig wrote it; rigc reads only rig.json, motion.json and images/.
|
|
1844
1902
|
const pngs = first.images.map(([file, img]) => [file, encodePngBytes(img)] as const);
|
|
1845
|
-
const mode: PackMode = { pageEdges: input.pageEdges ?? DEFAULT_PAGE_EDGES, packShape: input.packShape ?? DEFAULT_PACK_SHAPE };
|
|
1903
|
+
const mode: PackMode = { pageEdges: input.pageEdges ?? DEFAULT_PAGE_EDGES, packShape: input.packShape ?? DEFAULT_PACK_SHAPE, ...(pageSize === undefined ? {} : { pageSize }) };
|
|
1846
1904
|
let firstModel: string | null = null;
|
|
1847
1905
|
const firstGate = gateThroughRigc(pngs, firstTexts, rigc, scratch, mode, first.autoMotion.length === 0 ? undefined : (dir) => (firstModel = modelAt(dir)));
|
|
1848
1906
|
const firstRed = firstGate.filter((g) => g.status !== 0);
|
|
@@ -1977,7 +2035,7 @@ export function rigStage(input: RigStageInput, rigc: RigcRunner, scratch: string
|
|
|
1977
2035
|
const problems: Problem[] = red.map((g) => ({
|
|
1978
2036
|
code: 'RIG_RIGC_GREEN',
|
|
1979
2037
|
object: `rigc ${g.label}`,
|
|
1980
|
-
detail: `exited ${g.status}${g.lines.length > 0 ? `: ${g.lines.map((l) => l.trim()).join(' | ')}` : ', and it printed nothing'}${rigcRanClause(g)}; ${ctlRemedies(g.lines, rig.controls, input.command ?? 'rig').map((s) => `${s}; `).join('')}exit 0 is required before anything is written, and nothing was`,
|
|
2038
|
+
detail: `exited ${g.status}${g.lines.length > 0 ? `: ${g.lines.map((l) => l.trim()).join(' | ')}` : ', and it printed nothing'}${rigcRanClause(g)}; ${[...ctlRemedies(g.lines, rig.controls, input.command ?? 'rig'), ...(from?.table[BODY_TURN_ANIM] === undefined ? contourBodyTurnRemedies(g.lines, cfg, rig) : [])].map((s) => `${s}; `).join('')}exit 0 is required before anything is written, and nothing was`,
|
|
1981
2039
|
}));
|
|
1982
2040
|
throw new PartsError(problems);
|
|
1983
2041
|
}
|
|
@@ -2023,6 +2081,8 @@ export interface CheckStageInput {
|
|
|
2023
2081
|
pageEdges?: PageEdges;
|
|
2024
2082
|
/** The packed build's `--pack-shape`; {@link DEFAULT_PACK_SHAPE} when absent. */
|
|
2025
2083
|
packShape?: PackShape;
|
|
2084
|
+
/** The packed build's `--page-size`; rigc's default when absent (issue #1273). */
|
|
2085
|
+
pageSize?: number;
|
|
2026
2086
|
/** The scene's declared requirements (`--requirements`, issue #93); absent, nothing is read, written or printed for them. */
|
|
2027
2087
|
requirements?: string;
|
|
2028
2088
|
/** The path `check.json`'s `requirements.file` records (issue #556): `config.requirements` as declared when build read it from the config; absent, `requirements` as given. */
|
|
@@ -2279,12 +2339,13 @@ export function requirementText(name: string, line: RequirementLine): string {
|
|
|
2279
2339
|
* line here. Throws a PartsError when the check could not measure at all.
|
|
2280
2340
|
*/
|
|
2281
2341
|
export function checkStage(input: CheckStageInput, rigc: RigcRunner, bin: string, log: Log): CheckReport {
|
|
2342
|
+
const pageSize = parsePageSize(input.pageSize);
|
|
2282
2343
|
const v = rigc(['--version']);
|
|
2283
2344
|
log(`rig-parts check: ${input.rig} -> ${input.out}`);
|
|
2284
2345
|
const versionLines = v.out.trim().split('\n');
|
|
2285
2346
|
const entryLine = versionLines.find((l) => l.startsWith('entry:'));
|
|
2286
2347
|
log(` ${rigcIdentity(bin, v)}${entryLine === undefined ? '' : `; ${entryLine}`}`);
|
|
2287
|
-
const mode: PackMode = { pageEdges: input.pageEdges ?? DEFAULT_PAGE_EDGES, packShape: input.packShape ?? DEFAULT_PACK_SHAPE };
|
|
2348
|
+
const mode: PackMode = { pageEdges: input.pageEdges ?? DEFAULT_PAGE_EDGES, packShape: input.packShape ?? DEFAULT_PACK_SHAPE, ...(pageSize === undefined ? {} : { pageSize }) };
|
|
2288
2349
|
const r = runCheck(input.rig, input.out, rigc, input.parts, mode, input.source, input.requirements, input.seamPairs === true, input.keepStills === true, input.set, input.allSets === true, input.environment, input.requirementsAs, input.config, input.windBand, input.noExtremes === true, input.supportSource, input.supportFigure);
|
|
2289
2350
|
if (r.figures.environment !== undefined) log(` ${environmentLine(r.figures.environment)}`);
|
|
2290
2351
|
log(` gate rig-play (rigc ${packedBuildLabel(mode)}), verbatim:`);
|
|
@@ -2356,6 +2417,7 @@ export function checkStage(input: CheckStageInput, rigc: RigcRunner, bin: string
|
|
|
2356
2417
|
const setupPainting = fig[SETUP_PAINTING_LINE];
|
|
2357
2418
|
if (setupPainting !== undefined) for (const line of setupPaintingLines(setupPainting)) log(` ${line}`);
|
|
2358
2419
|
for (const line of boundaryColourLines(r.boundaryColour)) log(` ${line}`);
|
|
2420
|
+
for (const line of behindSeamLines(r.behindSeams)) log(` ${line}`);
|
|
2359
2421
|
if (r.requirements !== null) {
|
|
2360
2422
|
for (const [name, line] of Object.entries(r.requirements.lines)) log(` ${requirementText(name, line)}`);
|
|
2361
2423
|
log(` ${summaryText(r.requirements.summary)}`);
|
|
@@ -2624,6 +2686,8 @@ export interface BuildInput {
|
|
|
2624
2686
|
pageEdges: PageEdges;
|
|
2625
2687
|
/** `--pack-shape` for both packed builds, as `pageEdges`; {@link DEFAULT_PACK_SHAPE} when absent. */
|
|
2626
2688
|
packShape?: PackShape;
|
|
2689
|
+
/** `--page-size` for both packed builds, as `pageEdges`; rigc's default when absent (issue #1273). */
|
|
2690
|
+
pageSize?: number;
|
|
2627
2691
|
/** `--requirements`, forwarded to the check (issue #93): read before assemble runs, so a file check would refuse is refused first; absent, `config.requirements` is read in its place (issue #556, {@link buildRequirements}), and with neither nothing moves. */
|
|
2628
2692
|
requirements?: string;
|
|
2629
2693
|
/** `--idle-keys`, forwarded to the rig stage as `rig` takes it (issue #95); {@link DEFAULT_IDLE_KEYS} when absent. */
|
|
@@ -2671,6 +2735,7 @@ export const CHECK_FLAGS_IN_BUILD: Readonly<Record<string, CheckFlagInBuild>> =
|
|
|
2671
2735
|
'--source': { as: 'own', why: 'the painting assemble reads; it is handed to the check only when the requirements file declares setup_painting (issue #978), so check.json otherwise carries no SETUP_POSE_VS_SOURCE — run check --rig <out>/rig --parts <out> --source <painting> for that line' },
|
|
2672
2736
|
'--page-edges': { as: 'forwarded' },
|
|
2673
2737
|
'--pack-shape': { as: 'forwarded' },
|
|
2738
|
+
'--page-size': { as: 'forwarded' },
|
|
2674
2739
|
'--requirements': { as: 'forwarded' },
|
|
2675
2740
|
'--set': { as: 'forwarded' },
|
|
2676
2741
|
'--all-sets': { as: 'forwarded' },
|
|
@@ -2829,11 +2894,13 @@ export function build(input: BuildInput, run: BuildRunners, log: Log): BuildResu
|
|
|
2829
2894
|
|
|
2830
2895
|
let req: BuildRequirements | null = null;
|
|
2831
2896
|
let configRecord: InputFileRecord | null = null;
|
|
2897
|
+
let pageSize: number | undefined;
|
|
2832
2898
|
// Issue #978: the painting is handed to the check only when the requirements file declares setup_painting, which
|
|
2833
2899
|
// cannot be measured without it; a build without that declaration hands it nothing, as before, and writes the same bytes.
|
|
2834
2900
|
let paintingForCheck: string | null = null;
|
|
2835
2901
|
let supportFigure: Mask | undefined;
|
|
2836
2902
|
try {
|
|
2903
|
+
pageSize = parsePageSize(input.pageSize);
|
|
2837
2904
|
// build runs rig next, which needs the whole config, so the full loader is
|
|
2838
2905
|
// asked first: a config rig would refuse is refused before assemble writes
|
|
2839
2906
|
// anything, and under [assemble], as it was before the stage had its own
|
|
@@ -2863,14 +2930,14 @@ export function build(input: BuildInput, run: BuildRunners, log: Log): BuildResu
|
|
|
2863
2930
|
}
|
|
2864
2931
|
|
|
2865
2932
|
try {
|
|
2866
|
-
stages.rig({ config: input.config, parts: out, out: join(out, 'rig'), idleKeys, pageEdges: input.pageEdges, packShape: input.packShape, command: 'build' }, run.rig, run.scratch, prefixed('rig'));
|
|
2933
|
+
stages.rig({ config: input.config, parts: out, out: join(out, 'rig'), idleKeys, pageEdges: input.pageEdges, packShape: input.packShape, ...(pageSize === undefined ? {} : { pageSize }), command: 'build' }, run.rig, run.scratch, prefixed('rig'));
|
|
2867
2934
|
} catch (err) {
|
|
2868
2935
|
return refused('rig', err);
|
|
2869
2936
|
}
|
|
2870
2937
|
|
|
2871
2938
|
let report: CheckReport;
|
|
2872
2939
|
try {
|
|
2873
|
-
report = stages.check({ rig: join(out, 'rig'), parts: out, supportSource: input.source, ...(supportFigure === undefined ? {} : { supportFigure }), out: join(out, 'check'), pageEdges: input.pageEdges, packShape: input.packShape, ...(req === null ? {} : { requirements: req.read, requirementsAs: req.recorded }), ...(paintingForCheck === null ? {} : { source: paintingForCheck }), seamPairs: input.seamPairs === true, keepStills: input.keepStills === true, noExtremes: input.noExtremes === true, ...(input.set === undefined ? {} : { set: input.set }), allSets: input.allSets === true, ...(input.environment === undefined ? {} : { environment: input.environment }), ...(input.windBand === undefined ? {} : { windBand: input.windBand }), ...(configRecord === null ? {} : { config: configRecord }) }, run.check, run.checkBin, prefixed('check'));
|
|
2940
|
+
report = stages.check({ rig: join(out, 'rig'), parts: out, supportSource: input.source, ...(supportFigure === undefined ? {} : { supportFigure }), out: join(out, 'check'), pageEdges: input.pageEdges, packShape: input.packShape, ...(pageSize === undefined ? {} : { pageSize }), ...(req === null ? {} : { requirements: req.read, requirementsAs: req.recorded }), ...(paintingForCheck === null ? {} : { source: paintingForCheck }), seamPairs: input.seamPairs === true, keepStills: input.keepStills === true, noExtremes: input.noExtremes === true, ...(input.set === undefined ? {} : { set: input.set }), allSets: input.allSets === true, ...(input.environment === undefined ? {} : { environment: input.environment }), ...(input.windBand === undefined ? {} : { windBand: input.windBand }), ...(configRecord === null ? {} : { config: configRecord }) }, run.check, run.checkBin, prefixed('check'));
|
|
2874
2941
|
} catch (err) {
|
|
2875
2942
|
return refused('check', err);
|
|
2876
2943
|
}
|
|
@@ -2884,7 +2951,7 @@ export function build(input: BuildInput, run: BuildRunners, log: Log): BuildResu
|
|
|
2884
2951
|
const say = prefixed('loop');
|
|
2885
2952
|
const window = input.leadIn === undefined ? undefined : { periods: input.leadIn };
|
|
2886
2953
|
if (window !== undefined) rmSync(run.scratch, { recursive: true, force: true });
|
|
2887
|
-
const frames = window === undefined ? join(out, 'check', 'idle_frames') : leadInFrames(join(out, 'rig'), run.scratch, window.periods, run.check, { pageEdges: input.pageEdges, packShape: input.packShape ?? DEFAULT_PACK_SHAPE });
|
|
2954
|
+
const frames = window === undefined ? join(out, 'check', 'idle_frames') : leadInFrames(join(out, 'rig'), run.scratch, window.periods, run.check, { pageEdges: input.pageEdges, packShape: input.packShape ?? DEFAULT_PACK_SHAPE, ...(pageSize === undefined ? {} : { pageSize }) });
|
|
2888
2955
|
const physics = report.figures.loop_physics?.length ?? 0;
|
|
2889
2956
|
const lossless = loopStage(frames, join(out, 'idle.png'), 'apng', say, window, physics);
|
|
2890
2957
|
const indexed = loopStage(frames, join(out, 'idle-indexed.png'), 'indexed', say, window, physics);
|
package/src/check.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { readMaterialSources } from './cutmaterialio.ts';
|
|
|
8
8
|
import { CUT_MATERIAL_LINE, checkJointMaterial, type MaterialLine } from './cutmaterial.ts';
|
|
9
9
|
import { ART_JOINT_LINE, artJointLine, type ArtJointLine } from './artjoints.ts';
|
|
10
10
|
import { BOUNDARY_COLOUR_LINE, BOUNDARY_COLOUR_UNMEASURED_CODE, BOUNDARY_COLOUR_UNMEASURED_SUFFIX, measureBoundaryColour, type BoundaryColourMeasured } from './boundarycolour.ts';
|
|
11
|
+
import { BEHIND_SEAM_LINE, measureBehindSeams, type BehindSeamsMeasured } from './behindseams.ts';
|
|
11
12
|
import { baseAnchorMoves, type AnchorRegion } from './baseanchor.ts';
|
|
12
13
|
/**
|
|
13
14
|
* The check stage: build a rig through rig-c, gate it under both
|
|
@@ -99,7 +100,7 @@ import { basename, delimiter, dirname, isAbsolute, join, relative, resolve, sep
|
|
|
99
100
|
import { measureRecomposite, type RecompositeFigures, recompositeRecord, scenePhrase, sourceInRig, figureSilhouette } from './assemble.ts';
|
|
100
101
|
import { type BoneTransform, computeExactFrameTransforms, cropToSpineY, normaliseDegrees, toBoneLocal } from './coords.ts';
|
|
101
102
|
import { capBox, inDisc } from './limbs.ts';
|
|
102
|
-
import { motionSeamProblems } from './motionseams.ts';
|
|
103
|
+
import { motionSeamProblems, type MotionSeamDeclaration } from './motionseams.ts';
|
|
103
104
|
import { seamPoseFrame, seamStaticRange, type SeamPoseAtWorst } from './motionseampose.ts';
|
|
104
105
|
import { coreCompileGuideLine, PartsError, type Problem, refuseIfAny } from './errors.ts';
|
|
105
106
|
import { framesInside, IDLE_FPS, TIME_SLACK } from './motion.ts';
|
|
@@ -329,10 +330,27 @@ export const PACK_SHAPES = ['rect', 'polygon'] as const;
|
|
|
329
330
|
export type PackShape = (typeof PACK_SHAPES)[number];
|
|
330
331
|
export const DEFAULT_PACK_SHAPE: PackShape = 'polygon';
|
|
331
332
|
|
|
332
|
-
/**
|
|
333
|
+
/** The refusal of a `--page-size` that is not a positive integer (issue #1273). */
|
|
334
|
+
export const PACK_PAGE_SIZE = 'PACK_PAGE_SIZE';
|
|
335
|
+
|
|
336
|
+
/** Parse `--page-size <px>`: a positive integer, handed to rigc verbatim; anything else is refused under {@link PACK_PAGE_SIZE}. */
|
|
337
|
+
export function parsePageSize(value: string | number | undefined): number | undefined {
|
|
338
|
+
if (value === undefined) return undefined;
|
|
339
|
+
const shown = typeof value === 'string' ? JSON.stringify(value) : String(value);
|
|
340
|
+
if (typeof value === 'number') {
|
|
341
|
+
if (Number.isSafeInteger(value) && value >= 1) return value;
|
|
342
|
+
throw new PartsError([{ code: PACK_PAGE_SIZE, object: '--page-size', detail: `${shown} found; a positive integer is required` }]);
|
|
343
|
+
}
|
|
344
|
+
const n = Number(value);
|
|
345
|
+
if (/^[1-9][0-9]*$/.test(value) && Number.isSafeInteger(n) && n >= 1) return n;
|
|
346
|
+
throw new PartsError([{ code: PACK_PAGE_SIZE, object: '--page-size', detail: `${shown} found; a positive integer is required` }]);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/** How a packed build packs: its `--page-edges`, its `--pack-shape`, and its optional `--page-size`, each handed to rigc verbatim. */
|
|
333
350
|
export interface PackMode {
|
|
334
351
|
pageEdges: PageEdges;
|
|
335
352
|
packShape: PackShape;
|
|
353
|
+
pageSize?: number;
|
|
336
354
|
}
|
|
337
355
|
|
|
338
356
|
/** Both defaults, {@link DEFAULT_PAGE_EDGES} and {@link DEFAULT_PACK_SHAPE}. */
|
|
@@ -348,7 +366,17 @@ export const GATE_PROFILE = 'rig-play';
|
|
|
348
366
|
|
|
349
367
|
/** The packed build's rigc arguments after `--out <dir>`, as every stage that packs passes them. */
|
|
350
368
|
export function packedBuildArgs(mode: PackMode): string[] {
|
|
351
|
-
|
|
369
|
+
const pageSize = parsePageSize(mode.pageSize);
|
|
370
|
+
return [
|
|
371
|
+
'--profile',
|
|
372
|
+
GATE_PROFILE,
|
|
373
|
+
'--pack',
|
|
374
|
+
'--page-edges',
|
|
375
|
+
mode.pageEdges,
|
|
376
|
+
'--pack-shape',
|
|
377
|
+
mode.packShape,
|
|
378
|
+
...(pageSize === undefined ? [] : ['--page-size', String(pageSize)]),
|
|
379
|
+
];
|
|
352
380
|
}
|
|
353
381
|
|
|
354
382
|
/** The packed build as a label: the rigc command line that was run, after `rigc`. */
|
|
@@ -2693,8 +2721,8 @@ export interface CheckFigures {
|
|
|
2693
2721
|
gate_spine_html_green: boolean;
|
|
2694
2722
|
/** Which rigc entry gated the build ({@link readRigcEntry}): provenance, not a bar. */
|
|
2695
2723
|
rigc_entry: RigcEntryRecord;
|
|
2696
|
-
/** How the artifact's page was packed: the `--page-edges` and `--pack-shape` rigc was handed, which its pack line was read to agree with ({@link packEdgeProblems}). Provenance, not a bar. */
|
|
2697
|
-
pack_mode: { page_edges: PageEdges; pack_shape: PackShape };
|
|
2724
|
+
/** How the artifact's page was packed: the `--page-edges` and `--pack-shape` rigc was handed, which its pack line was read to agree with ({@link packEdgeProblems}), and `--page-size` when given (issue #1273). Provenance, not a bar. */
|
|
2725
|
+
pack_mode: { page_edges: PageEdges; pack_shape: PackShape; page_size?: number };
|
|
2698
2726
|
/**
|
|
2699
2727
|
* Written only under `--environment` (issue #538): the `rigc-environment/1` schedule every measured render was posed
|
|
2700
2728
|
* under — the path as the command line gave it, the sha256 of the bytes read, and how many steps rigc's reader read
|
|
@@ -2788,6 +2816,8 @@ export interface CheckFigures {
|
|
|
2788
2816
|
[CUT_MATERIAL_LINE]?: MaterialLine;
|
|
2789
2817
|
/** Issue #942: only when requirements declares boundary_colour; undeclared writes no key and prints a SKIP. */
|
|
2790
2818
|
[BOUNDARY_COLOUR_LINE]?: BoundaryColourMeasured;
|
|
2819
|
+
/** Issue #1314: omitted unless behind_seams is declared; undeclared preserves existing check.json bytes. */
|
|
2820
|
+
[BEHIND_SEAM_LINE]?: BehindSeamsMeasured;
|
|
2791
2821
|
PASS: boolean;
|
|
2792
2822
|
}
|
|
2793
2823
|
|
|
@@ -3034,7 +3064,7 @@ export function barsNotMet(fig: Readonly<Record<string, unknown>>): string[] {
|
|
|
3034
3064
|
isRecord(fig.sets) &&
|
|
3035
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));
|
|
3036
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');
|
|
3037
|
-
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]) {
|
|
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]) {
|
|
3038
3068
|
const l = fig[n];
|
|
3039
3069
|
if (typeof l === 'object' && l !== null && (l as { status?: unknown }).status === 'FAIL') out.push(n);
|
|
3040
3070
|
}
|
|
@@ -3087,6 +3117,8 @@ export interface CheckReport {
|
|
|
3087
3117
|
figureOpenings: FigureOpeningReading;
|
|
3088
3118
|
/** Issue #942: the boundary colour-step reading; null when undeclared (the SKIP line is printed, nothing written). */
|
|
3089
3119
|
boundaryColour: BoundaryColourMeasured | null;
|
|
3120
|
+
/** Issue #1314: null when undeclared; the console still names SKIP and HOLE. */
|
|
3121
|
+
behindSeams: BehindSeamsMeasured | null;
|
|
3090
3122
|
/** `CLOTH_SETTLES` (issue #501): a warning, never a bar — in `check.json` only when the rig declares a physics constraint and has an idle; its SKIP is printed either way. */
|
|
3091
3123
|
cloth: ClothLine;
|
|
3092
3124
|
/** `WIND_BAND` (issue #590): the steady-wind band each declared seam pair holds, written under `--wind-band` only. */
|
|
@@ -3147,7 +3179,7 @@ export function checkStatuses(fig: CheckFigures): Record<string, CheckStatus> {
|
|
|
3147
3179
|
const bar = (name: string, measured: boolean): CheckStatus => (!measured ? 'SKIP' : notMet.includes(name) ? 'FAIL' : 'PASS');
|
|
3148
3180
|
const out: Record<string, CheckStatus> = { gate: bar('gate', true), loop: bar('loop', fig.loop_max_diff !== null), seam: bar('seam', fig.seam_mean !== null) };
|
|
3149
3181
|
for (const n of JUDGEMENT_LINES) out[n] = fig[n].status;
|
|
3150
|
-
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, COINCIDE_LINE] as const) {
|
|
3182
|
+
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) {
|
|
3151
3183
|
const l = fig[n];
|
|
3152
3184
|
if (l !== undefined) out[n] = l.status;
|
|
3153
3185
|
}
|
|
@@ -4773,15 +4805,15 @@ export function motionSeamRequiredLine(r: MotionSeamRequired): string {
|
|
|
4773
4805
|
/**
|
|
4774
4806
|
* The neighbour pairs the inputs declare, in their order: each limb's
|
|
4775
4807
|
* consecutive segments (`parts.json`'s limb records, by segment), then each
|
|
4776
|
-
* `seam` requirement's part and neighbour, then proven roots when rig.json is supplied. A pair named twice, in either
|
|
4808
|
+
* `seam` requirement's part and neighbour, then explicit parts and requirements motion_seams, then proven roots when rig.json is supplied. A pair named twice, in either
|
|
4777
4809
|
* order, is one pair with both declarations.
|
|
4778
4810
|
*/
|
|
4779
|
-
export function motionSeamPairs(parts: PartsFile, seams: ReadonlyArray<{ name: string; part: string; neighbour: string }>, rig?: Record<string, unknown>, readSetup?: (candidates: readonly MotionSeamPair[]) => readonly MotionRootSetupRow[]): MotionSeamPair[] {
|
|
4780
|
-
return motionSeamSelection(parts, seams, rig, readSetup).pairs;
|
|
4811
|
+
export function motionSeamPairs(parts: PartsFile, seams: ReadonlyArray<{ name: string; part: string; neighbour: string }>, rig?: Record<string, unknown>, readSetup?: (candidates: readonly MotionSeamPair[]) => readonly MotionRootSetupRow[], requirementsMotionSeams?: readonly MotionSeamDeclaration[]): MotionSeamPair[] {
|
|
4812
|
+
return motionSeamSelection(parts, seams, rig, readSetup, requirementsMotionSeams).pairs;
|
|
4781
4813
|
}
|
|
4782
4814
|
|
|
4783
4815
|
/** Complete selection: a valid zero setup band is named separately, never a fabricated pair or PASS. */
|
|
4784
|
-
export function motionSeamSelection(parts: PartsFile, seams: ReadonlyArray<{ name: string; part: string; neighbour: string }>, rig?: Record<string, unknown>, readSetup?: (candidates: readonly MotionSeamPair[]) => readonly MotionRootSetupRow[]): MotionSeamSelection {
|
|
4816
|
+
export function motionSeamSelection(parts: PartsFile, seams: ReadonlyArray<{ name: string; part: string; neighbour: string }>, rig?: Record<string, unknown>, readSetup?: (candidates: readonly MotionSeamPair[]) => readonly MotionRootSetupRow[], requirementsMotionSeams?: readonly MotionSeamDeclaration[]): MotionSeamSelection {
|
|
4785
4817
|
const out: MotionSeamPair[] = [];
|
|
4786
4818
|
const unmeasuredRoots: MotionUnmeasuredRoot[] = [];
|
|
4787
4819
|
const add = (a: string, b: string, declared: string, joint?: string): void => {
|
|
@@ -4805,6 +4837,10 @@ export function motionSeamSelection(parts: PartsFile, seams: ReadonlyArray<{ nam
|
|
|
4805
4837
|
refuseIfAny(motionSeamProblems(parts.motion_seams, new Set(parts.parts.map(p => p.name)), 'parts.json motion_seams', 'CHECK_MOTION_SEAM_DECLARATION'));
|
|
4806
4838
|
parts.motion_seams.forEach((r, i) => add(r.part, r.neighbour, `motion_seams[${i}]`));
|
|
4807
4839
|
}
|
|
4840
|
+
if (requirementsMotionSeams !== undefined) {
|
|
4841
|
+
refuseIfAny(motionSeamProblems(requirementsMotionSeams, new Set(parts.parts.map(p => p.name)), 'requirements.motion_seams', 'REQUIREMENTS_RESOLVES'));
|
|
4842
|
+
requirementsMotionSeams.forEach((r, i) => add(r.part, r.neighbour, `requirements.motion_seams[${i}]`));
|
|
4843
|
+
}
|
|
4808
4844
|
const candidates = rig === undefined ? [] : motionRootCandidates(parts, rig);
|
|
4809
4845
|
const selected: MotionSeamPair[] = [];
|
|
4810
4846
|
if (candidates.length > 0) {
|
|
@@ -6606,6 +6642,7 @@ function renderExtremes(build: string, out: string, animations: readonly string[
|
|
|
6606
6642
|
* anything it did not before.
|
|
6607
6643
|
*/
|
|
6608
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 {
|
|
6645
|
+
const pageSize = parsePageSize(mode.pageSize);
|
|
6609
6646
|
let inp: CheckInputs;
|
|
6610
6647
|
let reqFile: RequirementsFile | null = null;
|
|
6611
6648
|
let reqRecord: RequirementsFileRecord | null = null;
|
|
@@ -6660,7 +6697,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6660
6697
|
}
|
|
6661
6698
|
take(() => refuseIfAny(exceptionProblems(file, ready.parts, ready.noParts)));
|
|
6662
6699
|
// A seam's pairs are read off parts.json's art (issue #111); both resolvers' problems are named in one refusal.
|
|
6663
|
-
if (file.requirements.some((r) => r.kind === 'seam')) {
|
|
6700
|
+
if (file.requirements.some((r) => r.kind === 'seam') || file.motion_seams !== undefined) {
|
|
6664
6701
|
const parts = ready.parts;
|
|
6665
6702
|
seams = take(() => resolveSeams(file, parts === null ? null : parts.parts.map((p) => p.name), ready.noParts, (n) => {
|
|
6666
6703
|
const rec = (parts as PartsFile).parts.find((p) => p.name === n) as PartRecord;
|
|
@@ -7095,6 +7132,9 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7095
7132
|
const motionRootProblems: Problem[] = [];
|
|
7096
7133
|
// Issue #941: under seam_over_motion.required, the same render's gapOpen on every frame of every declared pair.
|
|
7097
7134
|
const seamRequired = seamOverMotionRequired(reqFile);
|
|
7135
|
+
const behindDeclared = reqFile?.behind_seams;
|
|
7136
|
+
let behindPairs: readonly MotionSeamPair[] = [];
|
|
7137
|
+
let behindStockDir: string | null = null;
|
|
7098
7138
|
let backgroundRows: MotionBackgroundRow[] = [];
|
|
7099
7139
|
const motionCellEvidence: MotionCellSidecar = { spec: 'rig-parts-seam-cells/1', frames: [] };
|
|
7100
7140
|
{
|
|
@@ -7135,8 +7175,9 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7135
7175
|
if (rendered.status !== 0) refuseIfAny(rigcFailed('render --seam (body-root setup observation)', rendered, rendered.out.split('\n').filter(line => line.includes('FAIL') || line.includes('rigc:'))));
|
|
7136
7176
|
return readMotionRootSetup(renderDir, fps, candidates);
|
|
7137
7177
|
} finally { rmSync(setupDir, { recursive: true, force: true }); }
|
|
7138
|
-
});
|
|
7178
|
+
}, reqFile?.motion_seams);
|
|
7139
7179
|
const { pairs, unmeasuredRoots } = selection;
|
|
7180
|
+
behindPairs = pairs;
|
|
7140
7181
|
const slotNames = new Set((Array.isArray(inp.rig.slots) ? inp.rig.slots : []).filter(isRecord).map((sl) => String(sl.name)));
|
|
7141
7182
|
for (const p of pairs) {
|
|
7142
7183
|
const missing = [p.a, p.b].filter((n) => !slotNames.has(n));
|
|
@@ -7156,8 +7197,9 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7156
7197
|
const activeDest = stripped === null ? seamMotionDir : join(seamMotionDir, env === null ? 'default' : 'active');
|
|
7157
7198
|
const renderedWorlds = new Set<'default' | 'still'>();
|
|
7158
7199
|
const hasRoots = read.some(p => p.root !== undefined);
|
|
7159
|
-
const r = measured(['render', '--candidate', buildDir, '--seam', list, ...(seamRequired ? ['--seam-cells'] : []), '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--geometry', '--out', activeDest]);
|
|
7200
|
+
const r = measured(['render', '--candidate', buildDir, '--seam', list, ...(seamRequired || behindDeclared !== undefined ? ['--seam-cells'] : []), '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--geometry', '--out', activeDest]);
|
|
7160
7201
|
if (r.status !== 0) refuseIfAny(rigcFailed(`render --seam ${list} --fps ${fps}`, r, r.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
|
|
7202
|
+
behindStockDir = activeDest;
|
|
7161
7203
|
const activeWorldRows: MotionSeamWorldRow[] = [];
|
|
7162
7204
|
motionSeam = motionSeamLine(pairs, animationNames, fps, readMotionSeams(activeDest, animationNames, fps, read, {}, stripped !== null && env === null ? activeWorldRows : undefined, hasRoots ? motionRootDrawOrderReader(activeDest) : undefined), undefined, motionRootProblems, unmeasuredRoots);
|
|
7163
7205
|
if (seamRequired) backgroundRows = readMotionSeamBackground(activeDest, animationNames, fps, read,
|
|
@@ -7428,6 +7470,17 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7428
7470
|
const boundaryDeclared = reqFile?.boundary_colour;
|
|
7429
7471
|
const boundaryColour = boundaryDeclared === undefined || inp.parts === null || inp.idleDuration === null ? null
|
|
7430
7472
|
: measureBoundaryColour(officialRenderer(), { build: buildDir, stage: inp.stage, parts: inp.parts, partsDir: inp.partsDir, imagesDir: typeof inp.rig.images === 'string' ? resolve(inp.rigDir, inp.rig.images) : join(inp.rigDir, 'images'), rig: inp.rig, fps: IDLE_FPS }, boundaryDeclared, problems);
|
|
7473
|
+
// Read the same accepted build and full seam render. Until active-world and
|
|
7474
|
+
// alternate-skin pose binding is implemented, those modes are named unread.
|
|
7475
|
+
const behindUnsupported = [
|
|
7476
|
+
...(env === null ? [] : ['--environment active-world pose binding is not measured']),
|
|
7477
|
+
...(set === undefined ? [] : ['--set skin binding is not measured']),
|
|
7478
|
+
...(allSets ? ['--all-sets skin binding is not measured'] : []),
|
|
7479
|
+
];
|
|
7480
|
+
const behindSeams = behindDeclared === undefined ? null : measureBehindSeams(officialRenderer(), {
|
|
7481
|
+
build: buildDir, rig: inp.rig, pairs: behindPairs, stockDir: behindStockDir, fps: IDLE_FPS,
|
|
7482
|
+
...(behindUnsupported.length === 0 ? {} : { unsupported: behindUnsupported.join('; ') }),
|
|
7483
|
+
}, behindDeclared, problems);
|
|
7431
7484
|
|
|
7432
7485
|
// 5. the scene's declared requirements (issue #93), only under --requirements
|
|
7433
7486
|
const reqProblems: Problem[] = [];
|
|
@@ -7439,7 +7492,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7439
7492
|
const figures: CheckFigures = {
|
|
7440
7493
|
gate_spine_html_green: htmlGreen,
|
|
7441
7494
|
rigc_entry: rigcEntry,
|
|
7442
|
-
pack_mode: { page_edges: mode.pageEdges, pack_shape: mode.packShape },
|
|
7495
|
+
pack_mode: { page_edges: mode.pageEdges, pack_shape: mode.packShape, ...(pageSize === undefined ? {} : { page_size: pageSize }) },
|
|
7443
7496
|
...(env === null ? {} : { environment: env }),
|
|
7444
7497
|
loop_max_diff: loop === null ? null : loop.max,
|
|
7445
7498
|
...(loopPhysics === null ? {} : { loop_physics: loopPhysics.map(row => ({ ...row, ...checkRow('loop_physics', 'rig', false, []) })) }),
|
|
@@ -7474,6 +7527,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7474
7527
|
...(artJoints === null ? {} : { [ART_JOINT_LINE]: artJoints }),
|
|
7475
7528
|
...(setupPainting === null ? {} : { [SETUP_PAINTING_LINE]: setupPainting }),
|
|
7476
7529
|
...(boundaryColour === null ? {} : { [BOUNDARY_COLOUR_LINE]: boundaryColour }),
|
|
7530
|
+
...(behindSeams === null ? {} : { [BEHIND_SEAM_LINE]: behindSeams }),
|
|
7477
7531
|
...(cutMaterial === null ? {} : { [CUT_MATERIAL_LINE]: cutMaterial }),
|
|
7478
7532
|
...(reqBlock === null ? {} : { requirements: reqBlock }),
|
|
7479
7533
|
PASS: false,
|
|
@@ -7545,6 +7599,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7545
7599
|
if (artJoints !== null) tally(ART_JOINT_LINE, artJoints.status === 'SKIP' ? (artJoints.reason ?? 'no declared limit') : null);
|
|
7546
7600
|
if (setupPainting !== null) tally(SETUP_PAINTING_LINE, setupPainting.status === 'SKIP' ? (setupPainting.reason ?? 'no declared limit') : null);
|
|
7547
7601
|
if (boundaryColour !== null) tally(BOUNDARY_COLOUR_LINE, null);
|
|
7602
|
+
if (behindSeams !== null) tally(BEHIND_SEAM_LINE, behindSeams.status === 'SKIP' ? 'HOLE: no complete authored threshold reading; not a pass' : null);
|
|
7548
7603
|
// Issue #348: the level bar where it is written; a line whose every foot no frame posed says SKIP and is not measured.
|
|
7549
7604
|
if (level !== null) tally(LEVEL_LINE, level.status === 'SKIP' ? (level.reason ?? '') : null);
|
|
7550
7605
|
// Issue #347: the stress bar is counted where it is written — on every rig with a handwear part and an idle.
|
|
@@ -7574,6 +7629,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7574
7629
|
figureOpenings,
|
|
7575
7630
|
cloth,
|
|
7576
7631
|
boundaryColour,
|
|
7632
|
+
behindSeams,
|
|
7577
7633
|
...(sweepSteps.size === 0 ? {} : { sweepSteps }),
|
|
7578
7634
|
...(windBandRead === null ? {} : { windBand: windBandRead }),
|
|
7579
7635
|
};
|
|
@@ -8254,6 +8310,52 @@ export function carrierFrame(geo: IdleGeometry | null, bone: string | null): ((i
|
|
|
8254
8310
|
};
|
|
8255
8311
|
}
|
|
8256
8312
|
|
|
8313
|
+
/**
|
|
8314
|
+
* Root-to-carrier excitation measured from the idle's world transforms, never
|
|
8315
|
+
* from keys: inherited and physics motion count too. Origin travel and both
|
|
8316
|
+
* affine basis columns use the travel reading's round3 zeroing. A stationary
|
|
8317
|
+
* origin alone does not prove a stationary carrier. Null means incomplete or
|
|
8318
|
+
* unusable transforms or ancestry, not a static chain. The driver is the
|
|
8319
|
+
* nearest measured moving bone to the carrier, not an attribution to a key.
|
|
8320
|
+
*/
|
|
8321
|
+
export function carrierExcitation(rig: Record<string, unknown>, geo: IdleGeometry | null, bone: string | null): { chain: string[]; driver: string | null } | null {
|
|
8322
|
+
if (bone === null || geo === null || geo.frames.length < 2 || geo.frameBones.length !== geo.frames.length) return null;
|
|
8323
|
+
const bones = (Array.isArray(rig.bones) ? rig.bones : []).filter(isRecord);
|
|
8324
|
+
const chain: string[] = [];
|
|
8325
|
+
for (let at: string | null = bone; at !== null;) {
|
|
8326
|
+
if (chain.includes(at)) return null;
|
|
8327
|
+
const matches = bones.filter(b => b.name === at);
|
|
8328
|
+
if (matches.length !== 1) return null;
|
|
8329
|
+
const parent: unknown = matches[0].parent;
|
|
8330
|
+
if (parent !== undefined && typeof parent !== 'string') return null;
|
|
8331
|
+
chain.push(at);
|
|
8332
|
+
at = typeof parent === 'string' ? parent : null;
|
|
8333
|
+
}
|
|
8334
|
+
chain.reverse();
|
|
8335
|
+
const fields = ['worldX', 'worldY', 'a', 'c', 'b', 'd'] as const;
|
|
8336
|
+
const world = (rows: unknown, name: string): BoneWorld | null => {
|
|
8337
|
+
const matches = Array.isArray(rows) ? rows.filter(isRecord).filter(b => b.name === name) : [];
|
|
8338
|
+
if (matches.length !== 1) return null;
|
|
8339
|
+
const b = matches[0];
|
|
8340
|
+
if (!fields.every(key => typeof b[key] === 'number' && Number.isFinite(b[key]))) return null;
|
|
8341
|
+
const m = b as unknown as BoneWorld;
|
|
8342
|
+
const det = m.a * m.d - m.b * m.c;
|
|
8343
|
+
return Number.isFinite(det) && det !== 0 ? m : null;
|
|
8344
|
+
};
|
|
8345
|
+
let driver: string | null = null;
|
|
8346
|
+
for (const name of chain) {
|
|
8347
|
+
if (world(geo.setupBones, name) === null) return null;
|
|
8348
|
+
const frames = geo.frameBones.map(rows => world(rows, name));
|
|
8349
|
+
if (frames.some(m => m === null)) return null;
|
|
8350
|
+
const span = (key: typeof fields[number]): number => {
|
|
8351
|
+
const values = frames.map(m => (m as BoneWorld)[key]);
|
|
8352
|
+
return Math.max(...values) - Math.min(...values);
|
|
8353
|
+
};
|
|
8354
|
+
if ([edgeLength(span('worldX'), span('worldY')), edgeLength(span('a'), span('c')), edgeLength(span('b'), span('d'))].some(travel => round3(travel) !== 0)) driver = name;
|
|
8355
|
+
}
|
|
8356
|
+
return { chain, driver };
|
|
8357
|
+
}
|
|
8358
|
+
|
|
8257
8359
|
/**
|
|
8258
8360
|
* (4) Each swinging part's tip travels further than its root: how far the art
|
|
8259
8361
|
* in the lower half of the part's box travels against the upper half — the
|
|
@@ -8284,6 +8386,9 @@ export function carrierFrame(geo: IdleGeometry | null, bone: string | null): ((i
|
|
|
8284
8386
|
* at the line's precision is 0, so a part that rides its carrier whole reads
|
|
8285
8387
|
* 0 / 0 and fails, not a ratio of round-off. Issue #994 applies the fixed
|
|
8286
8388
|
* 0.5 rig px art-grid policy to max(root, tip) of a link part after this guard.
|
|
8389
|
+
* Issue #1308 distinguishes a rigid 0 / 0 on a measured static carrier chain
|
|
8390
|
+
* with CHECK_CARRIER_NOT_EXCITED; incomplete excitation data keeps the prior
|
|
8391
|
+
* failure. Below-floor rows retain their policy and name the measured driver.
|
|
8287
8392
|
*/
|
|
8288
8393
|
function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems: Problem[], excepted: TipExceptions = NO_TIP_EXCEPTIONS): JudgementLine {
|
|
8289
8394
|
const swing = partsTagged(inp.parts, SWING_TAGS);
|
|
@@ -8327,7 +8432,7 @@ function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems
|
|
|
8327
8432
|
}
|
|
8328
8433
|
// Issue #349: a limb segment is rigid on its one bone and turns at its joint; it does not hang, so no tip trails a root.
|
|
8329
8434
|
if (p.limb !== undefined) {
|
|
8330
|
-
rows.push({ ...checkRow('TIP_OVER_ROOT.parts', 'part', false, [p.name]), part: p.name, unmeasured: p.limb.band !== undefined ? `a hybrid joint band (config.limbs.${p.limb.name}): it bends between adjacent carriers, does not hang, and is not held to
|
|
8435
|
+
rows.push({ ...checkRow('TIP_OVER_ROOT.parts', 'part', false, [p.name]), part: p.name, unmeasured: p.limb.band !== undefined ? `a hybrid joint band (config.limbs.${p.limb.name}): it bends between adjacent carriers, does not hang, and is not held to the tip-over-root bar` : `a limb segment (config.limbs.${p.limb.name}), rigid on its one bone "${p.limb.bone}": it turns at its joint and does not hang, so it is not held to the bar` });
|
|
8331
8436
|
continue;
|
|
8332
8437
|
}
|
|
8333
8438
|
const rises = excepted.rises.includes(p.name);
|
|
@@ -8363,7 +8468,9 @@ function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems
|
|
|
8363
8468
|
// Structural 0 / 0 stays a failure before the link-only magnitude policy (issue #994).
|
|
8364
8469
|
if (!rigid && hanging.onLink && Math.max(c.root, c.tip) < TIP_TRAVEL_FLOOR) {
|
|
8365
8470
|
belowGrid++;
|
|
8471
|
+
const excitation = carrierExcitation(inp.rig, idleGeo, hangFound);
|
|
8366
8472
|
rows[rows.length - 1] = { ...rows[rows.length - 1], travel_floor_rig_px: TIP_TRAVEL_FLOOR,
|
|
8473
|
+
measured_driver: excitation === null ? 'unavailable' : excitation.driver ?? 'none',
|
|
8367
8474
|
unmeasured: "below half a rig pixel: the motion does not show on the art's own grid" };
|
|
8368
8475
|
continue;
|
|
8369
8476
|
}
|
|
@@ -8371,7 +8478,16 @@ function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems
|
|
|
8371
8478
|
const against = hang === null ? 'in the world' : `against \`${hang}\`, the bone it hangs from`;
|
|
8372
8479
|
const inWorld = hang === null ? '' : `; in the world ${round3(w.tip)} and ${round3(w.root)}, ratio ${worldRatio ?? 'undefined'}`;
|
|
8373
8480
|
const travels = `the art in its ${tipHalf} half travels ${round3(t.tip)} rig px and in its ${rootHalf} half ${round3(t.root)} rig px ${against}`;
|
|
8374
|
-
|
|
8481
|
+
const excitation = rigid && hang !== null ? carrierExcitation(inp.rig, idleGeo, hang) : null;
|
|
8482
|
+
if (rigid && excitation !== null && excitation.driver === null) {
|
|
8483
|
+
failed = true;
|
|
8484
|
+
rows[rows.length - 1] = { ...rows[rows.length - 1], carrier_chain: excitation.chain, measured_driver: 'none' };
|
|
8485
|
+
problems.push({
|
|
8486
|
+
code: 'CHECK_CARRIER_NOT_EXCITED',
|
|
8487
|
+
object: `part "${p.name}", box ${p.x},${p.y} ${p.w}x${p.h} rig px, posed by the idle's geometry${rests ? ', declared rests' : ''}${rises ? ', declared rises' : ''}`,
|
|
8488
|
+
detail: `${travels}; root-to-carrier chain [${excitation.chain.map(name => `\`${name}\``).join(' > ')}] has no measured world translation or affine motion on the sampled idle frames; a moving carrier or ancestor is required to measure trailing motion — excite that chain and measure again`,
|
|
8489
|
+
});
|
|
8490
|
+
} else if (!ok && rests && !rigid) {
|
|
8375
8491
|
failed = true;
|
|
8376
8492
|
problems.push({
|
|
8377
8493
|
code: 'CHECK_TIP_OVER_ROOT',
|
|
@@ -8415,7 +8531,7 @@ function tipLine(inp: FullInputs, geometryPath: string, frames: number, problems
|
|
|
8415
8531
|
...(excepted.rests.length === 0 ? {} : { rest_ratio_ceiling: TIP_REST_RATIO_CEILING }) };
|
|
8416
8532
|
if (measured === 0) {
|
|
8417
8533
|
const reasons = rows.map((r) => {
|
|
8418
|
-
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`;
|
|
8534
|
+
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)}`;
|
|
8419
8535
|
return `${String(r.part)}: ${String(r.unmeasured)}${travel}`;
|
|
8420
8536
|
});
|
|
8421
8537
|
return { status: 'SKIP', reason: `none of ${quoteParts(swing)} could be measured: ${reasons.join('; ')}`,
|
package/src/checkrow.ts
CHANGED
|
@@ -9,6 +9,27 @@ export const CHECK_ROW_PATHS = {
|
|
|
9
9
|
'ART_JOINT_DISTANCE.joints': ['ART_JOINT_DISTANCE.joints'],
|
|
10
10
|
'BOUNDARY_COLOUR_STEP.over': ['BOUNDARY_COLOUR_STEP.over'],
|
|
11
11
|
'BOUNDARY_COLOUR_STEP.unmeasured': ['BOUNDARY_COLOUR_STEP.unmeasured'],
|
|
12
|
+
'BEHIND_PART_SEAMS.pairs': ['BEHIND_PART_SEAMS.pairs'],
|
|
13
|
+
'BEHIND_PART_SEAMS.pairs[].setup': ['BEHIND_PART_SEAMS.pairs[].setup'],
|
|
14
|
+
'BEHIND_PART_SEAMS.pairs[].frames': ['BEHIND_PART_SEAMS.pairs[].frames'],
|
|
15
|
+
'BEHIND_PART_SEAMS.samples': [
|
|
16
|
+
'BEHIND_PART_SEAMS.pairs[].setup.motion_opened.samples', 'BEHIND_PART_SEAMS.pairs[].setup.standing.samples',
|
|
17
|
+
'BEHIND_PART_SEAMS.pairs[].frames[].motion_opened.samples', 'BEHIND_PART_SEAMS.pairs[].frames[].standing.samples',
|
|
18
|
+
],
|
|
19
|
+
'BEHIND_PART_SEAMS.contributors': [
|
|
20
|
+
'BEHIND_PART_SEAMS.pairs[].setup.motion_opened.samples[].contributors', 'BEHIND_PART_SEAMS.pairs[].setup.standing.samples[].contributors',
|
|
21
|
+
'BEHIND_PART_SEAMS.pairs[].frames[].motion_opened.samples[].contributors', 'BEHIND_PART_SEAMS.pairs[].frames[].standing.samples[].contributors',
|
|
22
|
+
],
|
|
23
|
+
'BEHIND_PART_SEAMS.hits': [
|
|
24
|
+
'BEHIND_PART_SEAMS.pairs[].motion_opened.frames', 'BEHIND_PART_SEAMS.pairs[].standing.frames',
|
|
25
|
+
'BEHIND_PART_SEAMS.pairs[].motion_opened.worst', 'BEHIND_PART_SEAMS.pairs[].standing.worst',
|
|
26
|
+
],
|
|
27
|
+
'BEHIND_PART_SEAMS.spans': ['BEHIND_PART_SEAMS.pairs[].motion_opened.spans', 'BEHIND_PART_SEAMS.pairs[].standing.spans'],
|
|
28
|
+
'BEHIND_PART_SEAMS.unread_corridors': [
|
|
29
|
+
'BEHIND_PART_SEAMS.pairs[].setup.standing.unread_corridors',
|
|
30
|
+
'BEHIND_PART_SEAMS.pairs[].frames[].standing.unread_corridors',
|
|
31
|
+
],
|
|
32
|
+
'BEHIND_PART_SEAMS.unmeasured': ['BEHIND_PART_SEAMS.unmeasured'],
|
|
12
33
|
'CLOTH_SETTLES.rows': ['CLOTH_SETTLES.rows'],
|
|
13
34
|
'CUT_JOINT_MATERIAL.rows': ['CUT_JOINT_MATERIAL.rows'],
|
|
14
35
|
'FEET_STAY_LEVEL.feet': ['FEET_STAY_LEVEL.feet'],
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Config writers relocate edited directories once, without rewriting authored receipt files. */
|
|
2
|
+
import { isAbsolute, relative, resolve, sep } from 'node:path';
|
|
3
|
+
import { configFileReferences } from './config.ts';
|
|
4
|
+
|
|
5
|
+
function object(value: unknown): value is Record<string, unknown> {
|
|
6
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Preserve the public reference inventory while giving writers canonical edited-part paths. */
|
|
10
|
+
export function relocateConfigReferences(raw: unknown, configDir: string, out: string, mode: 'relative' | 'absolute'): void {
|
|
11
|
+
const refs = configFileReferences(raw);
|
|
12
|
+
const assemble = object(raw) ? raw.assemble : undefined;
|
|
13
|
+
const edited = object(assemble) ? assemble.edited_parts : undefined;
|
|
14
|
+
// Do not repair invalid dirs or replace the loader's existing relative-only refusals.
|
|
15
|
+
if (object(edited) && typeof edited.dir === 'string' && edited.dir.trim() !== '' &&
|
|
16
|
+
!isAbsolute(edited.dir) && !/^(?:[\\/]|[A-Za-z]:[\\/])/.test(edited.dir)) {
|
|
17
|
+
edited.dir = relative(resolve(out), resolve(configDir, edited.dir)).split(sep).join('/') || '.';
|
|
18
|
+
}
|
|
19
|
+
for (const ref of refs) {
|
|
20
|
+
if (ref.at.startsWith('assemble.edited_parts.receipts[')) continue;
|
|
21
|
+
if (mode === 'absolute' && isAbsolute(ref.value)) continue;
|
|
22
|
+
const target = resolve(configDir, ref.value);
|
|
23
|
+
ref.set(mode === 'relative' ? relative(resolve(out), target) : target);
|
|
24
|
+
}
|
|
25
|
+
}
|