rig-parts 2.71.0 → 2.72.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 +9 -4
- package/docs/AUTHORING.md +9 -7
- package/docs/STABILITY.md +62 -14
- package/package.json +6 -5
- package/src/assemble.ts +2 -2
- package/src/build.ts +33 -20
- package/src/clipstretch.ts +0 -1
- package/src/configwrite.ts +1 -2
- package/src/diagnostics.ts +1 -2
- package/src/edgesplit.ts +1 -2
- package/src/meshdraft.ts +3 -4
- package/src/paintingextension.ts +1 -2
- package/src/propose.ts +1 -2
- package/src/requirements.ts +1 -2
- package/src/rig.ts +9 -12
- package/src/runstamp.ts +55 -17
- package/src/scene.ts +1 -1
- package/src/structure.ts +1 -2
- package/src/turn.ts +1 -3
- package/tools/build-process.ts +59 -8
package/cli.ts
CHANGED
|
@@ -22,7 +22,6 @@ import { replaceParts } from './src/replaceparts.ts';
|
|
|
22
22
|
* 1 it refused its input — every refusal is printed as a FAIL line
|
|
23
23
|
* 2 a usage error, or a command this version does not implement
|
|
24
24
|
*/
|
|
25
|
-
import { spawnSync } from 'node:child_process';
|
|
26
25
|
import { runBuildProcess, processRigcRunner as rigcRunner } from './tools/build-process.ts';
|
|
27
26
|
import { existsSync, linkSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
28
27
|
import { tmpdir } from 'node:os';
|
|
@@ -31,7 +30,7 @@ import { DEFAULT_PROJECT_RULE, DEFAULT_SEAM_RULE, headGarmentOverlaps, headGarme
|
|
|
31
30
|
import { proposeNeck } from './tools/neck-propose.ts';
|
|
32
31
|
import { parseAltArg } from './tools/alternate-cli.ts';
|
|
33
32
|
import { type AlternateCliInput, assembleStage, build, BUILD_OWNS, BUILD_OWNS_FILES, checkStage, checkWrote, emitFillMasksStage, ERROR_MAP_FILE, loopStage, readRuns, readSource, rigStage, suppliedCheckFlag } from './src/build.ts';
|
|
34
|
-
import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, LOOP_SEAM_BAR_UNMET, type LoopSeamRequest, PACK_PAGE_SIZE, PACK_SHAPES,
|
|
33
|
+
import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, LOOP_SEAM_BAR_UNMET, type LoopSeamRequest, PACK_PAGE_SIZE, PACK_SHAPES, type PackShape, PAGE_EDGES, type PageEdges, parsePageSize, PARTS_HOME_SENTENCE, RIGC_GEOMETRY_VERSION, rigcRanClause, NO_PARTS_SENTENCE, SEAM_MEAN_BAR, SOURCE_SENTENCE, SEAM_PX_BAR, SEAM_PX_LEVEL, SPINEBOY_YARDSTICK, TEXTURE_STRETCH_CEILING } from './src/check.ts';
|
|
35
34
|
import { checkClipStretch } from './src/clipstretch.ts';
|
|
36
35
|
import { ComfyClient, resolveHost, runBackground, runMatte, runPainting, runSeeThrough } from './src/comfy/index.ts';
|
|
37
36
|
import { coreCfg, DEFAULT_GROW_PX, runForeground } from './src/plate.ts';
|
|
@@ -62,7 +61,7 @@ import { replacementTreeDigest } from './src/replacementrecord.ts';
|
|
|
62
61
|
import { type ComposeInput, composeStage, IMAGE_SEP, PLATE, PROVENANCES, refusePreviewLoopSeam, SCENE_CAMERA_REPORT_SPEC, SCENE_REPORT_FILE, SCENE_REPORT_SPEC, SCENE_SPEC } from './src/scene.ts';
|
|
63
62
|
import { buildSheet, defaultCaption, type Tile, tilesFrom } from './src/sheet.ts';
|
|
64
63
|
import { loadComparison, requiredProblems, structureLines } from './src/structure.ts';
|
|
65
|
-
import { type ArgvTable, assembleOutputFiles, bindAssembleWrapperInputs, BUILD_RUN_FILE, CHECK_RUN_FILE, clearComposeRun, clearRunRecord, clearRunStamp, readPackageIdentity, realWhereItExists, recordArgv, rigOutputFiles, RUN_STAMP_FILE, RUN_STAMP_SPEC, type RunStampFileEntry, writeRunRecord, writeRunStamp } from './src/runstamp.ts';
|
|
64
|
+
import { type ArgvTable, assembleOutputFiles, bindAssembleWrapperInputs, BUILD_RUN_FILE, type BuildWrapperRole, CHECK_RUN_FILE, clearComposeRun, clearRunRecord, clearRunStamp, readPackageIdentity, realWhereItExists, recordArgv, rigOutputFiles, RUN_STAMP_FILE, RUN_STAMP_SPEC, type RunStampFileEntry, type RunStampInputEntry, writeRunRecord, writeRunStamp } from './src/runstamp.ts';
|
|
66
65
|
import { authorLayerLine } from './src/tags.ts';
|
|
67
66
|
|
|
68
67
|
const EXIT_OK = 0;
|
|
@@ -2665,10 +2664,15 @@ function cmdBuild(args: string[]): number {
|
|
|
2665
2664
|
const startedAt = fixedClock ?? new Date().toISOString();
|
|
2666
2665
|
const scratch = mkdtempSync(join(tmpdir(), 'rig-parts-build-'));
|
|
2667
2666
|
try {
|
|
2667
|
+
let wrapperPngs: RunStampInputEntry<BuildWrapperRole>[] | undefined;
|
|
2668
2668
|
const r = build(
|
|
2669
2669
|
{ config, source, full, head, out, ...(seam === undefined ? {} : { seam: seam as SeamRule }), ...(project === undefined ? {} : { project: project as ProjectRule }), loop, pageEdges: edges, packShape: shape, ...(size === undefined ? {} : { pageSize: size }), ...(requirements === undefined ? {} : { requirements }), idleKeys: keys, ...(leadText === undefined ? {} : { leadIn: Number(leadText) }), seamPairs: on.has('--seam-pairs'), keepStills: on.has('--keep-stills'), noExtremes: on.has('--no-extremes'), ...(alts.length === 0 ? {} : { alts }), ...(flags.has('--set') ? { set: flags.get('--set') as string } : {}), allSets: on.has('--all-sets'), ...(environment === undefined ? {} : { environment }), ...(windBand === undefined ? {} : { windBand }) },
|
|
2670
2670
|
{ rig: rigcRunner(bin), check: rigcRunner(bin), checkBin: bin, scratch: join(scratch, 'rig-gate'), stages: {
|
|
2671
|
-
assemble: (input, outputs) =>
|
|
2671
|
+
assemble: (input, outputs) => {
|
|
2672
|
+
const reading = runBuildProcess({ stage: 'assemble', bin, input, outputs }, join(scratch, 'workers'));
|
|
2673
|
+
wrapperPngs = reading?.wrapperPngs;
|
|
2674
|
+
return reading;
|
|
2675
|
+
},
|
|
2672
2676
|
rig: (input, _rigc, gateScratch) => runBuildProcess({ stage: 'rig', bin, input, scratch: gateScratch }, join(scratch, 'workers')),
|
|
2673
2677
|
check: (input, _rigc, checkBin) => runBuildProcess({ stage: 'check', bin: checkBin, input }, join(scratch, 'workers')),
|
|
2674
2678
|
} },
|
|
@@ -2679,6 +2683,7 @@ function cmdBuild(args: string[]): number {
|
|
|
2679
2683
|
const cwd = process.cwd();
|
|
2680
2684
|
writeRunRecord({ pkg, command: 'build', startedAt, finishedAt: fixedClock ?? new Date().toISOString(), outDir: out, configPath: config,
|
|
2681
2685
|
inputs: { cwd, source, full, head, requirements, environment, windBand, alts },
|
|
2686
|
+
...(wrapperPngs === undefined ? {} : { wrapperPngs }),
|
|
2682
2687
|
outputs: [...BUILD_OWNS, ...BUILD_OWNS_FILES], argv: recordArgv('build', args, BUILD_ARGV, out, cwd) });
|
|
2683
2688
|
}
|
|
2684
2689
|
return r.stoppedAt === null ? EXIT_OK : EXIT_REFUSED;
|
package/docs/AUTHORING.md
CHANGED
|
@@ -8538,9 +8538,10 @@ If a clip passes alone but the idle fails, change one input, such as the
|
|
|
8538
8538
|
wind key's peak, and rerun the same command on the edited build and scene.
|
|
8539
8539
|
Read both lines before running the regular character check and `compose`,
|
|
8540
8540
|
which still makes the shipping decision. The diagnostic prints only text.
|
|
8541
|
-
Exit 0 means every played take
|
|
8542
|
-
[slider rows](#slider-applied-clip-stretch-issue-1627)
|
|
8543
|
-
|
|
8541
|
+
Exit 0 means every played take (`CHECK_CLIP_STRETCH`, including `idle`) was
|
|
8542
|
+
measured and passed; [slider rows](#slider-applied-clip-stretch-issue-1627) are
|
|
8543
|
+
advisory and do not set a failing exit (issue #1648).
|
|
8544
|
+
Exit 1 means a `CHECK_CLIP_STRETCH` failure, refusal or missing required reading. Exit 2 means a usage error.
|
|
8544
8545
|
|
|
8545
8546
|
Literal `false` is accepted at any character scale. The side clip still passes
|
|
8546
8547
|
through the character's scale checks, which refuse nonzero `wind` or `gravity`
|
|
@@ -8675,12 +8676,13 @@ extreme dial angle can be told apart from broad interior stretch.
|
|
|
8675
8676
|
|
|
8676
8677
|
Stock `check` reports a measured dial `FAIL` at the existing `WARN` level and
|
|
8677
8678
|
counts slider outcomes separately from the ordinary bars. The dial report is
|
|
8678
|
-
advisory
|
|
8679
|
-
|
|
8680
|
-
|
|
8679
|
+
advisory in `check --clip-stretch <scene.json>` as well (issue #1648): the
|
|
8680
|
+
diagnostic prints each `CHECK_SLIDER_STRETCH` row with its `PASS`, `FAIL` or
|
|
8681
|
+
`SKIP` verdict on the composed rig, and none of those rows sets a failing exit.
|
|
8681
8682
|
A slider-only clip has a dial row only. A separate played role
|
|
8682
8683
|
explicit in the source or composition produces both a dial row and a played
|
|
8683
|
-
row
|
|
8684
|
+
`CHECK_CLIP_STRETCH` row, and the played row still gates the exit. The declared
|
|
8685
|
+
idle and existing `with_idle` readings still apply.
|
|
8684
8686
|
|
|
8685
8687
|
When `rig` writes a rig with a slider, its notice reads
|
|
8686
8688
|
|
package/docs/STABILITY.md
CHANGED
|
@@ -1463,9 +1463,12 @@ inherit a scene-keyed parent, and a constraint can read a scene-keyed input. See
|
|
|
1463
1463
|
### Check report (`rig-parts-check/1`)
|
|
1464
1464
|
|
|
1465
1465
|
`check --clip-stretch <scene.json>` has its own text and exit status. It exits
|
|
1466
|
-
0 when every played take
|
|
1467
|
-
|
|
1468
|
-
2 on usage errors.
|
|
1466
|
+
0 when every played take (`CHECK_CLIP_STRETCH`, including `idle`) has a
|
|
1467
|
+
measurable passing peak, 1 on a refusal, failing `CHECK_CLIP_STRETCH` bar or
|
|
1468
|
+
missing required played-take reading, and 2 on usage errors. `CHECK_SLIDER_STRETCH`
|
|
1469
|
+
rows are still printed with their `PASS`, `FAIL` or `SKIP` verdicts, and are
|
|
1470
|
+
advisory (they do not affect the exit status, issue #1648). It writes no
|
|
1471
|
+
`check.json`, `check-run.json`, or scene output.
|
|
1469
1472
|
The ordinary check report, verdict and compose admission retain their existing meanings.
|
|
1470
1473
|
The [slider stretch contract](#slider-stretch-diagnostic-issue-1627) defines
|
|
1471
1474
|
the dial rows and their effect on the verdict.
|
|
@@ -1606,11 +1609,12 @@ or compose admission. The report retains spec `rig-parts-check/1`.
|
|
|
1606
1609
|
`check --clip-stretch` opts into the same reset-pose measurement on the composed
|
|
1607
1610
|
rig, with each dial sampled independently and compared with canonical rest
|
|
1608
1611
|
using the stock stretch metric. It prints `CHECK_SLIDER_STRETCH` rows using
|
|
1609
|
-
composed names
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
`
|
|
1613
|
-
|
|
1612
|
+
composed names, keeping their `PASS`, `FAIL` and `SKIP` verdict words.
|
|
1613
|
+
Slider-only clips have dial rows. Clips with an explicitly declared played role
|
|
1614
|
+
also have `CHECK_CLIP_STRETCH` rows. The diagnostic still writes only text.
|
|
1615
|
+
`CHECK_SLIDER_STRETCH` rows are advisory here too and leave the exit status
|
|
1616
|
+
unchanged (issue #1648); existing played take and idle `CHECK_CLIP_STRETCH`
|
|
1617
|
+
verdicts decide exit 0 vs 1. See [the authoring guide](AUTHORING.md#slider-applied-clip-stretch-issue-1627).
|
|
1614
1618
|
|
|
1615
1619
|
### Run stamp (`run.json`, spec `rig-run/1`)
|
|
1616
1620
|
|
|
@@ -1779,17 +1783,19 @@ resolved parts directory refuses the receipt as `RUN_PARTS_INPUT_CHANGED`.
|
|
|
1779
1783
|
|
|
1780
1784
|
`build` writes `<out>/build-run.json` when its check report completes, including a
|
|
1781
1785
|
report with failing bars. Issue #1556 advances `spec` to `rig-run/3` and adds
|
|
1782
|
-
`inputs` between `config` and `outputs
|
|
1783
|
-
|
|
1784
|
-
|
|
1786
|
+
`inputs` between `config` and `outputs`; issue #1669 adds optional `wrapper_pngs`
|
|
1787
|
+
between `inputs` and `outputs`. The fixed key order is `spec`, `package`,
|
|
1788
|
+
`command`, `started_at`, `finished_at`, `config`, `inputs`, optional
|
|
1789
|
+
`wrapper_pngs`, `outputs`, `argv`. The other fields and the write timing follow
|
|
1790
|
+
the `rig-run/2` build contract above.
|
|
1785
1791
|
|
|
1786
1792
|
This example shows a build with full and head layer directories and one alternate tuple.
|
|
1787
|
-
The version and digests are illustrative, and the output
|
|
1793
|
+
The version and digests are illustrative, and the wrapper PNG and output lists are abbreviated.
|
|
1788
1794
|
|
|
1789
1795
|
```json
|
|
1790
1796
|
{
|
|
1791
1797
|
"spec": "rig-run/3",
|
|
1792
|
-
"package": { "name": "@rig-c/parts", "version": "2.
|
|
1798
|
+
"package": { "name": "@rig-c/parts", "version": "2.71.0" },
|
|
1793
1799
|
"command": "build",
|
|
1794
1800
|
"started_at": "2026-11-25T00:00:00.000Z",
|
|
1795
1801
|
"finished_at": "2026-11-25T00:00:01.000Z",
|
|
@@ -1829,6 +1835,28 @@ The version and digests are illustrative, and the output list is abbreviated.
|
|
|
1829
1835
|
"sha256": "66778899aabbccddeeff00112233445566778899aabbccddeeff001122334455"
|
|
1830
1836
|
}
|
|
1831
1837
|
],
|
|
1838
|
+
"wrapper_pngs": [
|
|
1839
|
+
{
|
|
1840
|
+
"role": "full",
|
|
1841
|
+
"path": "parts/topwear.png",
|
|
1842
|
+
"sha256": "8899aabbccddeeff00112233445566778899aabbccddeeff0011223344556677"
|
|
1843
|
+
},
|
|
1844
|
+
{
|
|
1845
|
+
"role": "head",
|
|
1846
|
+
"path": "parts/face.png",
|
|
1847
|
+
"sha256": "99aabbccddeeff00112233445566778899aabbccddeeff001122334455667788"
|
|
1848
|
+
},
|
|
1849
|
+
{
|
|
1850
|
+
"role": "alt[0].full",
|
|
1851
|
+
"path": "parts/topwear.png",
|
|
1852
|
+
"sha256": "aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899"
|
|
1853
|
+
},
|
|
1854
|
+
{
|
|
1855
|
+
"role": "alt[0].head",
|
|
1856
|
+
"path": "parts/face.png",
|
|
1857
|
+
"sha256": "bbccddeeff00112233445566778899aabbccddeeff00112233445566778899aa"
|
|
1858
|
+
}
|
|
1859
|
+
],
|
|
1832
1860
|
"outputs": [
|
|
1833
1861
|
{
|
|
1834
1862
|
"path": "check/check.json",
|
|
@@ -1861,9 +1889,29 @@ order regardless of where each flag appears in `argv`.
|
|
|
1861
1889
|
`i` is zero-based and counts the `--alt` occurrences. Entries for optional flags
|
|
1862
1890
|
or tuple members appear only when supplied. The array inventories CLI file
|
|
1863
1891
|
inputs. References declared only inside the config and files referenced by a
|
|
1864
|
-
layer manifest are outside
|
|
1892
|
+
layer manifest are outside `inputs`. `config` binds `--config` separately,
|
|
1865
1893
|
and `--out` is the output root.
|
|
1866
1894
|
|
|
1895
|
+
`wrapper_pngs` is additive to `rig-run/3` (issue #1669) and appears whenever the
|
|
1896
|
+
build decodes at least one wrapper manifest across the primary tuple or any `--alt`
|
|
1897
|
+
tuple. Each row is `{ "role", "path", "sha256" }` in that key order, matching
|
|
1898
|
+
`assemble`'s `wrapper_pngs` (#1645). `role` is `full`, `head`, `alt[i].full` or
|
|
1899
|
+
`alt[i].head`, equal to the `role` of the `inputs` row whose manifest the PNG
|
|
1900
|
+
belongs to. `path` is canonical and `/`-separated, relative to that manifest's
|
|
1901
|
+
directory, naming the file actually decoded (including the `parts/<name>.png`
|
|
1902
|
+
fallback when used). `sha256` is the lowercase hex SHA-256 digest of the exact
|
|
1903
|
+
bytes passed to the decoder. Coverage spans every decoded drawn and hidden layer
|
|
1904
|
+
PNG and every decoded `depth_filename` PNG when depth is active, across the
|
|
1905
|
+
primary tuple and every `--alt` tuple; a role whose input is a PSD contributes no
|
|
1906
|
+
rows. Rows sort by role in `inputs` order (`full`, `head`, `alt[0].full`,
|
|
1907
|
+
`alt[0].head`, …) and then by `path` in UTF-16 code-unit order, collapsing
|
|
1908
|
+
repeated reads with the same role, path and digest to one row. Distinct digests
|
|
1909
|
+
for the same role and path refuse the build as `ASSEMBLE_WRAPPER_PNG_CONFLICT`,
|
|
1910
|
+
and a selected path outside the canonical relative form refuses as
|
|
1911
|
+
`ASSEMBLE_WRAPPER_PNG_PATH`, writing no record in either case. An all-PSD build
|
|
1912
|
+
omits `wrapper_pngs`, and an older `rig-run/3` record without `wrapper_pngs`
|
|
1913
|
+
leaves its wrapper PNGs unbound.
|
|
1914
|
+
|
|
1867
1915
|
The run-record writer reads and hashes the raw bytes on disk of the file named by
|
|
1868
1916
|
`path` after the check report completes. Keep input files and link targets unchanged
|
|
1869
1917
|
from the start of the build until it exits so these digests describe the bytes the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rig-parts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.72.0",
|
|
4
4
|
"description": "AI-authored 2D character parts from one anime painting and its See-through layer decomposition: measured parts, weighted-mesh rig specs, verified through rig-c before anything is written. A CLI for agents that cannot see the image.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -71,8 +71,9 @@
|
|
|
71
71
|
"selftest:pre": "bun selftest.ts --pre",
|
|
72
72
|
"smoke": "bun scripts/install_smoke.ts",
|
|
73
73
|
"verify:nova": "bun scripts/verify_nova.ts",
|
|
74
|
-
"
|
|
75
|
-
"
|
|
74
|
+
"hooks": "([ -e .git ] && [ -f .githooks/pre-commit ] && [ \"$(git config --get core.hooksPath 2>/dev/null)\" != .githooks ] && git rev-parse --git-dir >/dev/null 2>&1 && git config core.hooksPath .githooks >/dev/null 2>&1 || true)",
|
|
75
|
+
"typecheck": "bun run hooks && bunx tsc --noEmit",
|
|
76
|
+
"lint": "bun run hooks && bunx eslint .",
|
|
76
77
|
"prepublishOnly": "node scripts/prepublish.cjs"
|
|
77
78
|
},
|
|
78
79
|
"dependencies": {
|
|
@@ -82,8 +83,8 @@
|
|
|
82
83
|
"devDependencies": {
|
|
83
84
|
"@esotericsoftware/spine-core": "4.3.13",
|
|
84
85
|
"@types/bun": "^1.4.2",
|
|
85
|
-
"eslint": "
|
|
86
|
+
"eslint": "10.11.0",
|
|
86
87
|
"typescript": "^5.9.3",
|
|
87
|
-
"typescript-eslint": "
|
|
88
|
+
"typescript-eslint": "8.70.1"
|
|
88
89
|
}
|
|
89
90
|
}
|
package/src/assemble.ts
CHANGED
|
@@ -5906,7 +5906,7 @@ function assembleParts(input: AssembleInput, targets?: ReadonlySet<string>, befo
|
|
|
5906
5906
|
const cutMaterial: MaterialRow[] = [];
|
|
5907
5907
|
const materialSources: MaterialSource[] = [];
|
|
5908
5908
|
plan.forEach(([name], pi) => {
|
|
5909
|
-
const mine = cuts.map((
|
|
5909
|
+
const mine = cuts.map((_q, i) => i).filter((i) => cuts[i].from === name);
|
|
5910
5910
|
const b = built[pi];
|
|
5911
5911
|
if (mine.length === 0 || b === null) return;
|
|
5912
5912
|
const before = opaqueOf(b.r);
|
|
@@ -7097,7 +7097,7 @@ export function bodiesWithPixels(mask: Mask, minPx: number): { bodies: Uncovered
|
|
|
7097
7097
|
for (let p = 0; p < opened.data.length; p++) if (mask.data[p] === 0) opened.data[p] = 0;
|
|
7098
7098
|
const cc = connectedComponents(opened, 8);
|
|
7099
7099
|
const keep = cc.stats.map((s, l) => l > 0 && s.area > 0 && s.area >= minPx);
|
|
7100
|
-
const all = cc.stats.filter((
|
|
7100
|
+
const all = cc.stats.filter((_s, l) => keep[l]);
|
|
7101
7101
|
all.sort((a, b) => b.area - a.area || a.top - b.top || a.left - b.left);
|
|
7102
7102
|
const pixels = newMask(mask.width, mask.height);
|
|
7103
7103
|
for (let p = 0; p < pixels.data.length; p++) if (keep[cc.labels[p]]) pixels.data[p] = 1;
|
package/src/build.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { changedAssemblyFields, effectiveAssemblyRules, projectAssemblyConfig, readProjectedAssemblyConfig, type AssemblyLimb, refuseStaleAssembly, type AssemblyRules } from './assembly-reading.ts';
|
|
2
2
|
import { editedPartFrontColourLines, readEditedParts } from './editedparts.ts';
|
|
3
3
|
import { SOURCE_COVER_FILE, sourceCoverReport, type SourceCoverSet } from './sourcecover.ts';
|
|
4
|
-
import { STAGE_MAP_FILE } from './provenance.ts';
|
|
4
|
+
import { ownershipLines, provenanceLines, STAGE_MAP_FILE } from './provenance.ts';
|
|
5
5
|
import { withoutCheckRows } from './checkrow.ts';
|
|
6
6
|
import { readSetupFigureMask } from './setupfiguremask.ts';
|
|
7
7
|
import { EDGE_RESIDUAL_FILE, edgeResidualLines } from './edgeresidual.ts';
|
|
8
8
|
import { SUPPORT_DOMAINS_FILE, writeSupportDomains } from './supportdomains.ts';
|
|
9
9
|
import { COINCIDE_LINE, SETUP_SEAM_TRANSMISSION_LINE, setupSeamTransmissionLine, supportLines } from './coincide.ts';
|
|
10
|
-
import { DEFAULT_PROJECT_RULE } from './projectrule.ts';
|
|
11
10
|
import { type PaintingAllocationReading, type PaintingAllocationEvent, EDGE_CONTRAST, PAINTING_ALLOCATION_FILE, PAINTING_EDGE_COVERAGE_TRANSFER } from './paintingedges.ts';
|
|
12
11
|
import { SETUP_PAINTING_LINE, setupPaintingLines } from './setuppainting.ts';
|
|
13
12
|
import { boundaryColourLines } from './boundarycolour.ts';
|
|
@@ -20,7 +19,6 @@ import { applyTakenLayers } from './takelayers.ts';
|
|
|
20
19
|
import { applyTakenRegions } from './takeregion.ts';
|
|
21
20
|
import { bindOccluderPlates, occluderStageWarnings, readOccluderInputs } from './occluderstage.ts';
|
|
22
21
|
import { PLATE_RECEIPT_FILE, type PlateReceipt, verifyPlateReceipt } from './plate.ts';
|
|
23
|
-
import { ownershipLines, provenanceLines } from './provenance.ts';
|
|
24
22
|
import { readSourceDepth } from './depthsheets.ts';
|
|
25
23
|
import { orderedBaseAnchor } from './baseanchor.ts';
|
|
26
24
|
import { alternateLayerSources, alternateLayerIslands, alternateLayerOthers } from './alternatelayers.ts';
|
|
@@ -72,7 +70,7 @@ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, wri
|
|
|
72
70
|
import { basename, dirname, join, relative, resolve, sep } from 'node:path';
|
|
73
71
|
import { makeOutDir } from './outputpaths.ts';
|
|
74
72
|
import { type AnimFrame, EncodeError, encodeApng, encodeIndexedApng, INDEXED_DEFAULTS } from './apng.ts';
|
|
75
|
-
import { assemble, type AssembleResult, boxOf, cutLines, edgeSplitLines, ERROR_LIMIT, type ExcludedCount, excludedLines, setExclusions, islandLines, setIslandSources, type IslandCount, hiddenLines, SINGLE_RUN_FACE_TAGS, singleRunHeadBox, softOcclusionLine, driftLine, limbLines, FIGURE_MASK_FILE, figureMaskLines, figuresLine, groundWarning, holeKindsLine, holeLines, measurePinholes, measureRecomposite, pinholeProblems, pinholesLine, type ProjectRule, recomposite, recompositeRecord, scenePhrase, type SeamRule, sourceInRig, projectedStageFields, stageFields, uncoveredLine, underBox } from './assemble.ts';
|
|
73
|
+
import { assemble, type AssembleResult, boxOf, capOwnershipLines, cutLines, edgeSplitLines, ERROR_LIMIT, type ExcludedCount, excludedLines, setExclusions, islandLines, setIslandSources, type IslandCount, hiddenLines, type OtherLimbs, SINGLE_RUN_FACE_TAGS, singleRunHeadBox, softOcclusionLine, splitLines, type SplitCount, driftLine, limbLines, FIGURE_MASK_FILE, figureMaskLines, figuresLine, groundWarning, holeKindsLine, holeLines, measurePinholes, measureRecomposite, pinholeProblems, pinholesLine, type ProjectRule, recomposite, recompositeRecord, scenePhrase, type SeamRule, sourceInRig, projectedStageFields, stageFields, uncoveredLine, underBox } from './assemble.ts';
|
|
76
74
|
import { allocationClause, type Reducer, stageBClause, unboundedClause } from './automesh.ts';
|
|
77
75
|
import { residualClause } from './autoenvelope.ts';
|
|
78
76
|
import { type AutoMotionCase, failingRows, idleSchedule, localRow, motionClause, motionDeformation, motionDocument, motionInput, motionRowText, motionStimulus, motionVerdict, noStimulusProblem, prepareComparison, type ReplayCandidate, runComparison, runPreparedComparison, sourceSelfFailure, stimulusMotion, withStimulus } from './automotion.ts';
|
|
@@ -100,9 +98,8 @@ import {
|
|
|
100
98
|
untestedIntervals,
|
|
101
99
|
} from './autoreplay.ts';
|
|
102
100
|
import { physicsLines } from './physicscontrib.ts';
|
|
103
|
-
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';
|
|
104
|
-
import {
|
|
105
|
-
import { type CharacterConfig, type Cut, type Extend, loadConfigAndAnimations, loadConfigWithBytes, loadEarlyConfig, type Patch, type PlanEntry } from './config.ts';
|
|
101
|
+
import { besideIdleLine, checkSummaryLine, inputFileRecord, type InputFileRecord, CLOTH_LINE, type ClothLine, clothWarnText, figureOpeningLines, frameRuns, type LoopSeamRequest, MOTION_SEAM_LINE, type MotionSeamLine, type MotionSeamPlant, motionSeamRequiredLine, motionSeamWarnText, motionJointContactLines, FOLD_LINE, type FoldsLine, LEVEL_LINE, type LevelLine, LIMB_LINE, type LimbLine, sliderStretchLine, 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';
|
|
102
|
+
import { type BoneEntry, type CharacterConfig, type Cut, type Extend, loadConfigAndAnimations, loadConfigWithBytes, loadEarlyConfig, type Patch, type PlanEntry } from './config.ts';
|
|
106
103
|
import { coreCompileGuideLine, failLine, foldName, PartsError, type Problem, refuseIfAny } from './errors.ts';
|
|
107
104
|
import { editedConfigImages, editedRunImages, missingReceipts, readEditorReceipts } from './editreceipt.ts';
|
|
108
105
|
import { untracedPartSources } from './partsource.ts';
|
|
@@ -112,16 +109,12 @@ import { CONTROL_SUFFIX, withAnimations } from './motion.ts';
|
|
|
112
109
|
import type { PaletteError } from './palette.ts';
|
|
113
110
|
import { PartVisibility } from './partvisibility.ts';
|
|
114
111
|
import { readRunVisibility } from './visibility.ts';
|
|
115
|
-
import { type LayerSet, readLayers, type WrapperReadings } from './layers.ts';
|
|
112
|
+
import { type LayerSet, OPAQUE_ALPHA_ABOVE, readLayers, type WrapperReadings } from './layers.ts';
|
|
116
113
|
import { placeBoneEntriesForSkeleton, poseBoneEntriesForDrawn, REGISTER_OFFSET_BAR, REGISTER_SCALE_BAR, registeredWithinBar, registerSkeleton, SKELETON_LIMB_BONES, skeletonDrawnLength, skeletonLimbJoints } from './limbs.ts';
|
|
117
114
|
import { type AlternatePartsRecord, PAINTING_IN_RIG_FILE, FRONT_SUFFIX, type OccluderPlateRecord, type PartRecord, partImageReference, depthImageReference, readParts, readPartsManifest, type RecompositeRecord, type SingleRunPad, tagOf, writeParts } from './parts.ts';
|
|
118
115
|
import { encodePngBytes, readPng, writePng } from './raster/png.ts';
|
|
119
116
|
import { verifyReplacementRecord } from './replaceparts.ts';
|
|
120
|
-
import type
|
|
121
|
-
import { type Mask, newMask } from './raster/types.ts';
|
|
122
|
-
import { type OtherLimbs, splitLines, capOwnershipLines, type SplitCount } from './assemble.ts';
|
|
123
|
-
import type { BoneEntry } from './config.ts';
|
|
124
|
-
import { OPAQUE_ALPHA_ABOVE } from './layers.ts';
|
|
117
|
+
import { type Mask, newMask, type Raster } from './raster/types.ts';
|
|
125
118
|
import { pinholesRequired, readRequirements, type RequirementLine, summaryText } from './requirements.ts';
|
|
126
119
|
import { type AutoMeshReport, buildRig, DEFAULT_IDLE_KEYS, type FaceAxis, type IdleKeys, type MeshReport, rebindRigMotion, type RigCommand, rigJsonText, type RigOutput, type RigSpec, SETS_FILE, type StrayCleared, type TurnRow } from './rig.ts';
|
|
127
120
|
import { KEYPOINT_NAMES, type KeypointName, type PosePoints } from './skeleton.ts';
|
|
@@ -149,14 +142,20 @@ export function readSource(path: string): Raster {
|
|
|
149
142
|
}
|
|
150
143
|
}
|
|
151
144
|
|
|
152
|
-
export type
|
|
145
|
+
export type BuildWrapperRole = 'full' | 'head' | `alt[${number}].full` | `alt[${number}].head`;
|
|
146
|
+
|
|
147
|
+
export interface AssembleWrapperReadings {
|
|
148
|
+
full: WrapperReadings;
|
|
149
|
+
head: WrapperReadings;
|
|
150
|
+
alts?: Array<{ full: WrapperReadings; head: WrapperReadings }>;
|
|
151
|
+
}
|
|
153
152
|
|
|
154
153
|
/**
|
|
155
154
|
* Read both runs, collecting the refusals of both before throwing. With no
|
|
156
155
|
* head run (`head` null, issue #359) the full run is read once and stands for
|
|
157
156
|
* both, and `single` says so: the stage then holds it to `checkSingleRun`.
|
|
158
157
|
*/
|
|
159
|
-
export function readRuns(full: string, head: string | null, recordVisibility = false, wrapperReadings?:
|
|
158
|
+
export function readRuns(full: string, head: string | null, recordVisibility = false, wrapperReadings?: Record<'full' | 'head', WrapperReadings>): {
|
|
160
159
|
full: LayerSet; head: LayerSet; single: boolean; visibility?: PartVisibility;
|
|
161
160
|
} {
|
|
162
161
|
const problems: Problem[] = [];
|
|
@@ -545,7 +544,7 @@ export function frontOrdered<T extends { record: { name: string } }>(items: read
|
|
|
545
544
|
|
|
546
545
|
/** Bind the pure owner reading to the exact stage inputs. */
|
|
547
546
|
function sourceCoverSet(result: AssembleResult, set: string | null, painting: string,
|
|
548
|
-
runs: ReturnType<typeof readRuns>, wrapperReadings?:
|
|
547
|
+
runs: ReturnType<typeof readRuns>, wrapperReadings?: Record<'full' | 'head', WrapperReadings>): SourceCoverSet {
|
|
549
548
|
const inputs: SourceCoverSet['inputs'] = [];
|
|
550
549
|
for (const run of (runs.single ? ['full'] : ['full', 'head']) as Array<'full' | 'head'>) {
|
|
551
550
|
const layers = runs[run];
|
|
@@ -579,7 +578,14 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
579
578
|
const { seam, project } = effectiveAssemblyRules(cfg.assemble, input);
|
|
580
579
|
const { requirements, effectiveSetup } = resolveAssemblyRequirements(input, cfg, project, requirementsFile);
|
|
581
580
|
const src = readSource(input.source);
|
|
582
|
-
const
|
|
581
|
+
const cliAlts = input.alts ?? [];
|
|
582
|
+
const wrapperReadings: AssembleWrapperReadings | undefined = onWrapperReadings === undefined
|
|
583
|
+
? undefined
|
|
584
|
+
: {
|
|
585
|
+
full: { pngs: [] },
|
|
586
|
+
head: { pngs: [] },
|
|
587
|
+
...(cliAlts.length === 0 ? {} : { alts: cliAlts.map(() => ({ full: { pngs: [] }, head: { pngs: [] } })) }),
|
|
588
|
+
};
|
|
583
589
|
const read = readRuns(input.full, input.head, true, wrapperReadings);
|
|
584
590
|
// Issue #946: every declared receipt is held to its file, and under `required` every edited image needs one, before anything is assembled.
|
|
585
591
|
const receipts = readEditorReceipts(cfg.assemble.editor_receipts, input.config);
|
|
@@ -617,12 +623,16 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
617
623
|
|
|
618
624
|
// Issue #454: alternate painting sets, assembled before any file is written.
|
|
619
625
|
const configDir = dirname(resolve(input.config));
|
|
620
|
-
const cliAlts = input.alts ?? [];
|
|
621
626
|
const cfgAlts = cfg.assemble.alternates ?? [];
|
|
622
627
|
const cliByName = new Map<string, AlternateCliInput>();
|
|
623
|
-
|
|
628
|
+
const cliIndexByName = new Map<string, number>();
|
|
629
|
+
cliAlts.forEach((a, idx) => {
|
|
630
|
+
cliByName.set(a.name, a);
|
|
631
|
+
cliIndexByName.set(a.name, idx);
|
|
632
|
+
});
|
|
624
633
|
const mergedAlts: Array<{
|
|
625
634
|
name: string;
|
|
635
|
+
cliIndex?: number;
|
|
626
636
|
base_anchor?: NonNullable<typeof cfg.assemble.alternates>[number]['base_anchor'];
|
|
627
637
|
at: string;
|
|
628
638
|
source?: string;
|
|
@@ -644,6 +654,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
644
654
|
if (cli !== undefined) cliByName.delete(a.name);
|
|
645
655
|
return {
|
|
646
656
|
name: a.name,
|
|
657
|
+
...(cli === undefined ? {} : { cliIndex: cliIndexByName.get(cli.name) }),
|
|
647
658
|
base_anchor: a.base_anchor,
|
|
648
659
|
at: `config.assemble.alternates[${i}] (set "${a.name}")`,
|
|
649
660
|
source: cli?.source ?? (a.source === undefined ? undefined : resolve(configDir, a.source)),
|
|
@@ -665,6 +676,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
665
676
|
for (const cli of cliByName.values()) {
|
|
666
677
|
mergedAlts.push({
|
|
667
678
|
name: cli.name,
|
|
679
|
+
cliIndex: cliIndexByName.get(cli.name),
|
|
668
680
|
at: `--alt ${cli.name}`,
|
|
669
681
|
source: cli.source,
|
|
670
682
|
full: cli.full,
|
|
@@ -770,7 +782,8 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
|
|
|
770
782
|
const invalidFocus = setFocusProblems(alt.focus, `${alt.at}.focus`, [altSrc.width, altSrc.height]);
|
|
771
783
|
if (invalidFocus.length > 0) { altProblems.push(...invalidFocus); continue; }
|
|
772
784
|
}
|
|
773
|
-
const
|
|
785
|
+
const altWrapperReadings = alt.cliIndex === undefined ? undefined : wrapperReadings?.alts?.[alt.cliIndex];
|
|
786
|
+
const altRuns = readRuns(alt.full, alt.head ?? null, true, altWrapperReadings);
|
|
774
787
|
altProblems.push(...missingReceipts(receipts, [...editedRunImages(altRuns, `alternate set "${alt.name}" `), ...editedConfigImages(input.config, alt.cuts ?? [], undefined, `${alt.at}.cuts`)]));
|
|
775
788
|
const hidesSet = new Set(alt.hides ?? []);
|
|
776
789
|
const declaredSlots = alt.parts !== undefined ? alt.parts.filter((p) => !hidesSet.has(p)) : baseSlots.filter((p) => !hidesSet.has(p));
|
package/src/clipstretch.ts
CHANGED
|
@@ -90,7 +90,6 @@ export function checkClipStretch(scene: string, scratch: string, rigc: RigcRunne
|
|
|
90
90
|
}
|
|
91
91
|
for (const row of readSliderStretch(build, bindings, provide)?.rows ?? []) {
|
|
92
92
|
log(sliderStretchLine(row));
|
|
93
|
-
if (row.status === 'FAIL') passed = false;
|
|
94
93
|
}
|
|
95
94
|
} catch (err) {
|
|
96
95
|
if (!(err instanceof api.CandidateAtlasError || err instanceof api.CandidatePairError || err instanceof api.CoreInputError ||
|
package/src/configwrite.ts
CHANGED
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { PlanProposal } from './assemble.ts';
|
|
12
12
|
import type { HeadBoxProposal } from './headbox.ts';
|
|
13
|
-
import type { CharacterConfig } from './config.ts';
|
|
14
13
|
import { orderedEditedPartReceipt, type EditedPartReceipt } from './editedparts.ts';
|
|
15
14
|
import type { Proposal, PROPOSAL_CONFIG_SECTIONS } from './propose.ts';
|
|
16
15
|
import { PartsError } from './errors.ts';
|
|
17
|
-
import { parseConfig, parseEarlyConfig, parseProposalSections } from './config.ts';
|
|
16
|
+
import { type CharacterConfig, parseConfig, parseEarlyConfig, parseProposalSections } from './config.ts';
|
|
18
17
|
import type { ConfigEdit } from './meshdraft.ts';
|
|
19
18
|
|
|
20
19
|
/** Required point fields and optional shape fields of `meshes.<part>.contour.bust`, in the shorthand order `src/config.ts` validates (issues #475, #1428). */
|
package/src/diagnostics.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { explicitWeightRows, regionBone, type RegionSpec } from './config.ts';
|
|
1
|
+
import { type BoneEntry, explicitWeightRows, type Limb, regionBone, type RegionSpec } from './config.ts';
|
|
2
2
|
/**
|
|
3
3
|
* What `propose` looked at, said (issue #86): the coverage lines lint's
|
|
4
4
|
* per-bone record prints, and the basis file written beside the proposal.
|
|
@@ -33,7 +33,6 @@ import { explicitWeightRows, regionBone, type RegionSpec } from './config.ts';
|
|
|
33
33
|
* write the same bytes.
|
|
34
34
|
*/
|
|
35
35
|
import { type Problem, refuseIfAny } from './errors.ts';
|
|
36
|
-
import type { BoneEntry, Limb } from './config.ts';
|
|
37
36
|
import type { RigJoints } from './keypoints.ts';
|
|
38
37
|
import { BASIS_KINDS, type BasisKind, type BoneBasis, type BoneCoverage, COVERAGE_OUTCOMES, coverageOutcome, expand, FRAME_KEYS, type FrameBasis, type FrameKey, type PartSet, type Placement, type Proposal, type ProposalBasis } from './propose.ts';
|
|
39
38
|
import { BONE_ROLES, type BoneRole, compareStructure, readSkeleton } from './structure.ts';
|
package/src/edgesplit.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** Painting-edge part split on pre-projection plan rasters (#1231). */
|
|
2
|
-
import type
|
|
3
|
-
import { refuseIfAny } from './errors.ts';
|
|
2
|
+
import { type Problem, refuseIfAny } from './errors.ts';
|
|
4
3
|
import type { Raster } from './raster/types.ts';
|
|
5
4
|
import { pyRound } from './round.ts';
|
|
6
5
|
|
package/src/meshdraft.ts
CHANGED
|
@@ -59,11 +59,10 @@
|
|
|
59
59
|
* Pure in the sense `src/` is held to: no clock, no randomness, no network, no child process. rigc runs as a process,
|
|
60
60
|
* but the process is injected, exactly as `src/check.ts` and `src/build.ts` take it.
|
|
61
61
|
*/
|
|
62
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync,
|
|
62
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
63
63
|
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
64
|
-
import type
|
|
64
|
+
import { type AlphaMask, type MeasureRow, type MeshQualityReport, MeshReductionError, type MotionSchedule } from '@rig-c/core/mesh';
|
|
65
65
|
import { compareMeshesInMotion, type MotionComparisonInput } from '@rig-c/core/meshcompare';
|
|
66
|
-
import { MeshReductionError } from '@rig-c/core/mesh';
|
|
67
66
|
import { explicitFrameId, idleSchedule } from './automotion.ts';
|
|
68
67
|
import { checkStage, gateThroughRigc, type Log, RIGC_MODEL_DOCUMENT, rigStage } from './build.ts';
|
|
69
68
|
import { BARS, type CheckReport, type PackShape, type PageEdges, parsePageSize, type RigcRunner } from './check.ts';
|
|
@@ -72,7 +71,7 @@ import { relocateConfigReferences } from './configrelocation.ts';
|
|
|
72
71
|
import { PartsError, type Problem, problemLine } from './errors.ts';
|
|
73
72
|
import { IDLE_FPS } from './motion.ts';
|
|
74
73
|
import { type ContourBridges, FAINT_ALPHA } from './contour.ts';
|
|
75
|
-
import { ART_ALPHA, DUST_MAX_PX, DUST_MAX_SHARE, isDust, dustOf
|
|
74
|
+
import { ART_ALPHA, DUST_MAX_PX, DUST_MAX_SHARE, isDust, dustOf } from './mesh.ts';
|
|
76
75
|
import { partImageReference, type PartsFile, readParts } from './parts.ts';
|
|
77
76
|
import { readPng } from './raster/png.ts';
|
|
78
77
|
import type { Raster } from './raster/types.ts';
|
package/src/paintingextension.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** Explicit painting ownership, after assembly and before output cropping (#848). */
|
|
2
|
-
import type
|
|
3
|
-
import { refuseIfAny } from './errors.ts';
|
|
2
|
+
import { type Problem, refuseIfAny } from './errors.ts';
|
|
4
3
|
import { CORE_ALPHA, OPAQUE_ALPHA_ABOVE } from './layers.ts';
|
|
5
4
|
import { newMask, type Mask, type Raster } from './raster/types.ts';
|
|
6
5
|
|
package/src/propose.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ART_ALPHA, dustOf, isDust } from './mesh.ts';
|
|
2
|
-
import { explicitWeightRows, regionBone, type RegionSpec } from './config.ts';
|
|
2
|
+
import { type BoneEntry, type CharacterConfig, type ConfigConstraint, type ConfigStop, type ContourBustSpec, type ContourSpec, contourRegionsOf, deriveBustRegions, explicitWeightRows, type Limb, type MeshSpec, type PartBinding, parseConfig, type Point, regionBone, type RegionSpec, type Segment, type SkeletonSections, turnRidersByBone } from './config.ts';
|
|
3
3
|
/**
|
|
4
4
|
* The propose stage: bone origins, mesh candidate lists, regions and a default
|
|
5
5
|
* idle, read off the assembled parts — and the overlay a person or an agent
|
|
@@ -133,7 +133,6 @@ import { explicitWeightRows, regionBone, type RegionSpec } from './config.ts';
|
|
|
133
133
|
import { existsSync } from 'node:fs';
|
|
134
134
|
import { join } from 'node:path';
|
|
135
135
|
import { drawText, GLYPH_H } from '@rig-c/core/font5x7';
|
|
136
|
-
import { type BoneEntry, type CharacterConfig, type ConfigConstraint, type ConfigStop, type ContourBustSpec, type ContourSpec, contourRegionsOf, deriveBustRegions, type Limb, type MeshSpec, type PartBinding, parseConfig, type Point, type Segment, type SkeletonSections, turnRidersByBone } from './config.ts';
|
|
137
136
|
export { contourRegionsOf, deriveBustRegions };
|
|
138
137
|
import { computeExactFrameTransforms, cropToSpineY, normaliseDegrees, toWorld } from './coords.ts';
|
|
139
138
|
import { PartsError, type Problem, refuseIfAny } from './errors.ts';
|
package/src/requirements.ts
CHANGED
|
@@ -57,8 +57,7 @@ import { resolve } from 'node:path';
|
|
|
57
57
|
import { CompileError } from '@rig-c/core/errors';
|
|
58
58
|
import { splitRigSkin, type RigSkin } from '@rig-c/core/rig';
|
|
59
59
|
import { cropToSpineY } from './coords.ts';
|
|
60
|
-
import type
|
|
61
|
-
import { refuseIfAny } from './errors.ts';
|
|
60
|
+
import { type Problem, refuseIfAny } from './errors.ts';
|
|
62
61
|
import { type BoneWorld, type GeometryPose, type MeshRest, stretchFigures, stretchSeverity } from './instruments.ts';
|
|
63
62
|
import { ART_ALPHA } from './mesh.ts';
|
|
64
63
|
import { alphaAbove, type Raster } from './raster/types.ts';
|
package/src/rig.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { baseAnchorProblems, orderedBaseAnchor, baseAnchorMoves, type AnchorRegion } from './baseanchor.ts';
|
|
2
2
|
import { padDepthSheet, padTurnDepthSheet, depthSheetProblems, type PartDepthReference } from './depthsheets.ts';
|
|
3
|
-
import { explicitBoneNames, explicitSlotBones, explicitWeightRows, regionBone } from './config.ts';
|
|
3
|
+
import { type AutoSpec, type BoneEntry, type CharacterConfig, type ConfigConstraint, type ConfigStop, CONSTRAINT_FOLLOWS, constraintForRig, contourRegionsOf, type ContourSpec, DEFAULT_BUST_BONE_L, DEFAULT_BUST_BONE_R, explicitBoneNames, explicitSlotBones, explicitWeightRows, type InfluenceMeshSpec, type MeshSpec, type Point, regionBone, type RibsSpec, ROOT_BONE, stopForRig, turnRidersByBone, type WeightRule, weightsABone } from './config.ts';
|
|
4
4
|
import { explicitAttachment, type ExplicitMeshReport } from './explicitmesh.ts';
|
|
5
5
|
/**
|
|
6
6
|
* The rig stage: a character config and its assembled parts in, a rig spec
|
|
@@ -137,7 +137,6 @@ import { explicitAttachment, type ExplicitMeshReport } from './explicitmesh.ts';
|
|
|
137
137
|
* touches the disk, and the same inputs give the same bytes (key order is the
|
|
138
138
|
* order the objects are built in, and every number is rounded by `pyRound`).
|
|
139
139
|
*/
|
|
140
|
-
import { type AutoSpec, type BoneEntry, type InfluenceMeshSpec, type WeightRule, type CharacterConfig, type MeshSpec, type ConfigConstraint, type ConfigStop, CONSTRAINT_FOLLOWS, constraintForRig, contourRegionsOf, type ContourSpec, DEFAULT_BUST_BONE_L, DEFAULT_BUST_BONE_R, type Point, type RibsSpec, ROOT_BONE, stopForRig, turnRidersByBone, weightsABone } from './config.ts';
|
|
141
140
|
import { RUNTIME_PI } from '@rig-c/core/core';
|
|
142
141
|
import { type BoneTransform, computeExactFrameTransforms, computeWorldTransforms, cropToSpineY, normaliseDegrees, paintingToSetupPoint, setupToPaintingPoint, toBoneLocal, toWorld } from './coords.ts';
|
|
143
142
|
import { foldName, type Problem, refuseIfAny, PartsError } from './errors.ts';
|
|
@@ -145,8 +144,7 @@ import { recordedFocusProblems } from './setfocus.ts';
|
|
|
145
144
|
import { eyeLineDegrees } from './headframe.ts';
|
|
146
145
|
import type { RigBoneInherit, RigInvariants, RigStop } from '@rig-c/core/rig';
|
|
147
146
|
import { f32 } from '@rig-c/core/compile';
|
|
148
|
-
import type
|
|
149
|
-
import { bindWeightedVertices, buildGridMesh, buildSegmentsLattice, type EntrySegment, influenceShares, segmentDistance as rigcSegmentDistance, type SegmentsLattice, type SegmentsLatticeReport } from '@rig-c/core/mesh';
|
|
147
|
+
import { bindWeightedVertices, buildGridMesh, buildSegmentsLattice, type EntrySegment, influenceShares, type MeshCounts, type MeshQualityReport, type MeshReductionInput, type MotionAmplitude, type ReducedMesh, segmentDistance as rigcSegmentDistance, type SegmentsLattice, type SegmentsLatticeReport, type Termination } from '@rig-c/core/mesh';
|
|
150
148
|
import { type AmplitudeRow, amplitudeRow, partAmplitude, withAmplitude } from './autoamplitude.ts';
|
|
151
149
|
import { type ResidualRow, residualRow, slotEnvelope, withSkinning } from './autoenvelope.ts';
|
|
152
150
|
import { type AutoMotionCase, type AutoSearch, DEFORM_MAY_FOLD_WHY, type MotionDeformation, type StimulusPose, stimulusAnimationNames } from './automotion.ts';
|
|
@@ -181,15 +179,14 @@ import { OPAQUE_ALPHA_ABOVE } from './layers.ts';
|
|
|
181
179
|
import { bindFaceSurfaceDeform, BLINK, blinkHoldMisses, blinkSpan, blinkTimes, CONTROL_SUFFIX, controlledBones, IDLE_FPS, idleMotion, type MotionSpec, moveKeysToControls } from './motion.ts';
|
|
182
180
|
import { type PartRecord, type AlternateSetMap, FRONT_SUFFIX, PAINTING_RUN, type PartsFile, readFrom, tagOf } from './parts.ts';
|
|
183
181
|
import { waistPairs, waistBand, waistInfluences } from './waist.ts';
|
|
184
|
-
import { preserveWaistRest, refineWaistMesh, remapWaistDeforms, storedWorld, waistBottomMesh, waistBottomLayoutOf, type WaistMapping } from './waistmesh.ts';
|
|
185
|
-
import { pivotWaistMesh, sharedWaistCopy, type WaistPivotRequest } from './waistmesh.ts';
|
|
182
|
+
import { pivotWaistMesh, preserveWaistRest, refineWaistMesh, remapWaistDeforms, sharedWaistCopy, storedWorld, waistBottomMesh, waistBottomLayoutOf, type WaistMapping, type WaistPivotRequest } from './waistmesh.ts';
|
|
186
183
|
import { readTag } from './tags.ts';
|
|
187
184
|
import { EYE_GROUP_TAGS } from './propose.ts';
|
|
188
185
|
import { alphaAbove, crop, pad, type Raster } from './raster/index.ts';
|
|
189
186
|
import { pyRound } from './round.ts';
|
|
190
187
|
import { boneHeat, type HeatDust, heatInfluences, HEAT_LIMITS, heatRow, type HeatRow, latticeSilhouette, tracedSilhouette } from './heat.ts';
|
|
191
188
|
import type { PosePoints } from './skeleton.ts';
|
|
192
|
-
import { applyFaceSurfaceDeform, BODY_REAR_SHIFT_BONE, BODY_YAW_DIAL_BONE, BODYSHIFT_BONE, buildDepth25DTurn, type Depth25DTurnOptions, FACE_RATED_BAND, FACESHIFT_BONE, PITCH_DIAL_BONE, REAR_SHIFT_BONE, resolveTurnGrid, TURN_BONE, TURN_CARRIER_TAG, TURN_GRID_MAX_TRIANGLES_PER_SLOT, TURN_GRID_MAX_TRIANGLES_TOTAL, TURN_PLACES, TURN_RIDER_APART, TURN_RIDER_TAGS, turnRiderDepth, type
|
|
189
|
+
import { applyFaceSurfaceDeform, BODY_REAR_SHIFT_BONE, BODY_YAW_DIAL_BONE, BODYSHIFT_BONE, buildDepth25DTurn, type Depth25DTurnOptions, FACE_RATED_BAND, FACESHIFT_BONE, PITCH_DIAL_BONE, REAR_SHIFT_BONE, resolveTurnGrid, TURN_BONE, TURN_CARRIER_TAG, TURN_GRID_MAX_TRIANGLES_PER_SLOT, TURN_GRID_MAX_TRIANGLES_TOTAL, TURN_PLACES, TURN_RIDER_APART, TURN_RIDER_TAGS, turnRiderDepth, type TurnSpec, turnConstraintName, turnFractions, turnNearest, turnSurfaceBone, turnTwin, turnUnitBone, YAW_DIAL_BONE } from './turn.ts';
|
|
193
190
|
import type { CoupledTurnBandReport } from './turnband.ts';
|
|
194
191
|
import { DISTANCE_EXPONENT, type FloorForm, type Influence, influences, type InfluenceLimits, type MeshInfluences, meshLimits, type Segment } from './weights.ts';
|
|
195
192
|
import { turnContourBands } from './turnoverlap.ts';
|
|
@@ -1637,11 +1634,11 @@ export function buildWaistPairSource(
|
|
|
1637
1634
|
/^full:(drape|hand)-[rl]$/.test(from)
|
|
1638
1635
|
? ` — the full run's merged arm layer was split into this part (issue #490, from 1.37.0), which a config proposed before 1.37.0 does not name; see ${ARM_SPLIT_MIGRATION}, and add only its plan row and entry with: ${ARM_SPLIT_REMEDY}`
|
|
1639
1636
|
: '';
|
|
1640
|
-
const where = (
|
|
1641
|
-
for (const part of Object.keys(cfg.meshes)) if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.meshes.${part}`, `names the part "${part}", which is not in parts.json; ${where(
|
|
1637
|
+
const where = (): string => `parts.json holds ${parts.parts.length} part(s): ${parts.parts.map((p) => p.name).join(', ')}`;
|
|
1638
|
+
for (const part of Object.keys(cfg.meshes)) if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.meshes.${part}`, `names the part "${part}", which is not in parts.json; ${where()}`);
|
|
1642
1639
|
for (const [part, region] of Object.entries(cfg.regions)) {
|
|
1643
1640
|
const bone = regionBone(region);
|
|
1644
|
-
if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.regions.${part}`, `names the part "${part}", which is not in parts.json; ${where(
|
|
1641
|
+
if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.regions.${part}`, `names the part "${part}", which is not in parts.json; ${where()}`);
|
|
1645
1642
|
if (!B.has(bone)) fail('RIG_NAME_RESOLVES', `config.regions.${part}`, `names the bone "${bone}", which config.bones does not declare`);
|
|
1646
1643
|
}
|
|
1647
1644
|
if (cfg.stops !== undefined) {
|
|
@@ -1657,13 +1654,13 @@ export function buildWaistPairSource(
|
|
|
1657
1654
|
}
|
|
1658
1655
|
if (cfg.turn?.roles !== undefined) {
|
|
1659
1656
|
for (const part of Object.keys(cfg.turn.roles)) {
|
|
1660
|
-
if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.turn.roles.${part}`, `names the part "${part}", which is not in parts.json; ${where(
|
|
1657
|
+
if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.turn.roles.${part}`, `names the part "${part}", which is not in parts.json; ${where()}`);
|
|
1661
1658
|
else if (!(part in cfg.meshes) && !(part in cfg.regions)) fail('RIG_NAME_RESOLVES', `config.turn.roles.${part}`, `names "${part}", which neither config.meshes nor config.regions attaches`);
|
|
1662
1659
|
}
|
|
1663
1660
|
}
|
|
1664
1661
|
if (cfg.turn?.body !== undefined) {
|
|
1665
1662
|
for (const part of Object.keys(cfg.turn.body.roles)) {
|
|
1666
|
-
if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.turn.body.roles.${part}`, `names the part "${part}", which is not in parts.json; ${where(
|
|
1663
|
+
if (!byPart.has(part)) fail('RIG_PART_PRESENT', `config.turn.body.roles.${part}`, `names the part "${part}", which is not in parts.json; ${where()}`);
|
|
1667
1664
|
else if (!(part in cfg.meshes) && !(part in cfg.regions)) fail('RIG_NAME_RESOLVES', `config.turn.body.roles.${part}`, `names "${part}", which neither config.meshes nor config.regions attaches`);
|
|
1668
1665
|
}
|
|
1669
1666
|
}
|
package/src/runstamp.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { createHash } from 'node:crypto';
|
|
|
2
2
|
import { existsSync, readdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import nodePath, { basename, dirname, join, relative, resolve, sep } from 'node:path';
|
|
4
4
|
import { type AssembleResult, FIGURE_MASK_FILE } from './assemble.ts';
|
|
5
|
-
import { type AssembleWrapperReadings, BUILD_RUN_FILE, ERROR_MAP_FILE } from './build.ts';
|
|
5
|
+
import { type AssembleWrapperReadings, BUILD_RUN_FILE, type BuildWrapperRole, ERROR_MAP_FILE } from './build.ts';
|
|
6
6
|
import { CUT_MATERIAL_SOURCES } from './cutmaterial.ts';
|
|
7
7
|
import { EDGE_RESIDUAL_FILE } from './edgeresidual.ts';
|
|
8
8
|
import { PartsError } from './errors.ts';
|
|
9
|
-
import type { WrapperManifestReading } from './layers.ts';
|
|
9
|
+
import type { WrapperManifestReading, WrapperReadings } from './layers.ts';
|
|
10
10
|
import { LAYOUT_FILE } from './limblayout.ts';
|
|
11
11
|
import { argvPathFromOut, linkRuleFor, type PlatformPath, realWhereItExists, recordedConfigPath, recordedInputPath } from './outputpaths.ts';
|
|
12
12
|
import { PAINTING_ALLOCATION_FILE } from './paintingedges.ts';
|
|
@@ -69,11 +69,13 @@ export interface RunStampAssembleInputs {
|
|
|
69
69
|
head?: string | null;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
type WrapperRole =
|
|
73
|
-
type
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
type WrapperRole = 'full' | 'head';
|
|
73
|
+
export type { BuildWrapperRole };
|
|
74
|
+
export interface BoundWrapperInputs<Role extends string = WrapperRole> {
|
|
75
|
+
manifests: Partial<Record<Role, WrapperManifestReading>>;
|
|
76
|
+
pngs: RunStampInputEntry<Role>[];
|
|
77
|
+
}
|
|
78
|
+
type AssembleWrapperInputs = BoundWrapperInputs<WrapperRole>;
|
|
77
79
|
|
|
78
80
|
export interface RunStamp {
|
|
79
81
|
spec: typeof RUN_STAMP_SPEC;
|
|
@@ -142,13 +144,15 @@ export function buildAssembleInputs(inputs: RunStampAssembleInputs, outDir: stri
|
|
|
142
144
|
], outDir, inputs.cwd ?? process.cwd(), manifests);
|
|
143
145
|
}
|
|
144
146
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
147
|
+
function bindWrapperRoleReadings<Role extends string>(
|
|
148
|
+
entries: ReadonlyArray<readonly [Role, WrapperReadings | undefined]>,
|
|
149
|
+
): BoundWrapperInputs<Role> | undefined {
|
|
150
|
+
const manifests: Partial<Record<Role, WrapperManifestReading>> = {};
|
|
151
|
+
const pngs: RunStampInputEntry<Role>[] = [];
|
|
152
|
+
let anyManifest = false;
|
|
153
|
+
for (const [role, reading] of entries) {
|
|
154
|
+
if (reading?.manifest === undefined) continue;
|
|
155
|
+
anyManifest = true;
|
|
152
156
|
manifests[role] = reading.manifest;
|
|
153
157
|
const dir = dirname(reading.manifest.path);
|
|
154
158
|
const hashes = new Map<string, string>();
|
|
@@ -173,7 +177,27 @@ export function bindAssembleWrapperInputs(readings: AssembleWrapperReadings): As
|
|
|
173
177
|
}
|
|
174
178
|
for (const path of [...hashes.keys()].sort()) pngs.push({ role, path, sha256: hashes.get(path)! });
|
|
175
179
|
}
|
|
176
|
-
return
|
|
180
|
+
return anyManifest ? { manifests, pngs } : undefined;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** Validate the primary wrappers' consumed files before assemble can publish its outputs. */
|
|
184
|
+
export function bindAssembleWrapperInputs(readings: AssembleWrapperReadings): AssembleWrapperInputs | undefined {
|
|
185
|
+
return bindWrapperRoleReadings<WrapperRole>([
|
|
186
|
+
['full', readings.full],
|
|
187
|
+
['head', readings.head],
|
|
188
|
+
]);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Validate the primary and `--alt` wrappers' consumed files before build's assemble worker publishes its outputs. */
|
|
192
|
+
export function bindBuildWrapperInputs(readings: AssembleWrapperReadings): BoundWrapperInputs<BuildWrapperRole> | undefined {
|
|
193
|
+
const entries: Array<readonly [BuildWrapperRole, WrapperReadings | undefined]> = [
|
|
194
|
+
['full', readings.full],
|
|
195
|
+
['head', readings.head],
|
|
196
|
+
];
|
|
197
|
+
readings.alts?.forEach((alt, i) => {
|
|
198
|
+
entries.push([`alt[${i}].full`, alt.full], [`alt[${i}].head`, alt.head]);
|
|
199
|
+
});
|
|
200
|
+
return bindWrapperRoleReadings(entries);
|
|
177
201
|
}
|
|
178
202
|
|
|
179
203
|
function sortCodeUnits(paths: readonly string[]): string[] {
|
|
@@ -342,7 +366,13 @@ export type BuildRunInputRole = RunStampInputRole | 'requirements' | 'environmen
|
|
|
342
366
|
|
|
343
367
|
export type RunRecord =
|
|
344
368
|
| (RunRecordFields & { spec: typeof RUN_RECORD_SPEC; command: 'check'; parts_input?: RunStampFileEntry })
|
|
345
|
-
| (RunRecordFields & {
|
|
369
|
+
| (RunRecordFields & {
|
|
370
|
+
spec: typeof BUILD_RUN_RECORD_SPEC;
|
|
371
|
+
command: 'build';
|
|
372
|
+
config: RunStampFileEntry;
|
|
373
|
+
inputs: RunStampInputEntry<BuildRunInputRole>[];
|
|
374
|
+
wrapper_pngs?: RunStampInputEntry<BuildRunInputRole>[];
|
|
375
|
+
});
|
|
346
376
|
|
|
347
377
|
/** One command's flags as its parser takes them: the flag-table order, which values are paths, and values that hold paths inside them. */
|
|
348
378
|
export interface ArgvTable {
|
|
@@ -463,7 +493,12 @@ interface BuildRunInputs extends RunStampAssembleInputs {
|
|
|
463
493
|
|
|
464
494
|
export type RunRecordInput = RunRecordInputFields & (
|
|
465
495
|
| { command: 'check'; partsInput?: RunStampFileEntry }
|
|
466
|
-
| {
|
|
496
|
+
| {
|
|
497
|
+
command: 'build';
|
|
498
|
+
configPath: string;
|
|
499
|
+
inputs: BuildRunInputs;
|
|
500
|
+
wrapperPngs?: readonly RunStampInputEntry<BuildRunInputRole>[];
|
|
501
|
+
}
|
|
467
502
|
);
|
|
468
503
|
|
|
469
504
|
function buildRunInputs(inputs: BuildRunInputs, outDir: string): RunStampInputEntry<BuildRunInputRole>[] {
|
|
@@ -513,6 +548,9 @@ export function buildRunRecord(input: RunRecordInput): RunRecord {
|
|
|
513
548
|
...times,
|
|
514
549
|
config: { path: recordedConfigPath(input.outDir, input.configPath), sha256: sha256OnDisk(input.configPath) },
|
|
515
550
|
inputs: buildRunInputs(input.inputs, input.outDir),
|
|
551
|
+
...(input.wrapperPngs === undefined || input.wrapperPngs.length === 0
|
|
552
|
+
? {}
|
|
553
|
+
: { wrapper_pngs: input.wrapperPngs.map(({ role, path, sha256 }) => ({ role, path, sha256 })) }),
|
|
516
554
|
...tail,
|
|
517
555
|
};
|
|
518
556
|
}
|
package/src/scene.ts
CHANGED
|
@@ -2508,7 +2508,7 @@ export function unprefixedNames(rig: RigSpec, motion: MotionSpec, ids: readonly
|
|
|
2508
2508
|
name('invariants.axes name', ax.name, false);
|
|
2509
2509
|
for (const n of [...ax.through, ...ax.bones]) name(`invariants.axes ${ax.name} bone`, n, false);
|
|
2510
2510
|
}
|
|
2511
|
-
for (const
|
|
2511
|
+
for (const k of Object.keys(motion.easings)) name('easing', k, false);
|
|
2512
2512
|
for (const [g, members] of Object.entries(motion.groups)) {
|
|
2513
2513
|
name('group', g, false);
|
|
2514
2514
|
for (const m of members) name(`group ${g} member`, m, false);
|
package/src/structure.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { explicitWeightRows, regionBone } from './config.ts';
|
|
1
|
+
import { type ConfigConstraint, CONSTRAINT_FOLLOWS, contourRegionsOf, explicitWeightRows, parseConfig, parseProposalSections, type Point, regionBone, ROOT_BONE, type SkeletonSections, weightsABone } from './config.ts';
|
|
2
2
|
/**
|
|
3
3
|
* A structural comparison of two skeletons (issue #85).
|
|
4
4
|
*
|
|
@@ -73,7 +73,6 @@ import { explicitWeightRows, regionBone } from './config.ts';
|
|
|
73
73
|
import { existsSync, readFileSync } from 'node:fs';
|
|
74
74
|
import { CompileError } from '@rig-c/core/errors';
|
|
75
75
|
import { parseRigSpec, RIG_SPEC_VERSION, type RigBone as RigcBone, type RigSpec as RigcSpec, splitRigSkin } from '@rig-c/core/rig';
|
|
76
|
-
import { type ConfigConstraint, CONSTRAINT_FOLLOWS, contourRegionsOf, parseConfig, parseProposalSections, type Point, ROOT_BONE, type SkeletonSections, weightsABone } from './config.ts';
|
|
77
76
|
import { computeExactFrameTransforms, cropToSpineY, normaliseDegrees, toWorld } from './coords.ts';
|
|
78
77
|
import { PartsError, type Problem, refuseIfAny } from './errors.ts';
|
|
79
78
|
import { edgeLength } from './length.ts';
|
package/src/turn.ts
CHANGED
|
@@ -31,13 +31,12 @@
|
|
|
31
31
|
import { boundaryDepthSamplers, type BoundaryDepths } from './boundarydepth.ts';
|
|
32
32
|
import { computeWorldTransforms, setupToPaintingPoint, toBoneLocalVector, toWorld, type BoneTransform } from './coords.ts';
|
|
33
33
|
import { extendDepthSilhouette, sampleDepthFloat, type PartDepthReference } from './depthsheets.ts';
|
|
34
|
-
import { type Problem, refuseIfAny } from './errors.ts';
|
|
34
|
+
import { PartsError, type Problem, refuseIfAny } from './errors.ts';
|
|
35
35
|
import type { Raster } from './raster/index.ts';
|
|
36
36
|
import { pyRound } from './round.ts';
|
|
37
37
|
import { turnOverlapOwners } from './turnoverlap.ts';
|
|
38
38
|
import { coupleTurnBand, type CoupledTurnBandReport, type TurnBandDial } from './turnband.ts';
|
|
39
39
|
import { sampleTurnTriangleField, turnTriangleCoordinates } from './turnfield.ts';
|
|
40
|
-
import { PartsError } from './errors.ts';
|
|
41
40
|
import { f32 } from '@rig-c/core/compile';
|
|
42
41
|
import { warnUncoveredBodyTurn } from './turncoverage.ts';
|
|
43
42
|
import { evaluateDeformTransform } from '@rig-c/core/deformgen';
|
|
@@ -1982,7 +1981,6 @@ function buildDepth25DTurnGroup(
|
|
|
1982
1981
|
const pt = opts.boneLandmarks.get(bName);
|
|
1983
1982
|
if (pt !== undefined) {
|
|
1984
1983
|
const { rec, ext, zRef } = primarySurface;
|
|
1985
|
-
const padX = Math.floor((ext.width - rec.w) / 2);
|
|
1986
1984
|
const padY = Math.floor((ext.height - rec.h) / 2);
|
|
1987
1985
|
const cheekX = pt[0] < rec.x + rec.w / 2 ? 0 : ext.width - 1;
|
|
1988
1986
|
const cheekY = Math.max(0, Math.min(ext.height - 1, Math.round(pt[1] - rec.y + padY)));
|
package/tools/build-process.ts
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import { spawnSync } from 'node:child_process';
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
5
|
-
import { assembleStage, checkStage, rigStage, type AssembleOutputs, type AssembleStageInput, type CheckStageInput, type RigStageInput } from '../src/build.ts';
|
|
5
|
+
import { assembleStage, checkStage, rigStage, type AssembleOutputs, type AssembleStageInput, type BuildWrapperRole, type CheckStageInput, type RigStageInput } from '../src/build.ts';
|
|
6
6
|
import { rigcRunnerAt, type CheckReport, type RigcRunner } from '../src/check.ts';
|
|
7
7
|
import type { Mask } from '../src/raster/types.ts';
|
|
8
8
|
import { PartsError, type Problem } from '../src/errors.ts';
|
|
9
|
+
import { bindBuildWrapperInputs, type RunStampInputEntry } from '../src/runstamp.ts';
|
|
9
10
|
|
|
10
11
|
/** Preserve native/custom executables; adapt only a proven package-manager script shim. */
|
|
11
12
|
export function selectedRigcCommand(bin: string, platform: NodeJS.Platform = process.platform): { command: string; prefix: string[] } {
|
|
@@ -73,7 +74,7 @@ export type BuildProcessJob =
|
|
|
73
74
|
function record(value: unknown): value is Record<string, unknown> {
|
|
74
75
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
75
76
|
}
|
|
76
|
-
type AssemblyReading = { supportFigure?: Mask };
|
|
77
|
+
type AssemblyReading = { supportFigure?: Mask; wrapperPngs?: RunStampInputEntry<BuildWrapperRole>[] };
|
|
77
78
|
type StageReading = CheckReport | AssemblyReading | void;
|
|
78
79
|
|
|
79
80
|
/** Private inter-process source observation, never written to build outputs. */
|
|
@@ -87,6 +88,26 @@ function decodeSupportFigure(value: unknown): Mask {
|
|
|
87
88
|
if (data.length !== value.width * value.height || data.toString('base64') !== value.alpha_base64 || data.some(p => p !== 0 && p !== 1)) throw new Error('BUILD_STAGE_SUPPORT_FIGURE: canonical binary alpha must fill the native grid');
|
|
88
89
|
return { width: value.width, height: value.height, data };
|
|
89
90
|
}
|
|
91
|
+
function isBuildWrapperRole(value: unknown): value is BuildWrapperRole {
|
|
92
|
+
return value === 'full' || value === 'head' || (typeof value === 'string' && /^alt\[(?:0|[1-9][0-9]*)\]\.(?:full|head)$/.test(value));
|
|
93
|
+
}
|
|
94
|
+
function decodeWrapperPngs(value: unknown): RunStampInputEntry<BuildWrapperRole>[] {
|
|
95
|
+
if (!Array.isArray(value) || value.length === 0) return resultError('assemble', 'wrapperPngs must be a non-empty array when present');
|
|
96
|
+
return value.map((entry) => {
|
|
97
|
+
if (
|
|
98
|
+
!record(entry) ||
|
|
99
|
+
Object.keys(entry).join(',') !== 'role,path,sha256' ||
|
|
100
|
+
!isBuildWrapperRole(entry.role) ||
|
|
101
|
+
typeof entry.path !== 'string' ||
|
|
102
|
+
entry.path === '' ||
|
|
103
|
+
typeof entry.sha256 !== 'string' ||
|
|
104
|
+
!/^[0-9a-f]{64}$/.test(entry.sha256)
|
|
105
|
+
) {
|
|
106
|
+
return resultError('assemble', 'wrapperPngs rows must carry valid role, path and sha256');
|
|
107
|
+
}
|
|
108
|
+
return { role: entry.role, path: entry.path, sha256: entry.sha256 };
|
|
109
|
+
});
|
|
110
|
+
}
|
|
90
111
|
function problems(value: unknown): value is Problem[] {
|
|
91
112
|
return Array.isArray(value) && value.length > 0 && value.every((p) => record(p) && typeof p.code === 'string' && typeof p.object === 'string' && typeof p.detail === 'string');
|
|
92
113
|
}
|
|
@@ -126,9 +147,18 @@ export function readBuildReceipt(stage: Stage, status: number | null, signal: st
|
|
|
126
147
|
if (status !== 0) throw new Error('BUILD_STAGE_CHILD: ' + stage + ' child — exit ' + status + ' with a completion receipt; no later stage ran');
|
|
127
148
|
if (stage !== 'check') {
|
|
128
149
|
if (Object.hasOwn(row, 'report') || Object.hasOwn(row, 'sweepSteps')) return resultError(stage, 'a void stage returned an invented check report');
|
|
129
|
-
if (stage
|
|
130
|
-
|
|
131
|
-
|
|
150
|
+
if (stage !== 'assemble') {
|
|
151
|
+
if (row.supportFigure !== undefined) return resultError(stage, 'only assembly returns a source observation');
|
|
152
|
+
if (row.wrapperPngs !== undefined) return resultError(stage, 'only assembly returns wrapper PNG readings');
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const supportFigure = row.supportFigure === undefined ? undefined : decodeSupportFigure(row.supportFigure);
|
|
156
|
+
const wrapperPngs = row.wrapperPngs === undefined ? undefined : decodeWrapperPngs(row.wrapperPngs);
|
|
157
|
+
if (supportFigure === undefined && wrapperPngs === undefined) return;
|
|
158
|
+
return {
|
|
159
|
+
...(supportFigure === undefined ? {} : { supportFigure }),
|
|
160
|
+
...(wrapperPngs === undefined ? {} : { wrapperPngs }),
|
|
161
|
+
};
|
|
132
162
|
}
|
|
133
163
|
if (!checkReport(row.report)) return resultError(stage, 'check report is incomplete');
|
|
134
164
|
if (row.sweepSteps !== null && (!Array.isArray(row.sweepSteps) || !row.sweepSteps.every((p) =>
|
|
@@ -207,10 +237,31 @@ function worker(args: string[]): number {
|
|
|
207
237
|
try {
|
|
208
238
|
let report: CheckReport | undefined;
|
|
209
239
|
let supportFigure: Mask | undefined;
|
|
210
|
-
|
|
211
|
-
|
|
240
|
+
let wrapperPngs: RunStampInputEntry<BuildWrapperRole>[] | undefined;
|
|
241
|
+
if (job.stage === 'assemble') {
|
|
242
|
+
supportFigure = assembleStage(
|
|
243
|
+
job.input,
|
|
244
|
+
job.outputs,
|
|
245
|
+
log,
|
|
246
|
+
(readings) => {
|
|
247
|
+
const bound = bindBuildWrapperInputs(readings);
|
|
248
|
+
wrapperPngs = bound !== undefined && bound.pngs.length > 0 ? bound.pngs : undefined;
|
|
249
|
+
},
|
|
250
|
+
).supportFigure;
|
|
251
|
+
} else if (job.stage === 'rig') rigStage(job.input, runner, job.scratch, log);
|
|
212
252
|
else report = checkStage(job.input, runner, job.bin, log);
|
|
213
|
-
writeFileSync(
|
|
253
|
+
writeFileSync(
|
|
254
|
+
args[1],
|
|
255
|
+
report === undefined
|
|
256
|
+
? JSON.stringify({
|
|
257
|
+
version: 1,
|
|
258
|
+
stage: job.stage,
|
|
259
|
+
kind: 'done',
|
|
260
|
+
...(supportFigure === undefined ? {} : { supportFigure: encodeSupportFigure(supportFigure) }),
|
|
261
|
+
...(wrapperPngs === undefined ? {} : { wrapperPngs }),
|
|
262
|
+
})
|
|
263
|
+
: encodeCheckReceipt(report),
|
|
264
|
+
);
|
|
214
265
|
return 0;
|
|
215
266
|
} catch (err) {
|
|
216
267
|
if (!(err instanceof PartsError)) throw err;
|