rig-parts 2.72.0 → 2.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/checkrow.ts CHANGED
@@ -40,39 +40,39 @@ export const CHECK_ROW_PATHS = {
40
40
  'BEHIND_PART_SEAMS.unmeasured': ['BEHIND_PART_SEAMS.unmeasured'],
41
41
  'CLOTH_SETTLES.rows': ['CLOTH_SETTLES.rows'],
42
42
  'CUT_JOINT_MATERIAL.rows': ['CUT_JOINT_MATERIAL.rows'],
43
- 'FEET_STAY_LEVEL.feet': ['FEET_STAY_LEVEL.feet'],
44
- 'FEET_STAY_LEVEL.feet[].worst.through': ['FEET_STAY_LEVEL.feet[].worst.through'],
45
- 'LIMB_ONE_BONE.parts': ['LIMB_ONE_BONE.parts'],
43
+ 'FEET_STAY_LEVEL.feet': ['FEET_STAY_LEVEL.feet', 'characters.*.FEET_STAY_LEVEL.feet'],
44
+ 'FEET_STAY_LEVEL.feet[].worst.through': ['FEET_STAY_LEVEL.feet[].worst.through', 'characters.*.FEET_STAY_LEVEL.feet[].worst.through'],
45
+ 'LIMB_ONE_BONE.parts': ['LIMB_ONE_BONE.parts', 'characters.*.LIMB_ONE_BONE.parts'],
46
46
  'PART_SUPPORT_REPORT.pairs': ['PART_SUPPORT_REPORT.pairs'],
47
47
  'PART_SUPPORT_REPORT.raw_pairs': ['PART_SUPPORT_REPORT.raw_pairs'],
48
48
  'PART_SUPPORT_REPORT.unowned.regions': ['PART_SUPPORT_REPORT.unowned.regions'],
49
- 'PHYSICS_CONTRIBUTES.rows': ['PHYSICS_CONTRIBUTES.rows'],
50
- 'SEAM_OVER_MOTION.pairs': ['SEAM_OVER_MOTION.pairs'],
51
- 'SEAM_OVER_MOTION.required.pairs': ['SEAM_OVER_MOTION.required.pairs'],
52
- 'SEAM_OVER_MOTION.required.pairs[].open_frames': ['SEAM_OVER_MOTION.required.pairs[].open_frames'],
49
+ 'PHYSICS_CONTRIBUTES.rows': ['PHYSICS_CONTRIBUTES.rows', 'characters.*.PHYSICS_CONTRIBUTES.rows'],
50
+ 'SEAM_OVER_MOTION.pairs': ['SEAM_OVER_MOTION.pairs', 'characters.*.SEAM_OVER_MOTION.pairs'],
51
+ 'SEAM_OVER_MOTION.required.pairs': ['SEAM_OVER_MOTION.required.pairs', 'characters.*.SEAM_OVER_MOTION.required.pairs'],
52
+ 'SEAM_OVER_MOTION.required.pairs[].open_frames': ['SEAM_OVER_MOTION.required.pairs[].open_frames', 'characters.*.SEAM_OVER_MOTION.required.pairs[].open_frames'],
53
53
  'seam_cells.frames': ['frames'],
54
54
  'seam_cells.frames[].cells': ['frames[].cells'],
55
- 'SEAM_OVER_MOTION.roots.unmeasured': ['SEAM_OVER_MOTION.roots.unmeasured'],
56
- 'SEAM_OVER_MOTION.rows': ['SEAM_OVER_MOTION.rows'],
57
- 'SEAM_OVER_MOTION.rows[].cells': ['SEAM_OVER_MOTION.rows[].cells'],
58
- 'SEAM_OVER_MOTION.rows[].joint_contact.reasons': ['SEAM_OVER_MOTION.rows[].joint_contact.reasons'],
59
- 'SEAM_OVER_MOTION.rows[].pose_at_worst.joints': ['SEAM_OVER_MOTION.rows[].pose_at_worst.joints'],
60
- 'SEAM_OVER_MOTION.worlds.*.rows': ['SEAM_OVER_MOTION.worlds.*.rows'],
61
- 'SEAM_OVER_RANGE.joints': ['SEAM_OVER_RANGE.joints'],
62
- 'SEAM_OVER_RANGE.joints[].poses': ['SEAM_OVER_RANGE.joints[].poses'],
55
+ 'SEAM_OVER_MOTION.roots.unmeasured': ['SEAM_OVER_MOTION.roots.unmeasured', 'characters.*.SEAM_OVER_MOTION.roots.unmeasured'],
56
+ 'SEAM_OVER_MOTION.rows': ['SEAM_OVER_MOTION.rows', 'characters.*.SEAM_OVER_MOTION.rows'],
57
+ 'SEAM_OVER_MOTION.rows[].cells': ['SEAM_OVER_MOTION.rows[].cells', 'characters.*.SEAM_OVER_MOTION.rows[].cells'],
58
+ 'SEAM_OVER_MOTION.rows[].joint_contact.reasons': ['SEAM_OVER_MOTION.rows[].joint_contact.reasons', 'characters.*.SEAM_OVER_MOTION.rows[].joint_contact.reasons'],
59
+ 'SEAM_OVER_MOTION.rows[].pose_at_worst.joints': ['SEAM_OVER_MOTION.rows[].pose_at_worst.joints', 'characters.*.SEAM_OVER_MOTION.rows[].pose_at_worst.joints'],
60
+ 'SEAM_OVER_MOTION.worlds.*.rows': ['SEAM_OVER_MOTION.worlds.*.rows', 'characters.*.SEAM_OVER_MOTION.worlds.*.rows'],
61
+ 'SEAM_OVER_RANGE.joints': ['SEAM_OVER_RANGE.joints', 'characters.*.SEAM_OVER_RANGE.joints'],
62
+ 'SEAM_OVER_RANGE.joints[].poses': ['SEAM_OVER_RANGE.joints[].poses', 'characters.*.SEAM_OVER_RANGE.joints[].poses'],
63
63
  'SETUP_MATCHES_PAINTING.regions': ['SETUP_MATCHES_PAINTING.regions'],
64
64
  'SETUP_MATCHES_PAINTING.regions[].slots': ['SETUP_MATCHES_PAINTING.regions[].slots'],
65
65
  'SETUP_SEAM_TRANSMISSION.rows': ['SETUP_SEAM_TRANSMISSION.rows'],
66
66
  'SOURCE_EXPOSURE.rows': ['SOURCE_EXPOSURE.rows'],
67
67
  'SOURCE_EXPOSURE.unmeasured': ['SOURCE_EXPOSURE.unmeasured'],
68
- 'STILL_REGIONS_DARK.*.crossing': ['STILL_REGIONS_DARK.*.crossing'],
69
- 'STILL_REGIONS_DARK.*.still_slots': ['STILL_REGIONS_DARK.*.still_slots'],
70
- 'STRESS_OFF_CHAIN.not_read': ['STRESS_OFF_CHAIN.not_read'],
71
- 'STRESS_OFF_CHAIN.per_part': ['STRESS_OFF_CHAIN.per_part'],
72
- 'STRESS_OFF_CHAIN.per_part[].off_chain': ['STRESS_OFF_CHAIN.per_part[].off_chain'],
73
- 'STRESS_OFF_CHAIN.per_part[].poses': ['STRESS_OFF_CHAIN.per_part[].poses'],
68
+ 'STILL_REGIONS_DARK.*.crossing': ['STILL_REGIONS_DARK.*.crossing', 'characters.*.STILL_REGIONS_DARK.*.crossing'],
69
+ 'STILL_REGIONS_DARK.*.still_slots': ['STILL_REGIONS_DARK.*.still_slots', 'characters.*.STILL_REGIONS_DARK.*.still_slots'],
70
+ 'STRESS_OFF_CHAIN.not_read': ['STRESS_OFF_CHAIN.not_read', 'characters.*.STRESS_OFF_CHAIN.not_read'],
71
+ 'STRESS_OFF_CHAIN.per_part': ['STRESS_OFF_CHAIN.per_part', 'characters.*.STRESS_OFF_CHAIN.per_part'],
72
+ 'STRESS_OFF_CHAIN.per_part[].off_chain': ['STRESS_OFF_CHAIN.per_part[].off_chain', 'characters.*.STRESS_OFF_CHAIN.per_part[].off_chain'],
73
+ 'STRESS_OFF_CHAIN.per_part[].poses': ['STRESS_OFF_CHAIN.per_part[].poses', 'characters.*.STRESS_OFF_CHAIN.per_part[].poses'],
74
74
  'TEXTURE_STRETCH.per_mesh': ['TEXTURE_STRETCH.per_mesh'],
75
- 'TIP_OVER_ROOT.parts': ['TIP_OVER_ROOT.parts'],
75
+ 'TIP_OVER_ROOT.parts': ['TIP_OVER_ROOT.parts', 'characters.*.TIP_OVER_ROOT.parts'],
76
76
  'WIND_BAND.pairs': ['WIND_BAND.pairs'],
77
77
  'WIND_BAND.pairs[].steps': ['WIND_BAND.pairs[].steps'],
78
78
  'figure_openings.openings': ['figure_openings.openings'],
@@ -80,12 +80,12 @@ export const CHECK_ROW_PATHS = {
80
80
  'requirements.lines.* (bone)': ['requirements.lines.*'],
81
81
  'requirements.lines.* (seam)': ['requirements.lines.*'],
82
82
  'requirements.lines.* (stretch)': ['requirements.lines.*'],
83
- 'seam_pairs': ['seam_pairs', 'seam_scope.whole_pairs', 'sets.*.seam_pairs', 'sets.*.seam_scope.whole_pairs'],
84
- 'seam_scope.changes': ['seam_scope.changes', 'sets.*.seam_scope.changes'],
85
- 'seam_scope.domain.states': ['seam_scope.domain.states', 'sets.*.seam_scope.domain.states'],
86
- 'seam_scope.pairs': ['seam_scope.pairs', 'sets.*.seam_scope.pairs'],
87
- 'seam_scope.population.pairs': ['seam_scope.population.pairs', 'sets.*.seam_scope.population.pairs'],
88
- 'seam_scope.population.single_art': ['seam_scope.population.single_art', 'sets.*.seam_scope.population.single_art'],
83
+ 'seam_pairs': ['seam_pairs', 'seam_scope.whole_pairs', 'sets.*.seam_pairs', 'sets.*.seam_scope.whole_pairs', 'characters.*.seam_pairs', 'characters.*.seam_scope.whole_pairs'],
84
+ 'seam_scope.changes': ['seam_scope.changes', 'sets.*.seam_scope.changes', 'characters.*.seam_scope.changes'],
85
+ 'seam_scope.domain.states': ['seam_scope.domain.states', 'sets.*.seam_scope.domain.states', 'characters.*.seam_scope.domain.states'],
86
+ 'seam_scope.pairs': ['seam_scope.pairs', 'sets.*.seam_scope.pairs', 'characters.*.seam_scope.pairs'],
87
+ 'seam_scope.population.pairs': ['seam_scope.population.pairs', 'sets.*.seam_scope.population.pairs', 'characters.*.seam_scope.population.pairs'],
88
+ 'seam_scope.population.single_art': ['seam_scope.population.single_art', 'sets.*.seam_scope.population.single_art', 'characters.*.seam_scope.population.single_art'],
89
89
  'slider_stretch.rows': ['slider_stretch.rows'],
90
90
  } as const;
91
91
  export type CheckRowFamily = keyof typeof CHECK_ROW_PATHS;
@@ -132,10 +132,16 @@ export function checkSlotParts(rig: Readonly<Record<string, unknown>>, partNames
132
132
  const record = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object' && !Array.isArray(v);
133
133
  const skin = record(rig.skins) && record(rig.skins.default) ? rig.skins.default : {};
134
134
  const named = new Set(partNames), mapping = new Map<string, string>();
135
+ const matchesPart = (name: string, part: string): boolean => {
136
+ const colon = part.indexOf(':');
137
+ if (colon < 0) return name === part || alternateSets.some(set => name === `${set}_${part}`);
138
+ const id = part.slice(0, colon), stem = part.slice(colon + 1);
139
+ return name === `${id}.${stem}` || alternateSets.some(set => name === `${id}.${set}_${stem}`);
140
+ };
135
141
  for (const [slot, drawings] of Object.entries(skin)) {
136
142
  if (!record(drawings)) continue;
137
143
  const names = Object.values(drawings).map(d => record(d) && typeof d.image === 'string' && d.sequence === undefined && ['region', 'mesh'].includes(typeof d.type === 'string' ? d.type : 'region') ? d.image.replace(/\.png$/, '') : undefined);
138
- const candidates = names.length === 0 ? [] : [...named].filter(part => names.every(name => name !== undefined && (name === part || alternateSets.some(set => name === `${set}_${part}`))));
144
+ const candidates = names.length === 0 ? [] : [...named].filter(part => names.every(name => name !== undefined && matchesPart(name, part)));
139
145
  if (candidates.length === 1) mapping.set(slot, candidates[0]);
140
146
  }
141
147
  return mapping;
package/src/config.ts CHANGED
@@ -194,9 +194,9 @@ export interface SeeThrough {
194
194
  /** Issue #439: arm separation when both arms overlap in the full run. */
195
195
  arm_split?: ArmSplit;
196
196
  resolution: number;
197
- steps: number;
198
- seed: number;
199
- offload: boolean;
197
+ steps?: number;
198
+ seed?: number;
199
+ offload?: boolean;
200
200
  }
201
201
 
202
202
  export type Run = 'full' | 'head';
@@ -2537,7 +2537,7 @@ function checkHeadBox(c: Check, path: string, b: Json): void {
2537
2537
  }
2538
2538
 
2539
2539
  function checkSeeThrough(c: Check, v: Json): void {
2540
- const s = c.object('config.seethrough', v, ['resolution', 'steps', 'seed', 'offload'], ['head_box', 'arm_split']);
2540
+ const s = c.object('config.seethrough', v, ['resolution'], ['steps', 'seed', 'offload', 'head_box', 'arm_split']);
2541
2541
  if (s === null) return;
2542
2542
  const p = 'config.seethrough';
2543
2543
  const res = 'resolution' in s && c.int(`${p}.resolution`, s.resolution, 1) ? (s.resolution as number) : null;
package/src/parts.ts CHANGED
@@ -818,7 +818,9 @@ export interface PartsFileReference {
818
818
 
819
819
  /** Shared with the PNG readers, including their alternate attachment names. */
820
820
  export function partImageReference(part: PartRecord, set?: string): PartsFileReference {
821
- return { path: `parts/${set === undefined ? part.name : `${set}_${part.name}`}.png`, role: set === undefined ? 'part' : 'alternate' };
821
+ const colon = part.name.indexOf(':');
822
+ const stem = colon < 0 ? part.name : part.name.slice(colon + 1);
823
+ return { path: `parts/${set === undefined ? stem : `${set}_${stem}`}.png`, role: set === undefined ? 'part' : 'alternate' };
822
824
  }
823
825
 
824
826
  export function depthImageReference(depth: PartDepthReference): PartsFileReference {
package/src/propose.ts CHANGED
@@ -23,7 +23,8 @@ import { type BoneEntry, type CharacterConfig, type ConfigConstraint, type Confi
23
23
  * hip would sit above `HIP_MIN_FRACTION` of the figure's height (a long
24
24
  * robe tagged `bottomwear` starts at the collar): then `hip` is the waist,
25
25
  * the narrowest torso row between the shoulder line and the figure's
26
- * middle, and 0.32 of the figure height when no row narrows enough. With
26
+ * middle, and 0.32 of the figure height when no row narrows enough.
27
+ * Without `bottomwear`, start with the same waist rule. With
27
28
  * `cloth.bottomwear.part` naming a dress (issue #402), a `bottomwear` part
28
29
  * lying on the dress's tree links rides them (issue #416), by the rule a
29
30
  * layer on a tail does (below), and gets no trees of its own.
@@ -1618,19 +1619,14 @@ export function proposeWithBasis(
1618
1619
  hip = [bw[0].x + bw[0].w / 2, bw[0].y + 0.14 * fh];
1619
1620
  hipRule = `the top of ${bw[0].name} (bottomwear) + 0.14 face heights`;
1620
1621
  hipWhy = placement('ratio', `the top of ${bw[0].name} (bottomwear) + 0.14 face heights, at the centre x of its box`, { parts: [bw[0].name], frame: ['face_box'], constants: [konst('face_heights_below_top', 0.14)] });
1621
- } else if (bw.length === 0) {
1622
- hip = [axis, ftop + 0.32 * (fbot - ftop)];
1623
- hipRule = '0.32 of the figure height, on the eye axis (no bottomwear)';
1624
- hipWhy = placement('ratio', '0.32 of the figure height below its top row, on the eye axis', { frame: ['figure', 'eye_axis'], constants: [konst('of_figure_height', 0.32)], fallback: 'no bottomwear part' });
1625
- notes.push('no bottomwear: hip from 0.32 of figure height');
1626
1622
  } else {
1627
- // A long under-robe tagged bottomwear starts at the collar: its top edge
1628
- // is not the waist, and a hip read off it sits at the shoulders with the
1629
- // chest above it by half a neck. The waist is read off the figure instead.
1630
- const limit = ftop + HIP_MIN_FRACTION * (fbot - ftop);
1631
- notes.push(
1632
- `hip: ${bw[0].name} (${bw[0].from}) starts at y=${bw[0].y}, so its top + 0.14 face heights (y=${pyFixed(bw[0].y + 0.14 * fh, 0)}) is above ${HIP_MIN_FRACTION} of the figure height (y=${pyFixed(limit, 0)}, figure y ${ftop}..${fbot}): its top edge is not the waist`,
1633
- );
1623
+ if (bw.length > 0) {
1624
+ // A long under-robe starts at the collar: its top edge is not the waist.
1625
+ const limit = ftop + HIP_MIN_FRACTION * (fbot - ftop);
1626
+ notes.push(
1627
+ `hip: ${bw[0].name} (${bw[0].from}) starts at y=${bw[0].y}, so its top + 0.14 face heights (y=${pyFixed(bw[0].y + 0.14 * fh, 0)}) is above ${HIP_MIN_FRACTION} of the figure height (y=${pyFixed(limit, 0)}, figure y ${ftop}..${fbot}): its top edge is not the waist`,
1628
+ );
1629
+ }
1634
1630
  const waist = shoulders === null ? null : waistOf(torso, shoulders, ftop + 0.5 * (fbot - ftop));
1635
1631
  if (shoulders !== null && waist !== null) {
1636
1632
  hip = [waist.cx, waist.y + 0.14 * fh];
@@ -1641,6 +1637,11 @@ export function proposeWithBasis(
1641
1637
  constants: [konst('face_heights_below_waist', 0.14), konst('waist_max_of_shoulders', WAIST_MAX_OF_SHOULDERS)],
1642
1638
  });
1643
1639
  notes.push(`hip from the waist: silhouette narrowest at y=${waist.y} (width ${waist.width} px, shoulders ${shoulders.width} px at y=${shoulders.y}), hip 0.14 face heights below it`);
1640
+ } else if (bw.length === 0) {
1641
+ hip = [axis, ftop + 0.32 * (fbot - ftop)];
1642
+ hipRule = '0.32 of the figure height, on the eye axis (no bottomwear; no waist found)';
1643
+ hipWhy = placement('ratio', '0.32 of the figure height below its top row, on the eye axis', { frame: ['figure', 'eye_axis'], constants: [konst('of_figure_height', 0.32)], fallback: 'no bottomwear part' });
1644
+ notes.push('no bottomwear: hip from 0.32 of figure height');
1644
1645
  } else {
1645
1646
  hip = [axis, ftop + 0.32 * (fbot - ftop)];
1646
1647
  hipRule = '0.32 of the figure height, on the eye axis (no waist found)';
@@ -1657,6 +1658,19 @@ export function proposeWithBasis(
1657
1658
  // down the screen, because the torso need not be upright.
1658
1659
  const chestAlong = neckJ !== null || hipFromJoints;
1659
1660
  const chest: [number, number] = chestAlong ? [(neckAt[0] + hip[0]) / 2, (neckAt[1] + hip[1]) / 2] : [hip[0], neckY + 0.5 * (hip[1] - neckY)];
1661
+ if (!hipFromJoints && bw.length === 0) {
1662
+ // Lint reads the rounded bone origins in the draft.
1663
+ const hipRow = rnd(hip)[1];
1664
+ const chestRow = rnd(chest)[1];
1665
+ const limit = ftop + HIP_MIN_FRACTION * (fbot - ftop);
1666
+ if (hip[1] <= neckY || hipRow <= chestRow || hipRow < limit) {
1667
+ refuseIfAny([{
1668
+ code: 'PROPOSE_HIP_PLACEMENT',
1669
+ object: 'bone "hip"',
1670
+ detail: `${hipRule} put hip at y=${hip[1]} and neck is at y=${neckY}; the draft rounds hip to y=${hipRow} and chest to y=${chestRow}. The hip must be below the neck and draft chest, with a draft y of at least ${limit} (${HIP_MIN_FRACTION} of the figure height). Give --keypoints with hip joints, or a bottomwear part`,
1671
+ }]);
1672
+ }
1673
+ }
1660
1674
  // Issue #243: on that same line, neck -> hip, the trunk parts' fixed segments are laid too (neck, topwear,
1661
1675
  // bottomwear; {@link trunkSegments}), not down the screen through the bones' x. Without a joint at either end,
1662
1676
  // today's verticals; with the two ends on one point the line has no direction, and a note says the verticals stay.
package/src/runstamp.ts CHANGED
@@ -251,8 +251,7 @@ export function rigOutputFiles(rig: RigOutput): string[] {
251
251
  ]);
252
252
  }
253
253
 
254
- function writtenAllocationReports(outDir: string): string[] {
255
- const allocationPath = join(outDir, 'rig', PAINTING_ALLOCATION_FILE);
254
+ function writtenAllocationReports(allocationPath: string): string[] {
256
255
  if (!existsSync(allocationPath)) return [];
257
256
  try {
258
257
  const parsed: unknown = JSON.parse(readFileSync(allocationPath, 'utf8'));
@@ -263,8 +262,7 @@ function writtenAllocationReports(outDir: string): string[] {
263
262
  Array.isArray(parsed.written_reports)
264
263
  ) {
265
264
  return parsed.written_reports
266
- .filter((f): f is string => typeof f === 'string' && f.startsWith('painting_allocation.') && f.endsWith('.json') && basename(f) === f)
267
- .map((f) => `rig/${f}`);
265
+ .filter((f): f is string => typeof f === 'string' && f.startsWith('painting_allocation.') && f.endsWith('.json') && basename(f) === f);
268
266
  }
269
267
  } catch {
270
268
  return [];
@@ -272,6 +270,13 @@ function writtenAllocationReports(outDir: string): string[] {
272
270
  return [];
273
271
  }
274
272
 
273
+ /** Build writes the allocation beside parts.json and names its current alternate reports there. */
274
+ export function buildAllocationOutputFiles(outDir: string): string[] {
275
+ const allocationPath = join(outDir, PAINTING_ALLOCATION_FILE);
276
+ if (!existsSync(allocationPath)) return [];
277
+ return [PAINTING_ALLOCATION_FILE, ...writtenAllocationReports(allocationPath)];
278
+ }
279
+
275
280
  /** The exact relative output paths `assembleStage` writes under `--out`, derived from its returned `AssembleResult`. */
276
281
  export function assembleOutputFiles(outDir: string, result: AssembleResult): string[] {
277
282
  return sortCodeUnits([
@@ -281,7 +286,10 @@ export function assembleOutputFiles(outDir: string, result: AssembleResult): str
281
286
  `rig/${SUPPORT_DOMAINS_FILE}`,
282
287
  ...(result.stageMap === undefined ? [] : [`rig/${STAGE_MAP_FILE}`]),
283
288
  ...(result.edgeResiduals === undefined ? [] : [`rig/${EDGE_RESIDUAL_FILE}`]),
284
- ...(result.paintingEdges?.allocation === undefined ? [] : [`rig/${PAINTING_ALLOCATION_FILE}`, ...writtenAllocationReports(outDir)]),
289
+ ...(result.paintingEdges?.allocation === undefined ? [] : [
290
+ `rig/${PAINTING_ALLOCATION_FILE}`,
291
+ ...writtenAllocationReports(join(outDir, 'rig', PAINTING_ALLOCATION_FILE)).map((file) => `rig/${file}`),
292
+ ]),
285
293
  ...(existsSync(join(outDir, 'rig', CUT_MATERIAL_SOURCES)) ? [`rig/${CUT_MATERIAL_SOURCES}`] : []),
286
294
  ...result.parts.parts.flatMap((p) => [`rig/parts/${p.name}.png`, ...(p.depth === undefined ? [] : [`rig/parts/${p.depth.image}`]), ...(p.source_state_map === undefined ? [] : [`rig/parts/${p.source_state_map.image}`])]),
287
295
  ...(result.parts.alternates ?? []).flatMap((alt) =>
package/src/scene.ts CHANGED
@@ -550,6 +550,15 @@ export function loadScene(path: string): SceneFile {
550
550
  // a character's build
551
551
  // ---------------------------------------------------------------------------
552
552
 
553
+ /** Declared part exceptions read from one character build's hash-bound `check/check.json` (issue #1679). */
554
+ export interface ForwardedCharacterExceptions {
555
+ build: string;
556
+ not_swinging: string[];
557
+ rises: string[];
558
+ rests: string[];
559
+ not_planted: string[];
560
+ }
561
+
553
562
  /** What `compose` reads from one character's `build --out`. */
554
563
  export interface CharacterBuild {
555
564
  id: string;
@@ -566,6 +575,12 @@ export interface CharacterBuild {
566
575
  files: RunStampFileEntry[];
567
576
  /** Exact parsed input texts for the opted-in pre-emission source gate. */
568
577
  repeatSource?: Array<[string, string]>;
578
+ /** `rig/mesh_report.json` when the build holds one, so `compose` forwards contour `region_bones` to `LIMB_ONE_BONE`. */
579
+ meshReport?: Array<Record<string, unknown>>;
580
+ /** Prefixed part exceptions forwarded from the build's hash-bound `check/check.json` when present. */
581
+ forwardedExceptions?: ForwardedCharacterExceptions;
582
+ /** Whether `<build>/parts/` is present alongside `parts.json` so composed `check` can measure the manifest. */
583
+ hasPartsDir: boolean;
569
584
  /** The bars its own check failed that were accepted (issue #203), in check's order; empty for a green build. */
570
585
  accepted: string[];
571
586
  }
@@ -709,8 +724,27 @@ export function readCharacterBuild(c: SceneCharacter, problems: Problem[], accep
709
724
  const check = checkBuild ? json('check/check.json', "the build's own check; a build that ran its check writes it") : undefined;
710
725
  const joined = new Set([...accept, ...c.accept]);
711
726
  let accepted: string[] = [];
727
+ let forwardedExceptions: ForwardedCharacterExceptions | undefined;
712
728
  if (check !== undefined) {
713
729
  const ck = isRecord(check) ? check : {};
730
+ const stringList = (v: unknown): string[] => Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string' && x !== '') : [];
731
+ const tipObj = isRecord(ck.TIP_OVER_ROOT) ? ck.TIP_OVER_ROOT : {};
732
+ const breathObj = isRecord(ck.BREATH_VISIBLE) ? ck.BREATH_VISIBLE : {};
733
+ const stillObj = isRecord(ck.STILL_REGIONS_DARK) ? ck.STILL_REGIONS_DARK : {};
734
+ const stillFeetObj = isRecord(stillObj.feet) ? stillObj.feet : {};
735
+ const notSwinging = stringList(tipObj.declared_not_swinging).map(n => prefixed(c.id, n));
736
+ const rises = stringList(tipObj.declared_rises).map(n => prefixed(c.id, n));
737
+ const rests = stringList(tipObj.declared_rests).map(n => prefixed(c.id, n));
738
+ const notPlanted = [...new Set([...stringList(breathObj.declared_not_planted), ...stringList(stillFeetObj.declared_not_planted)])].map(n => prefixed(c.id, n));
739
+ if (notSwinging.length > 0 || rises.length > 0 || rests.length > 0 || notPlanted.length > 0) {
740
+ forwardedExceptions = {
741
+ build: c.build,
742
+ not_swinging: notSwinging,
743
+ rises,
744
+ rests,
745
+ not_planted: notPlanted,
746
+ };
747
+ }
714
748
  if ((ck.PASS !== true || ck.gate_spine_html_green !== true) && joined.size > 0) {
715
749
  const failed = checkBarsFailed(ck);
716
750
  const reqs = requirementsNotPass(ck);
@@ -748,6 +782,16 @@ export function readCharacterBuild(c: SceneCharacter, problems: Problem[], accep
748
782
  }
749
783
  const rigRaw = json('rig/rig.json', "the rig stage's rig.json");
750
784
  const motionRaw = json('rig/motion.json', "the rig stage's motion.json");
785
+ let meshReport: Array<Record<string, unknown>> | undefined;
786
+ if (existsSync(join(dir, 'rig', 'mesh_report.json'))) {
787
+ const rawReport = json('rig/mesh_report.json', "the rig stage's mesh_report.json");
788
+ if (rawReport !== undefined) {
789
+ if (!Array.isArray(rawReport) || rawReport.some(row => !isRecord(row) || typeof row.part !== 'string')) {
790
+ problems.push({ code: 'SCENE_BUILD_FIELD_KNOWN', object: `${who} rig/mesh_report.json`, detail: `is ${show(rawReport)}; an array of mesh report rows with string "part" is required` });
791
+ } else meshReport = rawReport;
792
+ }
793
+ }
794
+ const hasPartsDir = existsSync(join(dir, 'parts')) && statSync(join(dir, 'parts')).isDirectory();
751
795
  const unknown = (where: string, obj: unknown, keys: readonly string[]): void => {
752
796
  if (!isRecord(obj)) {
753
797
  problems.push({ code: 'SCENE_BUILD_FIELD_KNOWN', object: `${who} ${where}`, detail: `is ${show(obj)}; an object is required` });
@@ -771,6 +815,24 @@ export function readCharacterBuild(c: SceneCharacter, problems: Problem[], accep
771
815
  const xs = list.map((q) => Number(q.x));
772
816
  const ys = list.map((q) => Number(q.y));
773
817
  artBox = [Math.min(...xs), Math.min(...ys), Math.max(...list.map((q) => Number(q.x) + Number(q.w))), Math.max(...list.map((q) => Number(q.y) + Number(q.h)))];
818
+ if (check !== undefined && isRecord(check) && isRecord(check.TIP_OVER_ROOT) &&
819
+ check.TIP_OVER_ROOT.status === 'SKIP' && check.TIP_OVER_ROOT.declared_not_swinging === undefined &&
820
+ typeof check.TIP_OVER_ROOT.reason === 'string') {
821
+ const tipSkipReason = check.TIP_OVER_ROOT.reason;
822
+ const legacyNotSwinging = list
823
+ .map((q) => (typeof q.name === 'string' ? q.name : ''))
824
+ .filter((name) => name !== '' && tipSkipReason.includes(`${name}: declared not swinging by `))
825
+ .map((name) => prefixed(c.id, name));
826
+ if (legacyNotSwinging.length > 0) {
827
+ forwardedExceptions = {
828
+ build: c.build,
829
+ not_swinging: legacyNotSwinging,
830
+ rises: forwardedExceptions?.rises ?? [],
831
+ rests: forwardedExceptions?.rests ?? [],
832
+ not_planted: forwardedExceptions?.not_planted ?? [],
833
+ };
834
+ }
835
+ }
774
836
  }
775
837
  }
776
838
  const images: Array<[string, Uint8Array]> = [];
@@ -956,7 +1018,12 @@ export function readCharacterBuild(c: SceneCharacter, problems: Problem[], accep
956
1018
  }
957
1019
  if (problems.length > before) return null;
958
1020
  files.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
959
- return { id: c.id, dir, rig: rigRaw as RigSpec, motion: motionRaw as MotionSpec, rigSize, rigScale, artBox, images, files, accepted, ...(repeating ? { repeatSource } : {}) };
1021
+ return {
1022
+ id: c.id, dir, rig: rigRaw as RigSpec, motion: motionRaw as MotionSpec, rigSize, rigScale, artBox, images, files, hasPartsDir, accepted,
1023
+ ...(meshReport === undefined ? {} : { meshReport }),
1024
+ ...(forwardedExceptions === undefined ? {} : { forwardedExceptions }),
1025
+ ...(repeating ? { repeatSource } : {}),
1026
+ };
960
1027
  }
961
1028
 
962
1029
  // ---------------------------------------------------------------------------
@@ -1424,6 +1491,10 @@ export interface ComposedScene {
1424
1491
  /** Compiled timeline addresses checked at the final gate; never serialized. */
1425
1492
  repeatSeams: SceneRepeatSeam[];
1426
1493
  sceneCamera?: ResolvedSceneCamera;
1494
+ /** Prefixed `<out>/rig/mesh_report.json` rows when any character build carries `rig/mesh_report.json`. */
1495
+ meshReport?: Array<Record<string, unknown>>;
1496
+ /** Bound character manifests with `<build>/parts/` present for composed `check`. */
1497
+ characterManifests: Array<{ id: string; partsHome: string; offset: [number, number]; scale: number; forwardedExceptions?: ForwardedCharacterExceptions }>;
1427
1498
  }
1428
1499
 
1429
1500
  /** The plate image's bytes and size, read by the caller. */
@@ -2118,6 +2189,9 @@ export function composeScene(
2118
2189
  const detached: NonNullable<NonNullable<RigSpec['invariants']>['detached']> = [];
2119
2190
  const axes: NonNullable<NonNullable<RigSpec['invariants']>['axes']> = [];
2120
2191
  const combinations: NonNullable<NonNullable<RigSpec['invariants']>['deformSliderCombinations']> = [];
2192
+ const meshReports: Array<Record<string, unknown>> = [];
2193
+ let anyMeshReport = false;
2194
+ const characterManifests: Array<{ id: string; partsHome: string; offset: [number, number]; scale: number; forwardedExceptions?: ForwardedCharacterExceptions }> = [];
2121
2195
  scene.characters.forEach((c) => {
2122
2196
  const b = byId.get(c.id) as CharacterBuild;
2123
2197
  const id = c.id;
@@ -2125,6 +2199,26 @@ export function composeScene(
2125
2199
  const [dx, dy] = rootShift(b.rig.skeleton, stage, c.offset, s);
2126
2200
  const pivot = pivots.get(id);
2127
2201
  const rootBinding = pivot?.rootBinding ?? ROOT_BONE;
2202
+ const mapBone = (bone: string): string => bone === ROOT_BONE ? rootBinding : P(id, bone);
2203
+ if (b.hasPartsDir) characterManifests.push({
2204
+ id,
2205
+ partsHome: b.dir,
2206
+ offset: [c.offset[0], c.offset[1]],
2207
+ scale: s,
2208
+ ...(b.forwardedExceptions === undefined ? {} : { forwardedExceptions: b.forwardedExceptions }),
2209
+ });
2210
+ if (b.meshReport !== undefined) {
2211
+ anyMeshReport = true;
2212
+ for (const row of b.meshReport) {
2213
+ meshReports.push({
2214
+ ...row,
2215
+ part: prefixed(id, String(row.part)),
2216
+ ...(Array.isArray(row.bones) ? { bones: row.bones.map(bn => typeof bn === 'string' ? mapBone(bn) : bn) } : {}),
2217
+ ...(Array.isArray(row.regions) ? { regions: row.regions.map(reg => isRecord(reg) && typeof reg.bone === 'string' ? { ...reg, bone: mapBone(reg.bone) } : reg) } : {}),
2218
+ ...(isRecord(row.reach) && typeof row.reach.nearest === 'string' ? { reach: { ...row.reach, nearest: mapBone(row.reach.nearest) } } : {}),
2219
+ });
2220
+ }
2221
+ }
2128
2222
  if (pivot !== undefined) {
2129
2223
  bones.push({ name: pivot.name, parent: ROOT_BONE, x: 0, y: 0 });
2130
2224
  if (pivot.rootBinding !== undefined) bones.push({ name: pivot.rootBinding, parent: pivot.name, x: 0, y: 0 });
@@ -2377,7 +2471,8 @@ export function composeScene(
2377
2471
  ...(scene.repeats === undefined ? {} : { repeats: { ...scene.repeats } }),
2378
2472
  };
2379
2473
  return {
2380
- rig, motion, images, report, repeatSeams,
2474
+ rig, motion, images, report, repeatSeams, characterManifests,
2475
+ ...(anyMeshReport ? { meshReport: meshReports } : {}),
2381
2476
  ...(sceneAnimations === undefined ? {} : { sceneAnimations }),
2382
2477
  ...(sceneCamera === undefined ? {} : { sceneCamera }),
2383
2478
  ...(sceneChannels === undefined ? {} : { sceneChannels }),
@@ -2797,8 +2892,9 @@ export function composeStage(input: ComposeInput, run: ComposeRunners, log: Log)
2797
2892
  mkdirSync(join(rigDir, 'images'), { recursive: true });
2798
2893
  for (const [file, bytes] of composed.images) writeFileSync(join(rigDir, 'images', file), bytes);
2799
2894
  for (const [file, text] of texts) writeFileSync(join(rigDir, file), text);
2895
+ if (composed.meshReport !== undefined) writeFileSync(join(rigDir, 'mesh_report.json'), rigJsonText(composed.meshReport));
2800
2896
  const reportPath = join(input.out, SCENE_REPORT_FILE);
2801
- const wroteRig = `wrote ${join(rigDir, 'rig.json')}, motion.json and ${composed.images.length} image(s) under ${join(rigDir, 'images')}`;
2897
+ const wroteRig = `wrote ${join(rigDir, 'rig.json')}, motion.json${composed.meshReport === undefined ? '' : ', mesh_report.json'} and ${composed.images.length} image(s) under ${join(rigDir, 'images')}`;
2802
2898
  if (gated.camera === undefined) {
2803
2899
  writeFileSync(reportPath, rigJsonText(r));
2804
2900
  say(`${wroteRig}, and ${reportPath}`);
@@ -2849,6 +2945,7 @@ export function composeStage(input: ComposeInput, run: ComposeRunners, log: Log)
2849
2945
  try {
2850
2946
  report = checkStage({
2851
2947
  rig: rigDir, out: join(input.out, 'check'), pageEdges: mode.pageEdges, packShape: mode.packShape,
2948
+ ...(composed.characterManifests.length === 0 ? {} : { characters: composed.characterManifests }),
2852
2949
  ...(pageSize === undefined ? {} : { pageSize }),
2853
2950
  ...(input.requirements === undefined ? {} : { requirements: input.requirements }),
2854
2951
  ...(input.loopSeam === undefined ? {} : { loopSeam: input.loopSeam }),
@@ -2868,8 +2965,8 @@ export function composeStage(input: ComposeInput, run: ComposeRunners, log: Log)
2868
2965
  return refused('compose', new PartsError([{ code: 'SCENE_CAMERA_BACKDROP', object: 'check/build', detail: 'the checked model did not bind to the green camera audit; an exact packed artifact match is required' }]));
2869
2966
  }
2870
2967
  writeCameraReport();
2871
- // Issue #203: a character taken with an accepted failing bar never makes the scene green, even where the composed
2872
- // rig's check cannot measure that bar (no parts.json: the seam and four judgement lines say SKIP).
2968
+ // Issue #203: a character taken with an accepted failing bar never makes the scene green, even when the composed
2969
+ // rig's check passes or skips that bar.
2873
2970
  const taken = r.characters.filter((c) => c.accepted !== undefined).map((c) => `"${c.id}" (${(c.accepted as string[]).join(', ')})`);
2874
2971
  const acceptedLine = taken.length === 0 ? '' : `; accepted failing bar(s) of ${taken.join(', ')} — not green, whatever the composed check reads`;
2875
2972
  if (!report.figures.PASS) {