rig-parts 1.54.0 → 1.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.ts +49 -12
- package/docs/AUTHORING.md +92 -18
- package/docs/STABILITY.md +6 -5
- package/package.json +1 -1
- package/src/assemble.ts +568 -51
- package/src/build.ts +91 -11
- package/src/check.ts +43 -12
- package/src/cloth.ts +10 -3
- package/src/clothconfig.ts +78 -11
- package/src/config.ts +27 -6
- package/src/parts.ts +83 -45
- package/src/propose.ts +86 -6
- package/src/remesh.ts +306 -6
- package/src/retune.ts +25 -3
- package/src/rig.ts +18 -6
package/cli.ts
CHANGED
|
@@ -31,8 +31,8 @@ import { basisLines, branchSqueezeLine, checkProposal, compare, compareLines, DE
|
|
|
31
31
|
import { BASIS_FILE, BASIS_SPEC, basisFile, basisLine, coverageLines, serializeBasis } from './src/diagnostics.ts';
|
|
32
32
|
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';
|
|
33
33
|
import { meshStatsStage } from './src/meshstats.ts';
|
|
34
|
-
import { chainsLeftBehind, clothConfigEdits, editPaths, previousCount, writtenClothConfig } from './src/clothconfig.ts';
|
|
35
|
-
import { PROVENANCE_FILE, REMESH_SPEC, remeshStage } from './src/remesh.ts';
|
|
34
|
+
import { chainsLeftBehind, clothConfigEdits, editPaths, plainCount, previousCount, writtenClothConfig } from './src/clothconfig.ts';
|
|
35
|
+
import { INPUT_CHECK_FILE, INPUT_CHECK_SPEC, PROVENANCE_FILE, REMESH_SPEC, remeshStage } from './src/remesh.ts';
|
|
36
36
|
import { RETUNE_FILE, RETUNE_SPEC, retuneStage } from './src/retune.ts';
|
|
37
37
|
import { checkPainting } from './src/paintcheck.ts';
|
|
38
38
|
import { readPng, writePng } from './src/raster/png.ts';
|
|
@@ -257,8 +257,11 @@ usage:
|
|
|
257
257
|
entry equal to that previous recipe's draft is the recipe's, replaced
|
|
258
258
|
(or removed) as one equal to the draft without the recipe is; an entry
|
|
259
259
|
equal to none of the three drafts is still refused by name, its field
|
|
260
|
-
read against the previous recipe's draft.
|
|
261
|
-
|
|
260
|
+
read against the previous recipe's draft. An entry the previous recipe
|
|
261
|
+
drafted that the recipe now leaves plain (a tag whose recipe was
|
|
262
|
+
dropped) goes back to the draft without the recipe (issue #630). The
|
|
263
|
+
write line counts the entries the previous draft vouched for and the
|
|
264
|
+
entries returned to the plain draft. Without --from nothing changes.
|
|
262
265
|
|
|
263
266
|
rig-parts propose --parts <dir> --source <painting.png> --out <dir> --from-config <config.json>
|
|
264
267
|
Draw the config's CURRENT bones instead (<out>/render/landmarks_config.png
|
|
@@ -397,6 +400,7 @@ usage:
|
|
|
397
400
|
--mesh <entry.json> --out <dir> [--requirements <file.json>]
|
|
398
401
|
(or --delta <mesh-edit.json> in place of --mesh)
|
|
399
402
|
[--idle-keys ctl|direct] [--page-edges pot|free] [--pack-shape rect|polygon]
|
|
403
|
+
[--record-input-check] [--input-check <input-check.json>]
|
|
400
404
|
Re-fit one part's mesh of a gated rig (the directory rig writes) under
|
|
401
405
|
the mesh entry --mesh holds — what config.json would hold at
|
|
402
406
|
meshes.<name>: a grid, a contour or an auto entry, its bounds the
|
|
@@ -434,10 +438,30 @@ usage:
|
|
|
434
438
|
REMESH_DELTA_BASIS, REMESH_DELTA_OPS, REMESH_DELTA_OP naming ops[i],
|
|
435
439
|
REMESH_DELTA_TOPOLOGY). No config entry is built: the baseline is the
|
|
436
440
|
input itself; the splice, the gate and check are as for --mesh.
|
|
441
|
+
--record-input-check writes ${INPUT_CHECK_FILE} into --out beside
|
|
442
|
+
${PROVENANCE_FILE} (spec "${INPUT_CHECK_SPEC}": both versions — rigc's
|
|
443
|
+
whole --version output — the pack mode, the requirements file's path and
|
|
444
|
+
SHA-256, the rig and parts directories as resolved with every file's
|
|
445
|
+
SHA-256 — every file under --rig, parts.json and every file under
|
|
446
|
+
parts/ — and the input's check side as ${PROVENANCE_FILE} carries it).
|
|
447
|
+
--input-check <input-check.json> reuses that check instead of running
|
|
448
|
+
check on the input again (a line says so, with the number of SHA-256
|
|
449
|
+
rows that bound it), and the provenance's check.input is the recorded
|
|
450
|
+
one, byte for byte. Every row must be this run's: a file added, missing
|
|
451
|
+
or of other bytes, another directory, requirements file, pack mode,
|
|
452
|
+
rig-parts or rigc is refused by name with the row, the value recorded
|
|
453
|
+
and the value required (REMESH_INPUT_CHECK_BOUND); a file that is not
|
|
454
|
+
the record is REMESH_INPUT_CHECK_FILE. Both are read before anything is
|
|
455
|
+
built, and nothing is written. The record's rows are hashed again
|
|
456
|
+
right after check-input has read the input; a file that moved in
|
|
457
|
+
between is refused with both digests (REMESH_INPUT_CHECK_MOVED), and no
|
|
458
|
+
record or revision is written. Without either flag nothing written
|
|
459
|
+
moves.
|
|
437
460
|
|
|
438
461
|
rig-parts retune --rig <dir> --config <config.json> --parts <dir> --out <dir>
|
|
439
462
|
[--requirements <file.json>] [--idle-keys ctl|direct]
|
|
440
463
|
[--page-edges pot|free] [--pack-shape rect|polygon]
|
|
464
|
+
[--record-input-check] [--input-check <input-check.json>]
|
|
441
465
|
Splice the constraints and the idle a config states onto a gated rig
|
|
442
466
|
(the directory rig writes) and write a new revision into --out, which
|
|
443
467
|
must not exist (RETUNE_OUT_FRESH); the input is never written. The
|
|
@@ -458,6 +482,10 @@ usage:
|
|
|
458
482
|
SHA-256, what was held, which constraint fields and idle tracks changed,
|
|
459
483
|
both checks and their scope) — no path and no clock, so the same request
|
|
460
484
|
writes the same bytes. Prints what changed and a hash table of every file.
|
|
485
|
+
--record-input-check and --input-check are remesh's (one record format,
|
|
486
|
+
one binding; a record either command wrote serves the other over the
|
|
487
|
+
same input), refused as RETUNE_INPUT_CHECK_BOUND,
|
|
488
|
+
RETUNE_INPUT_CHECK_FILE and RETUNE_INPUT_CHECK_MOVED.
|
|
461
489
|
|
|
462
490
|
rig-parts check --rig <dir> --out <dir> [--parts <dir>] [--source <painting.png>]
|
|
463
491
|
[--page-edges pot|free] [--pack-shape rect|polygon]
|
|
@@ -955,8 +983,8 @@ const TAKES = {
|
|
|
955
983
|
compose: { valued: ['--scene', '--out', '--requirements', '--accept'], switches: [] },
|
|
956
984
|
'mesh-draft': { valued: ['--config', '--parts', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape'], switches: ['--more-triangles'] },
|
|
957
985
|
'mesh-stats': { valued: ['--config', '--parts'], switches: [] },
|
|
958
|
-
remesh: { valued: ['--rig', '--config', '--parts', '--part', '--mesh', '--delta', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape'], switches: [] },
|
|
959
|
-
retune: { valued: ['--rig', '--config', '--parts', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape'], switches: [] },
|
|
986
|
+
remesh: { valued: ['--rig', '--config', '--parts', '--part', '--mesh', '--delta', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape', '--input-check'], switches: ['--record-input-check'] },
|
|
987
|
+
retune: { valued: ['--rig', '--config', '--parts', '--out', '--requirements', '--idle-keys', '--page-edges', '--pack-shape', '--input-check'], switches: ['--record-input-check'] },
|
|
960
988
|
painting: { valued: ['--keypoints', '--person'], switches: [] },
|
|
961
989
|
} as const satisfies Record<string, { valued: readonly string[]; switches: readonly string[] }>;
|
|
962
990
|
|
|
@@ -1404,7 +1432,7 @@ function cmdPropose(args: string[]): number {
|
|
|
1404
1432
|
// Issue #571: with --from, the same parts drafted a third time with the previous recipe.
|
|
1405
1433
|
const previous = previousCloth === null ? null : proposeWithBasis(P, joints, wristSnap, gridRule, previousCloth).proposal;
|
|
1406
1434
|
const edits = clothConfigEdits(drafted, plain, JSON.parse(text) as unknown, false, previous);
|
|
1407
|
-
return { at: writeArg, input: text, text: writtenClothConfig(clothArg, text, edits), paths: editPaths(edits), vouched: previousCount(edits), relative: relativeConfigPaths(dirname(resolve(clothArg)), JSON.parse(text) as Record<string, unknown>) };
|
|
1435
|
+
return { at: writeArg, input: text, text: writtenClothConfig(clothArg, text, edits), paths: editPaths(edits), vouched: previousCount(edits), returned: plainCount(edits), relative: relativeConfigPaths(dirname(resolve(clothArg)), JSON.parse(text) as Record<string, unknown>) };
|
|
1408
1436
|
})();
|
|
1409
1437
|
// Issue #572: the keyed chains CHAIN_LAG reads only once the recipe took its trees' idle keys — in the config written
|
|
1410
1438
|
// against the --cloth config with --write-config, else in the proposal against the draft without the recipe.
|
|
@@ -1442,7 +1470,8 @@ function cmdPropose(args: string[]): number {
|
|
|
1442
1470
|
printLint(P, prop, joints, [...draftLint, ...leftBehind.findings]);
|
|
1443
1471
|
console.log(basisLine(bfile, out));
|
|
1444
1472
|
if (written !== null && clothArg !== undefined) {
|
|
1445
|
-
|
|
1473
|
+
// Issue #630: the entries a recipe dropped since --from gives back to the draft without the recipe.
|
|
1474
|
+
const from = fromArg === undefined ? '' : `; --from ${fromArg}: ${written.vouched} ${written.vouched === 1 ? 'entry' : 'entries'} taken as the previous recipe's draft, ${written.returned} ${written.returned === 1 ? 'entry' : 'entries'} returned to the plain draft`;
|
|
1446
1475
|
console.log(
|
|
1447
1476
|
written.paths.length > 0
|
|
1448
1477
|
? `wrote ${written.at}: ${clothArg}'s text with ${written.paths.join(', ')} spliced in from the draft; every other byte as read${from}`
|
|
@@ -1846,7 +1875,10 @@ function cmdMeshStats(args: string[]): number {
|
|
|
1846
1875
|
|
|
1847
1876
|
/** `remesh` (issue #495): one part of a gated rig re-fitted under a requested mesh entry, into a new revision. */
|
|
1848
1877
|
function cmdRemesh(args: string[]): number {
|
|
1849
|
-
|
|
1878
|
+
// Issue #617: --record-input-check carries no value, so it is taken out before the valued flags are read.
|
|
1879
|
+
const record = args.filter((a) => a === '--record-input-check').length;
|
|
1880
|
+
if (record > 1) return usage('--record-input-check is given twice');
|
|
1881
|
+
const f = flags(args.filter((a) => a !== '--record-input-check'), 'remesh', ['--rig', '--config', '--parts', '--part', '--out']);
|
|
1850
1882
|
if (typeof f === 'string') return usage(f);
|
|
1851
1883
|
if (f.has('--mesh') === f.has('--delta')) return usage('remesh needs exactly one of --mesh, --delta');
|
|
1852
1884
|
const keys = idleKeysOf(f.get('--idle-keys'));
|
|
@@ -1868,8 +1900,9 @@ function cmdRemesh(args: string[]): number {
|
|
|
1868
1900
|
const scratch = mkdtempSync(join(tmpdir(), 'rig-parts-remesh-'));
|
|
1869
1901
|
try {
|
|
1870
1902
|
const req = f.get('--requirements');
|
|
1903
|
+
const ic = f.get('--input-check');
|
|
1871
1904
|
remeshStage(
|
|
1872
|
-
{ rig: f.get('--rig') as string, config: f.get('--config') as string, parts: f.get('--parts') as string, part: f.get('--part') as string, ...(f.has('--mesh') ? { mesh: f.get('--mesh') as string } : { delta: f.get('--delta') as string }), out: f.get('--out') as string, idleKeys: keys, pageEdges: edges, packShape: shape, ...(req === undefined ? {} : { requirements: req }) },
|
|
1905
|
+
{ rig: f.get('--rig') as string, config: f.get('--config') as string, parts: f.get('--parts') as string, part: f.get('--part') as string, ...(f.has('--mesh') ? { mesh: f.get('--mesh') as string } : { delta: f.get('--delta') as string }), out: f.get('--out') as string, idleKeys: keys, pageEdges: edges, packShape: shape, ...(req === undefined ? {} : { requirements: req }), ...(ic === undefined ? {} : { inputCheck: ic }), ...(record === 1 ? { recordInputCheck: true } : {}) },
|
|
1873
1906
|
runner,
|
|
1874
1907
|
bin,
|
|
1875
1908
|
{ parts: version(), rigc: rigcVersion },
|
|
@@ -1886,7 +1919,10 @@ function cmdRemesh(args: string[]): number {
|
|
|
1886
1919
|
|
|
1887
1920
|
/** `retune` (issue #527): the constraints and the idle a config states, spliced onto a gated rig, into a new revision. */
|
|
1888
1921
|
function cmdRetune(args: string[]): number {
|
|
1889
|
-
|
|
1922
|
+
// Issue #617: --record-input-check carries no value, so it is taken out before the valued flags are read.
|
|
1923
|
+
const record = args.filter((a) => a === '--record-input-check').length;
|
|
1924
|
+
if (record > 1) return usage('--record-input-check is given twice');
|
|
1925
|
+
const f = flags(args.filter((a) => a !== '--record-input-check'), 'retune', ['--rig', '--config', '--parts', '--out']);
|
|
1890
1926
|
if (typeof f === 'string') return usage(f);
|
|
1891
1927
|
const keys = idleKeysOf(f.get('--idle-keys'));
|
|
1892
1928
|
if (!isIdleKeys(keys)) return usage(keys);
|
|
@@ -1907,8 +1943,9 @@ function cmdRetune(args: string[]): number {
|
|
|
1907
1943
|
const scratch = mkdtempSync(join(tmpdir(), 'rig-parts-retune-'));
|
|
1908
1944
|
try {
|
|
1909
1945
|
const req = f.get('--requirements');
|
|
1946
|
+
const ic = f.get('--input-check');
|
|
1910
1947
|
retuneStage(
|
|
1911
|
-
{ rig: f.get('--rig') as string, config: f.get('--config') as string, parts: f.get('--parts') as string, out: f.get('--out') as string, idleKeys: keys, pageEdges: edges, packShape: shape, ...(req === undefined ? {} : { requirements: req }) },
|
|
1948
|
+
{ rig: f.get('--rig') as string, config: f.get('--config') as string, parts: f.get('--parts') as string, out: f.get('--out') as string, idleKeys: keys, pageEdges: edges, packShape: shape, ...(req === undefined ? {} : { requirements: req }), ...(ic === undefined ? {} : { inputCheck: ic }), ...(record === 1 ? { recordInputCheck: true } : {}) },
|
|
1912
1949
|
runner,
|
|
1913
1950
|
bin,
|
|
1914
1951
|
{ parts: version(), rigc: rigcVersion },
|