@rig-c/parts 1.54.0 → 1.55.1

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/parts.ts CHANGED
@@ -29,6 +29,8 @@
29
29
  * - `refused_drift_px` — of those, the ones refused because See-through's
30
30
  * pixel and the painting's disagreed by more than the drift limit;
31
31
  * - `merged_px` — pixels brought in from the other run below the head crop;
32
+ * on a subset set's limb part, less those the set's exclusion (issue #587)
33
+ * cleared, so it counts the written PNG's (issue #603);
32
34
  * - `seam_override_px` — pixels whose colour the seam pass replaced;
33
35
  * - `fringe_pushed_back` — written only when not empty: the pixels of this
34
36
  * part's fringe (alpha below 250) made transparent because the painting
@@ -163,6 +165,16 @@ export interface CapRecord {
163
165
  * `right` the other; the two add up to `missing_px`. A full cap writes no key.
164
166
  */
165
167
  short_px?: { left: number; right: number };
168
+ /**
169
+ * Issue #603, written only when above 0: the cap's pixels a subset set's
170
+ * exclusion (issue #587) cleared — pixels a base part the set does not
171
+ * replace covers at setup — each taken out of the count it was in
172
+ * (`layer_px`, `image_px`, `upper_px`, `lower_px`, `lower_kept_px`), so
173
+ * those counts are the written PNG's. The disc's pixels are then the
174
+ * counts above, `upper_px`, the lower half's and `excluded_px` together.
175
+ * A cap no exclusion touched writes no key.
176
+ */
177
+ excluded_px?: number;
166
178
  /**
167
179
  * Issue #360, written only under the segment's `cap_shape: "disc"`: the
168
180
  * shape; the cap's pixels taken from the upper segment's art where the
@@ -219,6 +231,7 @@ const CAP_KEYS = [
219
231
  'image_layer',
220
232
  'missing_px',
221
233
  'short_px',
234
+ 'excluded_px',
222
235
  'shape',
223
236
  'upper_px',
224
237
  'lower_px',
@@ -631,51 +644,7 @@ function checkParts(raw: unknown, path: string): PartsFile {
631
644
  fail('PARTS_FIELD_TYPE', `${object} "range"`, `is ${show(r)}; [min, max], two finite degrees from rest with min <= 0 <= max, is required — config.limbs' rule (CONFIG_LIMB_RANGE)`);
632
645
  }
633
646
  }
634
- if ('cap' in q) {
635
- const c = q.cap;
636
- const co = typeof c === 'object' && c !== null && !Array.isArray(c) ? (c as Record<string, unknown>) : null;
637
- const pt = (v: unknown, n: number): boolean => Array.isArray(v) && v.length === n && v.every((x) => typeof x === 'number' && Number.isFinite(x));
638
- const ok =
639
- co !== null &&
640
- Object.keys(co).every((k) => (CAP_KEYS as readonly string[]).includes(k)) &&
641
- pt(co.at, 2) &&
642
- typeof co.width === 'number' &&
643
- typeof co.radius === 'number' &&
644
- pt(co.box, 4) &&
645
- isCount(co.layer_px) &&
646
- isCount(co.missing_px) &&
647
- (!('image_px' in co) || isCount(co.image_px)) &&
648
- (!('image_layer' in co) || ('image_px' in co && typeof co.image_layer === 'string' && co.image_layer !== '')) &&
649
- // Issue #360: a disc cap carries its count, a feathered edge its band and count, and neither carries them alone.
650
- ('shape' in co ? (co.shape === 'disc' || co.shape === 'ball') && isCount(co.upper_px) : !('upper_px' in co) || (isCount(co.upper_px) && co.upper_px > 0)) &&
651
- // Issue #579: a ball cap carries its lower half's three counts, its missing ones inside missing_px; no other cap carries them.
652
- (co.shape === 'ball'
653
- ? isCount(co.lower_px) && isCount(co.lower_kept_px) && isCount(co.lower_missing_px) && isCount(co.missing_px) && co.lower_missing_px <= co.missing_px
654
- : BALL_KEYS.every((k) => !(k in co))) &&
655
- // Issue #557: the shortfall by side, when written, adds up to the missing pixels, and is never written for none.
656
- (!('short_px' in co) || shortSides(co.short_px, co.missing_px)) &&
657
- ('edge' in co ? co.edge === 'feather' && typeof co.feather_radius === 'number' && Number.isFinite(co.feather_radius) && co.feather_radius >= 0 && isCount(co.feathered_px) : !('feather_radius' in co) && !('feathered_px' in co)) &&
658
- // Issue #360 (item 14): a placed cut carries its band, line and counts, the line inside the band; none of them rides alone.
659
- ('cut_band' in co
660
- ? isCount(co.cut_band) &&
661
- co.cut_band >= 1 &&
662
- Number.isInteger(co.cut_offset) &&
663
- Math.abs(co.cut_offset as number) <= co.cut_band &&
664
- pt(co.cut_at, 2) &&
665
- isCount(co.cut_crossed) &&
666
- isCount(co.joint_crossed) &&
667
- isCount(co.band_px) &&
668
- (co.cut_crossed as number) <= (co.joint_crossed as number) &&
669
- (!('stroke_luma_max' in co) || (isCount(co.stroke_luma_max) && co.stroke_luma_max <= 255))
670
- : CUT_KEYS.every((k) => !(k in co)));
671
- if (!ok) {
672
- fail(
673
- 'PARTS_FIELD_TYPE',
674
- `${object} "cap"`,
675
- `is ${show(c)}; {at: [x, y], width, radius, box: [x, y, w, h], layer_px, image_px?, image_layer? (with image_px), missing_px, short_px? ({left, right}, adding up to missing_px, above 0), shape? ("disc" or "ball", with upper_px; "ball" with lower_px, lower_kept_px and lower_missing_px, at most missing_px; without it upper_px? above 0), edge? ("feather", with feather_radius and feathered_px), cut_band? (with cut_offset inside the band, cut_at, cut_crossed at most joint_crossed, band_px, stroke_luma_max? 0..255)} is required`,
676
- );
677
- }
678
- }
647
+ if ('cap' in q) checkCap(q.cap, `${object} "cap"`, fail);
679
648
  }
680
649
  }
681
650
  if ('scene' in o) {
@@ -698,11 +667,80 @@ function checkParts(raw: unknown, path: string): PartsFile {
698
667
  if ('alternates' in o && !Array.isArray(o.alternates)) {
699
668
  fail('PARTS_FIELD_TYPE', `${path} field "alternates"`, `is ${show(o.alternates)}; an array of alternate set records is required`);
700
669
  }
670
+ if (Array.isArray(o.alternates)) {
671
+ // Issue #620: a set record's cap is a cap, so it is held to the base records' rule; the object names the set and the part.
672
+ o.alternates.forEach((a, i) => {
673
+ if (typeof a !== 'object' || a === null || Array.isArray(a)) return;
674
+ const set = a as Record<string, unknown>;
675
+ if (!Array.isArray(set.records)) return;
676
+ const at = `${path} alternates[${i}]${typeof set.name === 'string' ? ` (set "${set.name}")` : ''}`;
677
+ set.records.forEach((p, j) => {
678
+ if (typeof p !== 'object' || p === null || Array.isArray(p)) return;
679
+ const r = p as Record<string, unknown>;
680
+ const l = r[LIMB_KEY];
681
+ if (typeof l !== 'object' || l === null || Array.isArray(l) || !('cap' in l)) return;
682
+ const part = typeof r.name === 'string' ? `part "${r.name}"` : `records[${j}]`;
683
+ checkCap((l as Record<string, unknown>).cap, `${at} ${part} field "${LIMB_KEY}" "cap"`, fail);
684
+ });
685
+ });
686
+ }
701
687
  refuseIfAny(problems);
702
688
  return raw as PartsFile;
703
689
  }
704
690
 
705
691
  const isCount = (v: unknown): v is number => Number.isInteger(v) && (v as number) >= 0;
692
+
693
+ /**
694
+ * A limb segment's `cap` record (issue #349, with #360's disc, edge and band, #557's short_px and #579's ball): every key
695
+ * a cap key, its fields of their kinds, and its counts consistent — one refusal naming `object` when any is not. A base
696
+ * part's cap and a set record's cap (issue #620) are held to this one rule.
697
+ */
698
+ function checkCap(c: unknown, object: string, fail: (code: string, object: string, detail: string) => void): void {
699
+ const co = typeof c === 'object' && c !== null && !Array.isArray(c) ? (c as Record<string, unknown>) : null;
700
+ const pt = (v: unknown, n: number): boolean => Array.isArray(v) && v.length === n && v.every((x) => typeof x === 'number' && Number.isFinite(x));
701
+ const ok =
702
+ co !== null &&
703
+ Object.keys(co).every((k) => (CAP_KEYS as readonly string[]).includes(k)) &&
704
+ pt(co.at, 2) &&
705
+ typeof co.width === 'number' &&
706
+ typeof co.radius === 'number' &&
707
+ pt(co.box, 4) &&
708
+ isCount(co.layer_px) &&
709
+ isCount(co.missing_px) &&
710
+ (!('image_px' in co) || isCount(co.image_px)) &&
711
+ (!('image_layer' in co) || ('image_px' in co && typeof co.image_layer === 'string' && co.image_layer !== '')) &&
712
+ // Issue #360: a disc cap carries its count, a feathered edge its band and count, and neither carries them alone.
713
+ ('shape' in co ? (co.shape === 'disc' || co.shape === 'ball') && isCount(co.upper_px) : !('upper_px' in co) || (isCount(co.upper_px) && co.upper_px > 0)) &&
714
+ // Issue #579: a ball cap carries its lower half's three counts, its missing ones inside missing_px; no other cap carries them.
715
+ (co.shape === 'ball'
716
+ ? isCount(co.lower_px) && isCount(co.lower_kept_px) && isCount(co.lower_missing_px) && isCount(co.missing_px) && co.lower_missing_px <= co.missing_px
717
+ : BALL_KEYS.every((k) => !(k in co))) &&
718
+ // Issue #557: the shortfall by side, when written, adds up to the missing pixels, and is never written for none.
719
+ (!('short_px' in co) || shortSides(co.short_px, co.missing_px)) &&
720
+ // Issue #603: the pixels a set's exclusion took from the cap, written only when it took one.
721
+ (!('excluded_px' in co) || (isCount(co.excluded_px) && co.excluded_px > 0)) &&
722
+ ('edge' in co ? co.edge === 'feather' && typeof co.feather_radius === 'number' && Number.isFinite(co.feather_radius) && co.feather_radius >= 0 && isCount(co.feathered_px) : !('feather_radius' in co) && !('feathered_px' in co)) &&
723
+ // Issue #360 (item 14): a placed cut carries its band, line and counts, the line inside the band; none of them rides alone.
724
+ ('cut_band' in co
725
+ ? isCount(co.cut_band) &&
726
+ co.cut_band >= 1 &&
727
+ Number.isInteger(co.cut_offset) &&
728
+ Math.abs(co.cut_offset as number) <= co.cut_band &&
729
+ pt(co.cut_at, 2) &&
730
+ isCount(co.cut_crossed) &&
731
+ isCount(co.joint_crossed) &&
732
+ isCount(co.band_px) &&
733
+ (co.cut_crossed as number) <= (co.joint_crossed as number) &&
734
+ (!('stroke_luma_max' in co) || (isCount(co.stroke_luma_max) && co.stroke_luma_max <= 255))
735
+ : CUT_KEYS.every((k) => !(k in co)));
736
+ if (!ok) {
737
+ fail(
738
+ 'PARTS_FIELD_TYPE',
739
+ object,
740
+ `is ${show(c)}; {at: [x, y], width, radius, box: [x, y, w, h], layer_px, image_px?, image_layer? (with image_px), missing_px, short_px? ({left, right}, adding up to missing_px, above 0), excluded_px? (above 0), shape? ("disc" or "ball", with upper_px; "ball" with lower_px, lower_kept_px and lower_missing_px, at most missing_px; without it upper_px? above 0), edge? ("feather", with feather_radius and feathered_px), cut_band? (with cut_offset inside the band, cut_at, cut_crossed at most joint_crossed, band_px, stroke_luma_max? 0..255)} is required`,
741
+ );
742
+ }
743
+ }
706
744
  /** Issue #557: a cap's `short_px` — `{left, right}`, two counts and no other key, adding up to `missing`, above 0. */
707
745
  function shortSides(v: unknown, missing: unknown): boolean {
708
746
  if (typeof v !== 'object' || v === null || Array.isArray(v)) return false;
package/src/propose.ts CHANGED
@@ -146,7 +146,7 @@ import { type Mask, newMask, newRaster, type Raster } from './raster/types.ts';
146
146
  import { npMean, npMedian, npPercentile, pyFixed, pyInt, pyIntList, pyRepr, pyRound, pyStrList } from './pyfmt.ts';
147
147
  import type { JointState, RigJoint, RigJoints } from './keypoints.ts';
148
148
  import { IDLE_FPS } from './motion.ts';
149
- import { influenceFarthest } from './rig.ts';
149
+ import { FORK_SMOOTH_MAX_INFLUENCES, influenceFarthest } from './rig.ts';
150
150
  import { type Segment as WeightSegment } from './weights.ts';
151
151
  import { pyRound as roundTo } from './round.ts';
152
152
  import { KEYPOINT_NAMES, type KeypointName } from './skeleton.ts';
@@ -154,7 +154,7 @@ import { configRoles, type RoleOf } from './structure.ts';
154
154
  import { AUTHOR_NO_ROLE, isAuthorTag } from './tags.ts';
155
155
  import { TURN_BONE, TURN_CARRIER_TAG, TURN_PLACES, TURN_RIDER_OFFSET, TURN_RIDER_TAGS, turnFractions, turnNearest, turnPivot, turnRiderDepth, type TurnSpec } from './turn.ts';
156
156
  import { edgeLength } from './length.ts';
157
- import { bonePlaces, jointLine, limbCrossing, limbPolyline, limbRun, limbWidth, nearestLimb, nearestOnLine, offLineFigure, type Pt } from './limbs.ts';
157
+ import { bonePlaces, jointLine, type JointLine, limbCrossing, limbPolyline, limbRun, limbWidth, nearestLimb, nearestOnLine, offLineFigure, type Pt } from './limbs.ts';
158
158
  import { type BranchSqueezeFinding, branchSqueezes, chainSqueezes, type SqueezeFinding } from './squeeze.ts';
159
159
  import { backHairMasses, type BackHairMass, backHairMassTrees, INFLUENCE_RADIUS_CELLS, RECIPE_BACK_HAIR_CHAINS, RECIPE_LENGTH_RATIO, chainConstraints, clothNote, type ClothRecipe, type ClothRecipes, type ClothTarget, CLOTH_TARGETS, draftTrees, spanCrosses, swingName, type Tail, tailOverlap, type TailOverlap, type TailSpan, treeConstraints, type TreeChain, type TreeInput, type TreeMassInput } from './cloth.ts';
160
160
  import { TEXTURE_STRETCH_CEILING } from './check.ts';
@@ -2588,7 +2588,18 @@ export function proposeWithBasis(
2588
2588
  // legwear part carries its limbs. With joints, when the tagged route has no part for a complete limb, the one topwear
2589
2589
  // part that holds every such limb's joints is the figure layer: the trunk and those limbs split it by the cut.
2590
2590
  const lwTagged = P.byTag('legwear', undefined, true).filter((p) => p.opaque_px > 500);
2591
- const figure = joints === undefined ? null : figureLayerOf(P, hw, lwTagged, joints, { hip, chest, neck: neckAt });
2591
+ // Issue #631: a part a cloth recipe names is that recipe's mesh, so it is never the figure layer.
2592
+ const clothNamed = new Map<string, string>();
2593
+ for (const t of CLOTH_TARGETS) {
2594
+ const r = cloth?.[t];
2595
+ if (r === undefined) continue;
2596
+ for (const [field, v] of [['part', r.part], ['parts', r.parts]] as const) {
2597
+ if (v === undefined) continue;
2598
+ for (const n of typeof v === 'string' ? [v] : v) if (!clothNamed.has(n)) clothNamed.set(n, `config.cloth.${JSON.stringify(t)}.${field}`);
2599
+ }
2600
+ }
2601
+ const figure = joints === undefined ? null : figureLayerOf(P, hw, lwTagged, joints, { hip, chest, neck: neckAt }, clothNamed);
2602
+ if (figure !== null) notes.push(...figure.cloth);
2592
2603
  if (figure !== null && figure.part === null) notes.push(figure.note);
2593
2604
  const figPart = figure === null ? null : figure.part;
2594
2605
  if (figure !== null && figPart !== null) {
@@ -3470,7 +3481,15 @@ export function proposeWithBasis(
3470
3481
  radius = roundTo(farthest + INFLUENCE_RADIUS_CELLS * cell, 4);
3471
3482
  radii.push({ kind: 'influence-radius', part: name, tag, radius, farthest: roundTo(farthest, 4), cells: INFLUENCE_RADIUS_CELLS, cell });
3472
3483
  }
3473
- meshes[name] = { influence: { cell, radius, across: decl.across, max: decl.max, shape: decl.shape }, segments };
3484
+ // Issue #615: under the recipe's `split.hold_tip` the mesh declares `hold_tip: true`, which the rig stage reads to
3485
+ // smooth the held fork as it smooths the lattice's, and `max` is raised to the lattice's smoothing cap
3486
+ // (FORK_SMOOTH_MAX_INFLUENCES, 8) as the lattice's `r` is raised to its grid — the rig stage caps the smoothing
3487
+ // at the declared max. On wind's bottomwear under a 60-degree hip sway (#615, rigc 2.60.0) the draft folds 41
3488
+ // frames at max 6, 23 smoothed at max 6, 3 at max 8 unsmoothed and 0 smoothed at max 8, against the lattice's 5.
3489
+ // A declared max above the cap is kept.
3490
+ const held = recipeOf(tag)?.split?.hold_tip === true;
3491
+ const max = held ? Math.max(decl.max, FORK_SMOOTH_MAX_INFLUENCES) : decl.max;
3492
+ meshes[name] = { influence: { cell, radius, across: decl.across, max, shape: decl.shape, ...(held ? { hold_tip: true as const } : {}) }, segments };
3474
3493
  }
3475
3494
  const constrained = clothConstraints.length === 0 ? {} : { constraints: clothConstraints };
3476
3495
  return {
@@ -3936,6 +3955,14 @@ function legsFromJoints(P: PartSet, lw: readonly PartRecord[], joints: RigJoints
3936
3955
  * by `linePixels`): a garment hung over both legs is one column there, and
3937
3956
  * would be split into legs it does not have. Only `topwear`: `bottomwear`
3938
3957
  * would split a skirt into legs, and the head run's tags carry the head;
3958
+ * - **and on the art at every cut** (issue #629): the trunk's at `chest` and
3959
+ * `neck`, each arm's at its elbow, each leg's at its knee, read by
3960
+ * assemble's own test (`ASSEMBLE_LIMB_JOINT_ON_ART`, {@link limbRun} on the
3961
+ * joint line) — the 15 px above does not put a joint line on the art;
3962
+ * - **not a part a cloth recipe names** (issue #631, `clothNamed`: part name
3963
+ * to the field naming it): it keeps the recipe's mesh, and a note says so;
3964
+ * when only such parts hold the joints, `PROPOSE_FIGURE_LAYER` refuses them
3965
+ * by name — cut into limbs, the recipe's trees would move no artwork;
3939
3966
  * - **one candidate** is the figure layer;
3940
3967
  * - **several**: the one with the most opaque px in the
3941
3968
  * `(2 x WRIST_ON_PART_PX + 1)`-square about each of those points, summed (the
@@ -3954,7 +3981,8 @@ function figureLayerOf(
3954
3981
  lw: readonly PartRecord[],
3955
3982
  joints: RigJoints,
3956
3983
  trunk: { hip: [number, number]; chest: [number, number]; neck: [number, number] },
3957
- ): { part: PartRecord | null; arms: boolean; legs: boolean; note: string } | null {
3984
+ clothNamed: ReadonlyMap<string, string>,
3985
+ ): { part: PartRecord | null; arms: boolean; legs: boolean; note: string; cloth: string[] } | null {
3958
3986
  const J = joints.joints;
3959
3987
  const given = (a: KeypointName, b: KeypointName, c: KeypointName): boolean => {
3960
3988
  const p = J[a].at;
@@ -3987,13 +4015,64 @@ function figureLayerOf(
3987
4015
  return `${p.name}'s art does not break on the line from ${a} to ${b}: the legs are one column there, as a garment over both legs is`;
3988
4016
  }
3989
4017
  }
4018
+ return cutOffArt(p);
4019
+ };
4020
+ // Issue #629: each cut the draft would make on the layer — the trunk's at chest and neck, each arm's at its elbow,
4021
+ // each leg's at its knee — read as assemble's cap reads it (`cutLimbs`, src/assemble.ts): the joint line through the
4022
+ // lower bone's origin ({@link jointLine}), and the run of the limb's own art along it within 1 px ({@link limbRun}),
4023
+ // each pixel the limb's whose polyline passes nearest it ({@link nearestLimb}), the limbs in the order the draft
4024
+ // writes them. The points above lying within 15 px of the art does not put the joint line on it.
4025
+ const cutOffArt = (p: PartRecord): string | null => {
4026
+ const m = P.alpha(p);
4027
+ const box = [0, 0, P.W - 1, P.H - 1] as const;
4028
+ const arms = armSides.length > 0 ? (armsFromJoints(P, [p], joints, null, false).arms ?? []) : [];
4029
+ const legs = legSides.length > 0 ? (legsFromJoints(P, [p], joints).chains ?? []) : [];
4030
+ const [h, c, n] = [rnd(trunk.hip), rnd(trunk.chest), rnd(trunk.neck)];
4031
+ const limbs: Array<{ limb: string; poly: Pt[]; cuts: Array<{ joint: string; line: JointLine | null }> }> = [
4032
+ { limb: 'trunk', poly: [h, c, n], cuts: [{ joint: 'chest', line: jointLine(h, c, n) }, { joint: 'neck', line: jointLine(c, n, null) }] },
4033
+ ...arms.map((a) => {
4034
+ const [s, e, t] = [rnd(a.shoulder), rnd(a.elbow), rnd(a.tip)];
4035
+ return { limb: `arm_${a.side}`, poly: [s, e, t], cuts: [{ joint: `${a.side}_elbow`, line: jointLine(s, e, t) }] };
4036
+ }),
4037
+ ...legs.map((g) => {
4038
+ const [hp, k, an] = [rnd(g.hip), rnd(g.knee), rnd(g.ankle)];
4039
+ return { limb: `leg_${g.side}`, poly: [hp, k, an], cuts: [{ joint: `${g.side}_knee`, line: jointLine(hp, k, an) }] };
4040
+ }),
4041
+ ];
4042
+ const polys = limbs.map((l) => l.poly);
4043
+ for (const [i, l] of limbs.entries()) {
4044
+ const art = (x: number, y: number): boolean => x >= 0 && y >= 0 && x < P.W && y < P.H && m.data[y * P.W + x] === 1 && nearestLimb(polys, x, y) === i;
4045
+ for (const { joint, line } of l.cuts) {
4046
+ // A cut with no joint line is assemble's ASSEMBLE_LIMB_JOINT, named there; this reads only where the line is.
4047
+ if (line === null || limbRun(line, art, box) !== null) continue;
4048
+ return `${p.name}'s art is not on the ${joint} cut of ${l.limb}: the joint at [${line.at.join(', ')}] lies on none of ${l.limb}'s art within 1 px along its joint line (${offLineFigure(nearestOnLine(line, art, box))}), where assemble refuses the cut (ASSEMBLE_LIMB_JOINT_ON_ART)`;
4049
+ }
4050
+ }
3990
4051
  return null;
3991
4052
  };
3992
4053
  const read = tw.map((p) => ({ p, miss: misses(p) }));
3993
- const holds = read.filter((r) => r.miss === null).map((r) => r.p);
3994
4054
  const what = `every joint of ${limbNames.join(', ')} and the origins of hip, chest and neck`;
4055
+ // Issue #631: a part a cloth recipe names explicitly is that recipe's mesh; a limb takes every pixel of its part, so as
4056
+ // the figure layer its mesh would be dropped and the recipe's trees would control no artwork. It is no candidate.
4057
+ const named = read.filter((r) => r.miss === null && clothNamed.has(r.p.name)).map((r) => r.p);
4058
+ const holds = read.filter((r) => r.miss === null && !clothNamed.has(r.p.name)).map((r) => r.p);
4059
+ const recipeOf = (p: PartRecord): string => clothNamed.get(p.name) as string;
4060
+ if (named.length > 0 && holds.length === 0) {
4061
+ throw new PartsError([
4062
+ {
4063
+ code: 'PROPOSE_FIGURE_LAYER',
4064
+ object: `${named.length === 1 ? 'part' : 'parts'} ${named.map((p) => `"${p.name}"`).join(', ')} (topwear)`,
4065
+ detail: `${why}, and only ${named.length === 1 ? 'it holds' : 'they hold'} within ${WRIST_ON_PART_PX} px ${what}, but ${named.map((p) => `${recipeOf(p)} names "${p.name}"`).join(' and ')}: a cloth recipe's part keeps the recipe's mesh, and a limb takes every pixel of its part, so cut into limbs the recipe's trees would control no artwork (issue #631); a figure layer no cloth recipe names is required — give the arms and legs their own handwear and legwear layers, or take the part out of the recipe`,
4066
+ },
4067
+ ]);
4068
+ }
4069
+ const cloth = named.map(
4070
+ (p) =>
4071
+ `${p.name} (${p.from}): not the figure layer, though its art holds within ${WRIST_ON_PART_PX} px ${what} — ${recipeOf(p)} names it, so it keeps the cloth recipe's mesh: a limb takes every pixel of its part, and cut into limbs the recipe's trees would control no artwork (issue #631)`,
4072
+ );
3995
4073
  if (holds.length === 0) {
3996
4074
  return {
4075
+ cloth,
3997
4076
  part: null,
3998
4077
  arms: false,
3999
4078
  legs: false,
@@ -4025,6 +4104,7 @@ function figureLayerOf(
4025
4104
  const fig = scored[0].p;
4026
4105
  const over = scored.length > 1 ? `; of the ${scored.length} topwear parts that hold them it has the most opaque px in the ${2 * half + 1}x${2 * half + 1} squares about those points, ${scored.map((c) => `${c.p.name} ${c.n}`).join(', ')}` : '';
4027
4106
  return {
4107
+ cloth,
4028
4108
  part: fig,
4029
4109
  arms: armSides.length > 0,
4030
4110
  legs: legSides.length > 0,