@rig-c/parts 2.50.0 → 2.52.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/cli.ts +130 -14
- package/docs/AUTHORING.md +163 -56
- package/docs/DEPTH.md +22 -2
- package/docs/STABILITY.md +81 -24
- package/package.json +3 -2
- package/src/build.ts +2 -0
- package/src/bustlandmarks.ts +64 -8
- package/src/check.ts +55 -26
- package/src/checkrow.ts +1 -0
- package/src/cloth-targets.json +10 -0
- package/src/config.ts +50 -43
- package/src/configwrite.ts +70 -12
- package/src/depthworkflow.ts +38 -4
- package/src/editedparts.ts +43 -1
- package/src/instruments.ts +2 -2
- package/src/outputpaths.ts +24 -0
- package/src/parts.ts +35 -2
- package/src/physicscontrib.ts +311 -0
- package/src/propose.ts +30 -22
- package/src/rig.ts +13 -0
package/cli.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { DIFF_DRAFTS_SPEC, diffDraftsCommand } from './src/diffdrafts.ts';
|
|
|
5
5
|
import { applyTakenLayers } from './src/takelayers.ts';
|
|
6
6
|
import { applyDepth, bindDepthMap, prepareDepth } from './src/depthworkflow.ts';
|
|
7
7
|
import { externalReceipt } from './src/externalreceipt.ts';
|
|
8
|
-
import { BUST_LANDMARKS_ACT_SCHEMA, BUST_LANDMARKS_PROVENANCE_SPEC, BUST_LANDMARKS_PROVENANCE_SUFFIX, type BustSidecar, planBustLandmarks, readBustSidecar, stageBustLandmarks, stageReplacements, type StagedBustLandmarks } from './src/bustlandmarks.ts';
|
|
8
|
+
import { BUST_LANDMARKS_ACT_SCHEMA, BUST_LANDMARKS_PROVENANCE_SPEC, BUST_LANDMARKS_PROVENANCE_SUFFIX, BUST_POINT_SHAPE_FIELDS, bustShapeClause, type BustSidecar, effectiveBustShape, planBustLandmarks, readBustSidecar, stageBustLandmarks, stageReplacements, type StagedBustLandmarks } from './src/bustlandmarks.ts';
|
|
9
9
|
import { writeEditedPart } from './tools/edited-part-cli.ts';
|
|
10
10
|
/**
|
|
11
11
|
* rig-parts — one painting and its See-through layers in, Spine-ready parts
|
|
@@ -32,6 +32,7 @@ import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, PACK
|
|
|
32
32
|
import { ComfyClient, resolveHost, runBackground, runMatte, runPainting, runSeeThrough } from './src/comfy/index.ts';
|
|
33
33
|
import { coreCfg, DEFAULT_GROW_PX, runForeground } from './src/plate.ts';
|
|
34
34
|
import { type CharacterConfig, loadClothConfig, loadConfig, loadEarlyConfig, loadPaintConfig } from './src/config.ts';
|
|
35
|
+
import { type ConfigWritePatch, onlyMissingAttachments } from './src/configwrite.ts';
|
|
35
36
|
import { configWriteLines, type ConfigWriteTarget, readConfigWriteTarget, separateConfigWriteTarget, stageConfigWrite, type StagedConfigWrite } from './tools/configwrite.ts';
|
|
36
37
|
import { failLine, guidePointer, PartsError, type Problem } from './src/errors.ts';
|
|
37
38
|
import { GUIDE_DOC, type GuideAnswer, guideRule, guideSection } from './src/guide.ts';
|
|
@@ -42,7 +43,7 @@ import { idleKeysOf, isIdleKeys } from './src/rig.ts';
|
|
|
42
43
|
import { bodyCoreBox, bodyOpaqueBox, CORE_ALPHA, depthSkipLine, exportLayers, figuresPhrase, hiddenLayerLine, implausibleRules, layerCoreBox, layerFigures, layerOpaqueBox, type LayerSet, layerSetDiff, type OpaqueBox, OPAQUE_ALPHA_ABOVE, pct, readLayers, readWrapperLayers, ruleSummary, templateLayerNames, templatePsdBytes, times } from './src/layers.ts';
|
|
43
44
|
import { checkImageSize, choosePerson, KEYPOINTS_SPEC, loadKeypoints, type RigJoints, toRigJoints } from './src/keypoints.ts';
|
|
44
45
|
import { checkPartsStage } from './src/partscheck.ts';
|
|
45
|
-
import { basisLines, branchSqueezeLine, checkProposal, compare, compareLines, DEFAULT_GRID_RULE, draftTurn, drawLandmarks, FIGURE_GRID_DIVISOR, FRINGE_STEP_PX, GRID_RULES, type GridRule, type BustDraft, HIP_MIN_FRACTION, type DraftLintFinding, lint, lintLine, type PartSet, PROPOSAL_CONFIG_SECTIONS, proposalAsConfig, proposeWithBasis, readBustLandmarks, readPartSet, serializeProposal, withTurn, WRIST_ON_PART_PX } from './src/propose.ts';
|
|
46
|
+
import { basisLines, branchSqueezeLine, bustCleavage, checkProposal, compare, compareLines, DEFAULT_GRID_RULE, draftTurn, drawLandmarks, FIGURE_GRID_DIVISOR, FRINGE_STEP_PX, GRID_RULES, type GridRule, type BustDraft, type Proposal, HIP_MIN_FRACTION, type DraftLintFinding, lint, lintLine, type PartSet, PROPOSAL_CONFIG_SECTIONS, proposalAsConfig, proposeWithBasis, readBustLandmarks, readPartSet, serializeProposal, withTurn, WRIST_ON_PART_PX } from './src/propose.ts';
|
|
46
47
|
import { BASIS_FILE, BASIS_SPEC, basisFile, basisLine, coverageLines, legChainChoice, serializeBasis } from './src/diagnostics.ts';
|
|
47
48
|
import { BEND_DEGREES, BEND_WORST_SHARE, DUST_MAX_PX, DUST_MAX_SHARE, IDLE_BOUND_PX, MESH_DRAFT_REPORT, MESH_DRAFT_SPEC, meshDraftStage, MORE_TRIANGLES_FLAG, relativeConfigPaths, TOLERANCE_FIGURE_DIVISOR } from './src/meshdraft.ts';
|
|
48
49
|
import { meshStatsStage } from './src/meshstats.ts';
|
|
@@ -103,11 +104,13 @@ usage:
|
|
|
103
104
|
Write <map>.binding.json with both file hashes; never overwrite a receipt.
|
|
104
105
|
Attests the current files, not that inference used this input.
|
|
105
106
|
|
|
106
|
-
rig-parts depth-apply --parts <assembled-dir> --manifest <manifest.json> --config <depth-recipe.json> --rig-config <config.json> --out <empty-dir>
|
|
107
|
+
rig-parts depth-apply --parts <assembled-dir> --manifest <manifest.json> --config <depth-recipe.json> --rig-config <config.json> --out <empty-dir> [--groups <name>[,<name>...]]
|
|
107
108
|
Register floating-point JSON depth or signed normals, normalize inside
|
|
108
109
|
alpha >=128, apply declared median/relief and group near/zScale/pivot,
|
|
109
110
|
extend past alpha, and write parts, relocated config and depth-report.json.
|
|
110
111
|
Normals require one closed convex island. See AUTHORING for the schemas.
|
|
112
|
+
--groups applies only the named recipe groups; the others' parts get no
|
|
113
|
+
sheet, and the selection is recorded in depth-report.json.
|
|
111
114
|
|
|
112
115
|
rig-parts layers <dir | layers.json | file.psd>
|
|
113
116
|
Read a See-through decomposition — the ComfyUI wrapper form (a directory
|
|
@@ -266,6 +269,10 @@ usage:
|
|
|
266
269
|
rigid sibling unit under the body carrier. Reassembled art is written to
|
|
267
270
|
<out>/rig; depth comes from the existing scalar input, named in note:.
|
|
268
271
|
Missing depth, landmarks or clean source is refused, never invented.
|
|
272
|
+
With --bust-landmarks or --no-bust instead of --full and --head, write
|
|
273
|
+
only the chest carrier's contour.bust and bones boob_r/boob_l, every
|
|
274
|
+
other entry as read; a cleavage the file omits is derived from the
|
|
275
|
+
config's own neck and hip bones, and the output says which source.
|
|
269
276
|
|
|
270
277
|
rig-parts propose … [--grid-rule figure|part]
|
|
271
278
|
How each drafted lattice's spacing (meshes.<part>.grid) is chosen.
|
|
@@ -1242,7 +1249,7 @@ const TAKES = {
|
|
|
1242
1249
|
'diff-drafts': { valued: ['--left', '--right', '--out'], switches: ['--help'] },
|
|
1243
1250
|
'depth-bind': { valued: ['--map', '--input', '--part'], switches: ['--help'] },
|
|
1244
1251
|
'depth-prepare': { valued: ['--parts', '--config', '--out'], switches: ['--help'] },
|
|
1245
|
-
'depth-apply': { valued: ['--parts', '--manifest', '--config', '--rig-config', '--out'], switches: ['--help'] },
|
|
1252
|
+
'depth-apply': { valued: ['--parts', '--manifest', '--config', '--rig-config', '--out', '--groups'], switches: ['--help'] },
|
|
1246
1253
|
layers: { valued: ['--export', '--template', '--canvas', '--full', '--source', '--config'], switches: ['--help'] },
|
|
1247
1254
|
sheet: { valued: ['--source', '--layers', '--out', '--cell', '--cols'], switches: ['--help'] },
|
|
1248
1255
|
rig: { valued: ['--config', '--parts', '--out', '--idle-keys', '--page-edges', '--pack-shape', '--page-size'], switches: ['--help'] },
|
|
@@ -1826,14 +1833,30 @@ function cmdPropose(args: string[]): number {
|
|
|
1826
1833
|
if (!existsSync(source)) {
|
|
1827
1834
|
throw new PartsError([{ code: 'PROPOSE_SOURCE_PRESENT', object: source, detail: 'no such file; the painting is drawn under the overlay' }]);
|
|
1828
1835
|
}
|
|
1836
|
+
// Issue #1436: on a sampled body-turn neck config the chest flags without the runs write the chest alone.
|
|
1837
|
+
let chestOnly = false;
|
|
1829
1838
|
if (target !== null && typeof target.raw === 'object' && target.raw !== null && 'turn' in target.raw) {
|
|
1830
1839
|
const turn = target.raw.turn;
|
|
1831
1840
|
if (typeof turn === 'object' && turn !== null && 'body' in turn && (loadEarlyConfig(target.path, 'assemble').assemble.plan.some(([, , tag]) => tag === 'neck'))) {
|
|
1832
|
-
const
|
|
1833
|
-
|
|
1841
|
+
const chestFlags = ['--bust-landmarks', '--no-bust'].filter((f) => flags.has(f));
|
|
1842
|
+
const runs = ['--full', '--head'].filter((f) => flags.has(f));
|
|
1843
|
+
const chestCommand = `rig-parts propose --parts <dir> --source <painting.png> --out <dir> --write-config ${writeArg} ${chestFlags.includes('--no-bust') ? '--no-bust "<reason>"' : '--bust-landmarks <landmarks.json>'}`;
|
|
1844
|
+
if (chestFlags.length > 0 && runs.length > 0) {
|
|
1845
|
+
throw new PartsError([{ code: 'PROPOSE_NECK_MODE', object: [...chestFlags, ...runs].join(', '), detail: `the neck draft (--full, --head) and the chest-only write (${chestFlags.join(', ')}) are separate runs on a sampled body-turn neck config; write the chest with ${chestCommand}, without --full and --head, and draft the neck in its own run` }]);
|
|
1846
|
+
}
|
|
1847
|
+
chestOnly = chestFlags.length > 0;
|
|
1848
|
+
const allowed = chestOnly ? ['--parts', '--source', '--out', '--write-config', '--bust-landmarks', '--no-bust'] : ['--parts', '--source', '--out', '--full', '--head', '--write-config'];
|
|
1849
|
+
const unsupported = [...flags.keys()].filter(f => !allowed.includes(f));
|
|
1850
|
+
if (unsupported.length > 0) {
|
|
1851
|
+
throw new PartsError([{ code: 'PROPOSE_NECK_MODE', object: unsupported.join(', '), detail: chestOnly
|
|
1852
|
+
? `cannot be combined with the chest-only write on a sampled body-turn neck config; use --parts, --source, --out, --write-config and ${chestFlags.join(', ')} only (${chestCommand}); run comparison or other drafting separately`
|
|
1853
|
+
: 'cannot be combined with the authored sampled-turn neck draft; use --parts, --source, --out, --full, --head and --write-config only; run comparison or landmark drafting separately' }]);
|
|
1854
|
+
}
|
|
1834
1855
|
if (onlyMissing) throw new PartsError([{ code: 'PROPOSE_NECK_MODE', object: '--only-missing', detail: 'cannot replace an attached neck; omit --only-missing for the explicit sampled body-turn neck draft' }]);
|
|
1835
|
-
|
|
1836
|
-
|
|
1856
|
+
if (!chestOnly) {
|
|
1857
|
+
proposeNeck(target, { source, parts: partsDir, out, full: flags.get('--full'), head: flags.get('--head') });
|
|
1858
|
+
return EXIT_OK;
|
|
1859
|
+
}
|
|
1837
1860
|
}
|
|
1838
1861
|
}
|
|
1839
1862
|
if (flags.has('--from-config') && (flags.has('--bust-landmarks') || flags.has('--no-bust'))) return usage('--bust-landmarks and --no-bust draft a torso. --from-config reads authored meshes');
|
|
@@ -1887,6 +1910,22 @@ function cmdPropose(args: string[]): number {
|
|
|
1887
1910
|
separateConfigWriteTarget(target, [sidecar.path]);
|
|
1888
1911
|
}
|
|
1889
1912
|
}
|
|
1913
|
+
// Issue #1436: the config is the record, so a cleavage the file leaves out is derived from the config's own midline.
|
|
1914
|
+
let cleavageSource: string | null = null;
|
|
1915
|
+
if (chestOnly && bust.landmarks !== undefined) {
|
|
1916
|
+
if (bust.landmarks.cleavage === undefined) {
|
|
1917
|
+
const declared = loadConfig(target!.path).bones;
|
|
1918
|
+
const at = (name: string): [number, number] => {
|
|
1919
|
+
const bone = declared.find((b) => 'name' in b && b.name === name);
|
|
1920
|
+
if (bone === undefined || !('at' in bone)) throw new PartsError([{ code: 'PROPOSE_BUST_INPUT', object: 'landmarks.cleavage', detail: `is absent and config.bones declares no "${name}" bone with an origin; the config's neck-to-hip midline is required to derive it, or declare cleavage in the landmarks file` }]);
|
|
1921
|
+
return [bone.at[0], bone.at[1]];
|
|
1922
|
+
};
|
|
1923
|
+
const neckAt = at('neck'), hipAt = at('hip');
|
|
1924
|
+
bust.landmarks = { ...bust.landmarks, cleavage: bustCleavage(bust.landmarks.apex_r, bust.landmarks.apex_l, neckAt, hipAt) };
|
|
1925
|
+
cleavageSource = `derived at the apex segment crossing of the config's neck [${neckAt.join(', ')}] -> hip [${hipAt.join(', ')}] midline`;
|
|
1926
|
+
bust.cleavageFrom = cleavageSource;
|
|
1927
|
+
} else cleavageSource = 'from the landmarks file';
|
|
1928
|
+
}
|
|
1890
1929
|
const { proposal: drafted, basis, draftLint } = proposeWithBasis(P, joints, wristSnap, gridRule, cloth, true, bust);
|
|
1891
1930
|
const fullRun = flags.get('--full');
|
|
1892
1931
|
const headRun = flags.get('--head');
|
|
@@ -1895,7 +1934,8 @@ function cmdPropose(args: string[]): number {
|
|
|
1895
1934
|
? drafted
|
|
1896
1935
|
: withTurn(drafted, draftTurn(P, { ...(fullRun === undefined ? {} : { full: readLayers(fullRun) }), ...(headRun === undefined ? {} : { head: readLayers(headRun) }) }, drafted));
|
|
1897
1936
|
// Emit only after green: a proposal the config loader would refuse is not written, nor a basis record that does not hold to it.
|
|
1898
|
-
|
|
1937
|
+
// Issue #1441: the chest carrier's points are checked with the shape the config write will hold.
|
|
1938
|
+
checkProposalWithBustShape(P, prop, target, sidecar, onlyMissing);
|
|
1899
1939
|
if (sidecar !== null) {
|
|
1900
1940
|
// The record's part must be the chest carrier this draft makes: points placed on another part are not these.
|
|
1901
1941
|
const carriers = Object.entries(prop.meshes).filter(([, mesh]) => 'contour' in mesh && mesh.contour.bust !== undefined).map(([part]) => part);
|
|
@@ -1939,7 +1979,11 @@ function cmdPropose(args: string[]): number {
|
|
|
1939
1979
|
const bfile = basisFile(P, prop, basis, cfg === null || cmpPath === undefined ? null : { where: cmpPath, config: cfg });
|
|
1940
1980
|
const img = drawLandmarks(P, painting, prop.bones, 'PROPOSAL - CORRECT ME');
|
|
1941
1981
|
const pending = sidecar?.pending ?? null;
|
|
1942
|
-
|
|
1982
|
+
let chest: { patch: Extract<ConfigWritePatch, { kind: 'bust' }>; line: string } | null = null;
|
|
1983
|
+
if (target !== null && chestOnly) {
|
|
1984
|
+
chest = chestOnlyPatch(target, prop, bust, cleavageSource);
|
|
1985
|
+
staged = stageConfigWrite(target, { ...chest.patch, ...(pending === null ? {} : { bustShape: pending }) });
|
|
1986
|
+
} else if (target !== null) staged = stageConfigWrite(target, onlyMissing ? { kind: 'proposal-missing', proposal: prop, parts: P.recs } : { kind: 'proposal', proposal: prop, sections: PROPOSAL_CONFIG_SECTIONS, ...(pending === null ? {} : { bustShape: pending }) });
|
|
1943
1987
|
else if (written !== null) staged = stageConfigWrite({ kind: 'fresh', path: written.at, text: written.text });
|
|
1944
1988
|
// The record marked applied is staged after the config and renamed in before the config's commit; a failed
|
|
1945
1989
|
// config commit puts the record back, so the two change together or not at all.
|
|
@@ -1962,6 +2006,7 @@ function cmdPropose(args: string[]): number {
|
|
|
1962
2006
|
throw new PartsError(problems);
|
|
1963
2007
|
}
|
|
1964
2008
|
if (target !== null) for (const line of configWriteLines(target, staged.changes)) console.error(line);
|
|
2009
|
+
if (chest !== null) console.log(chest.line);
|
|
1965
2010
|
if (marked !== null && pending !== null && sidecar !== null) {
|
|
1966
2011
|
console.log(`propose: wrote the pending shape of act ${JSON.stringify(sidecar.provenance.act.act_id)} into meshes.${pending.part}.contour.bust (${pendingFields(pending.fields)}) with the three points; marked it applied in ${sidecar.path}`);
|
|
1967
2012
|
}
|
|
@@ -2731,6 +2776,69 @@ function pendingFields(fields: Readonly<Record<string, number | string | undefin
|
|
|
2731
2776
|
return Object.entries(fields).filter(([, v]) => v !== undefined).map(([k, v]) => `${k} ${JSON.stringify(v)}`).join(', ');
|
|
2732
2777
|
}
|
|
2733
2778
|
|
|
2779
|
+
/**
|
|
2780
|
+
* The chest-only write on a sampled body-turn neck config (issue #1436): the chest carrier this draft makes, its
|
|
2781
|
+
* `contour.bust` points (none with --no-bust) and the `boob_r` / `boob_l` bones, as one `bust` patch, and the line
|
|
2782
|
+
* that says what it writes and where the cleavage came from. The config's carrier must already be a contour mesh.
|
|
2783
|
+
*/
|
|
2784
|
+
/**
|
|
2785
|
+
* Issue #1441: `checkProposal`, with the chest carrier's `contour.bust` checked against the effective shape
|
|
2786
|
+
* (`effectiveBustShape`): the config's declared shape fields on that part, a pending record's over them, the
|
|
2787
|
+
* defaults for the rest, which is what the config write keeps. The proposal written is the draft as it was. With
|
|
2788
|
+
* no declared or pending alpha or clearance the check is the draft's own, so its refusals read as before; otherwise a
|
|
2789
|
+
* clearance refusal names the shape it used and where each value came from.
|
|
2790
|
+
*/
|
|
2791
|
+
function checkProposalWithBustShape(P: PartSet, prop: Proposal, target: ConfigWriteTarget | null, sidecar: BustSidecar | null, onlyMissing: boolean): void {
|
|
2792
|
+
const carrier = Object.entries(prop.meshes).find(([, mesh]) => 'contour' in mesh && mesh.contour.bust !== undefined);
|
|
2793
|
+
if (carrier === undefined || !('contour' in carrier[1]) || carrier[1].contour.bust === undefined) { checkProposal(P, prop); return; }
|
|
2794
|
+
const [part, mesh] = carrier;
|
|
2795
|
+
// --only-missing skips a part the config attaches (the write's own decision), so the draft's points are not
|
|
2796
|
+
// written and the declared shape is not theirs: the draft is checked as drafted, as before #1441.
|
|
2797
|
+
if (onlyMissing && target !== null && onlyMissingAttachments(target.raw).has(part)) { checkProposal(P, prop); return; }
|
|
2798
|
+
const isObject = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
2799
|
+
const raw = target === null ? undefined : target.raw;
|
|
2800
|
+
const meshes = isObject(raw) && isObject(raw.meshes) ? raw.meshes : undefined;
|
|
2801
|
+
const declaredMesh = meshes !== undefined && Object.hasOwn(meshes, part) ? meshes[part] : undefined;
|
|
2802
|
+
const declared = isObject(declaredMesh) && isObject(declaredMesh.contour) && isObject(declaredMesh.contour.bust) ? declaredMesh.contour.bust : undefined;
|
|
2803
|
+
const pending = sidecar?.pending?.part === part ? sidecar.pending.fields : undefined;
|
|
2804
|
+
const shape = effectiveBustShape(declared, pending);
|
|
2805
|
+
const used = BUST_POINT_SHAPE_FIELDS.filter((key) => shape[key].source !== 'the default');
|
|
2806
|
+
if (used.length === 0) { checkProposal(P, prop); return; }
|
|
2807
|
+
const bust = { ...mesh.contour.bust, ...Object.fromEntries(used.map((key) => [key, shape[key].value])) };
|
|
2808
|
+
// checkProposal's own reader (proposalAsConfig), given the shape values as read: the loader types them.
|
|
2809
|
+
const meshesChecked: Record<string, unknown> = { ...prop.meshes, [part]: { ...mesh, contour: { ...mesh.contour, bust } } };
|
|
2810
|
+
try { proposalAsConfig(P, { ...prop, meshes: meshesChecked }); }
|
|
2811
|
+
catch (error) {
|
|
2812
|
+
if (!(error instanceof PartsError)) throw error;
|
|
2813
|
+
const at = `config.meshes.${part}.contour.bust.clearance`;
|
|
2814
|
+
throw new PartsError(error.problems.map((p) => p.code === 'CONFIG_BUST_CLEARANCE' && p.object === at ? { ...p, detail: `${p.detail}; ${bustShapeClause(shape)}` } : p));
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
function chestOnlyPatch(target: ConfigWriteTarget, prop: Proposal, bust: BustDraft, cleavageSource: string | null): { patch: Extract<ConfigWritePatch, { kind: 'bust' }>; line: string } {
|
|
2819
|
+
const omitted = (part: string): boolean => prop.notes.some((n) => n.startsWith(`${part}: contour bust omitted for the declared reason: `));
|
|
2820
|
+
const carrier = Object.entries(prop.meshes).find(([part, mesh]) => 'contour' in mesh && (mesh.contour.bust !== undefined || omitted(part)));
|
|
2821
|
+
if (carrier === undefined) {
|
|
2822
|
+
const chestBone = prop.bones.find((b) => 'name' in b && b.name === 'chest');
|
|
2823
|
+
const where = chestBone !== undefined && 'at' in chestBone ? ` at [${chestBone.at.join(', ')}]` : '';
|
|
2824
|
+
throw new PartsError([{ code: 'PROPOSE_BUST_INPUT', object: 'chest carrier', detail: `no topwear art covers chest${where}. A chest-holding topwear part is required for the declared bust input` }]);
|
|
2825
|
+
}
|
|
2826
|
+
const [part, mesh] = carrier;
|
|
2827
|
+
const raw = target.raw as { meshes?: Record<string, unknown> };
|
|
2828
|
+
const declared = typeof raw.meshes === 'object' && raw.meshes !== null ? raw.meshes[part] : undefined;
|
|
2829
|
+
if (typeof declared !== 'object' || declared === null || !('contour' in declared)) {
|
|
2830
|
+
const found = typeof declared !== 'object' || declared === null ? 'no mesh' : `a ${['grid', 'auto', 'influence', 'explicit'].find((m) => m in declared) ?? 'non-contour'} mesh`;
|
|
2831
|
+
throw new PartsError([{ code: 'PROPOSE_BUST_CARRIER_MESH', object: `config.meshes.${part}`, detail: `is ${found}; the chest-only write on a sampled body-turn neck config sets contour.bust on the chest carrier's contour mesh, which it does not draft. Produce one in this order: rig-parts propose … --write-config <config> --no-bust "<reason>" before turn.body is written, then write turn.body and draft the neck` }]);
|
|
2832
|
+
}
|
|
2833
|
+
const points = 'contour' in mesh ? mesh.contour.bust : undefined;
|
|
2834
|
+
const bones = prop.bones.filter((b): b is { name: string; parent: string; at: [number, number] } => 'name' in b && (b.name === 'boob_r' || b.name === 'boob_l') && 'at' in b).map((b) => ({ name: b.name, parent: b.parent, at: [b.at[0], b.at[1]] }));
|
|
2835
|
+
const patch: Extract<ConfigWritePatch, { kind: 'bust' }> = { kind: 'bust', part, bust: points === undefined || points.cleavage === undefined ? null : { apex_r: [...points.apex_r], apex_l: [...points.apex_l], cleavage: [...points.cleavage] }, bones };
|
|
2836
|
+
const line = patch.bust === null
|
|
2837
|
+
? `propose: chest-only write on the sampled body-turn neck config: meshes.${part}.contour.bust and bones boob_r, boob_l removed where present (--no-bust: ${bust.noBust ?? ''}); every other entry as read`
|
|
2838
|
+
: `propose: chest-only write on the sampled body-turn neck config: meshes.${part}.contour.bust apex_r ${JSON.stringify(patch.bust.apex_r)} apex_l ${JSON.stringify(patch.bust.apex_l)} cleavage ${JSON.stringify(patch.bust.cleavage)} (${cleavageSource ?? 'from the landmarks file'}); bones boob_r, boob_l under chest at the apices; every other entry as read`;
|
|
2839
|
+
return { patch, line };
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2734
2842
|
function cmdBustLandmarks(args: string[]): number {
|
|
2735
2843
|
// The one switch (issue #1382, round 2): taken out before the valued flags are read.
|
|
2736
2844
|
const writes = args.filter((a) => a === '--write-config').length;
|
|
@@ -2774,11 +2882,16 @@ function cmdBustLandmarks(args: string[]): number {
|
|
|
2774
2882
|
if (target !== null) for (const line of configWriteLines(target, staged?.changes ?? [])) console.error(line);
|
|
2775
2883
|
console.log(`bust-landmarks: slot "${provenance.slot}" apex_r ${JSON.stringify(landmarks.apex_r)} apex_l ${JSON.stringify(landmarks.apex_l)} cleavage ${landmarks.cleavage === undefined ? 'absent (propose derives it)' : JSON.stringify(landmarks.cleavage)}; act ${JSON.stringify(provenance.act.act_id)} sha256=${provenance.act.file_sha256} row sha256=${provenance.row_sha256} (verified against the row's edit)`);
|
|
2776
2884
|
const shape = provenance.shape;
|
|
2777
|
-
|
|
2885
|
+
// Issue #1436: both lines name the command that writes the points into the config; without --write-config,
|
|
2886
|
+
// propose writes only proposal.json.
|
|
2887
|
+
const next = `wrote ${plan.out} and ${plan.provenancePath}; next, to apply it: rig-parts propose … --write-config ${resolve(input.config)} --bust-landmarks ${plan.out}`;
|
|
2888
|
+
if (shape === undefined) console.log(next);
|
|
2778
2889
|
else {
|
|
2779
2890
|
// Issue #1382: the config declares no contour.bust, so the reviewed shape waits in the record for propose.
|
|
2780
|
-
|
|
2781
|
-
|
|
2891
|
+
// Issue #1443: or the act moved the declared points, and the shape is not written against the old ones.
|
|
2892
|
+
const why = plan.moved ? `the act moves the points of meshes.${provenance.slot}.contour.bust, so the config is not written and` : 'the config declares no contour.bust yet, so';
|
|
2893
|
+
console.log(`bust-landmarks: pending shape for "${provenance.slot}": ${pendingFields(shape.fields)}; ${why} ${plan.provenancePath} carries it until propose writes it with the three points`);
|
|
2894
|
+
console.log(next);
|
|
2782
2895
|
}
|
|
2783
2896
|
return EXIT_OK;
|
|
2784
2897
|
} catch (error) { return printRefusal(error); }
|
|
@@ -2799,8 +2912,11 @@ function cmdDepthApply(args: string[]): number {
|
|
|
2799
2912
|
const f = flags(args, 'depth-apply', ['--parts', '--manifest', '--config', '--rig-config', '--out']);
|
|
2800
2913
|
if (typeof f === 'string') return usage(f);
|
|
2801
2914
|
try {
|
|
2802
|
-
const
|
|
2915
|
+
const groups = f.get('--groups'), selected = groups === undefined ? {} : { groups: groups === '' ? [] : groups.split(',') };
|
|
2916
|
+
const result = applyDepth({ parts: f.get('--parts')!, manifest: f.get('--manifest')!, config: f.get('--config')!, rigConfig: f.get('--rig-config')!, out: f.get('--out')!, ...selected });
|
|
2803
2917
|
for (const row of result.parts as Array<Record<string, unknown>>) console.log(`depth-apply: ${row.part} levels=${row.levels} clip=${row.clipFraction} reliefRigPixels=${row.reliefRigPixels} sign=${row.sign}`);
|
|
2918
|
+
const selection = result.selection as { groups: string[]; leftOut: string[] } | undefined;
|
|
2919
|
+
if (selection !== undefined) console.log(`depth-apply: applied groups ${selection.groups.join(', ')}; left out ${selection.leftOut.length === 0 ? 'no part' : selection.leftOut.join(', ')}, without a depth sheet`);
|
|
2804
2920
|
console.log('depth-apply: wrote registered parts, config.json and depth-report.json; run rig for the core gate');
|
|
2805
2921
|
return EXIT_OK;
|
|
2806
2922
|
} catch (error) { return printRefusal(error); }
|