rig-parts 1.60.1 → 1.61.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/README.md CHANGED
@@ -456,7 +456,10 @@ for each — a config fragment, the `check` lines it passes with, and its limit:
456
456
 
457
457
  - [**Expressions and other named animations**](docs/AUTHORING.md#recipe-expressions-and-other-named-animations):
458
458
  the face's parts are bones; animations written over them in rig-c's motion-spec shape and
459
- named by `motion.animations_from` are built and gated beside the idle on every build. One
459
+ named by `motion.animations_from` are built and gated beside the idle on every build. Keys
460
+ carry core motion fields, including raw `curve` control points in absolute time/value
461
+ coordinates ([core key format](https://github.com/rig-c/core/blob/main/docs/AUTHORING.md#45-keys--times-values-curves));
462
+ the linked recipe includes a core-gated example. One
460
463
  attachment per slot, so a part moves, turns and scales but is never swapped for another
461
464
  image; `check` measures the idle alone.
462
465
  - [**A soft region driven by physics**](docs/AUTHORING.md#recipe-a-soft-region-driven-by-physics)
package/cli.ts CHANGED
@@ -12,10 +12,12 @@
12
12
  * 2 a usage error, or a command this version does not implement
13
13
  */
14
14
  import { spawnSync } from 'node:child_process';
15
+ import { runBuildProcess, processRigcRunner as rigcRunner } from './tools/build-process.ts';
15
16
  import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
16
17
  import { tmpdir } from 'node:os';
17
18
  import { basename, dirname, extname, join, resolve } from 'node:path';
18
19
  import { DEFAULT_PROJECT_RULE, DEFAULT_SEAM_RULE, HOLES_LISTED, PROJECT_RULES, type ProjectRule, proposeFields, proposePlan, proposeSinglePlan, SEAM_RULES, type SeamRule } from './src/assemble.ts';
20
+ import { parseAltArg } from './tools/alternate-cli.ts';
19
21
  import { type AlternateCliInput, assembleStage, build, checkStage, ERROR_MAP_FILE, loopStage, readRuns, readSource, rigStage, suppliedCheckFlag } from './src/build.ts';
20
22
  import { ACCEPTABLE_BARS, DEFAULT_PACK_SHAPE, DEFAULT_PAGE_EDGES, findRigc, PACK_SHAPES, rigcRunnerAt, type PackShape, PAGE_EDGES, type PageEdges, PARTS_HOME_SENTENCE, RIGC_GEOMETRY_VERSION, rigcRanClause, type RigcRunner, NO_PARTS_SENTENCE, SEAM_MEAN_BAR, SOURCE_SENTENCE, SEAM_PX_BAR, SEAM_PX_LEVEL, SPINEBOY_YARDSTICK, TEXTURE_STRETCH_CEILING } from './src/check.ts';
21
23
  import { ComfyClient, resolveHost, runPainting, runSeeThrough } from './src/comfy/index.ts';
@@ -1040,19 +1042,6 @@ function notTaken(command: Command, flag: string): string {
1040
1042
  return `${command} does not take "${flag}"; it takes ${[...row.valued, ...row.switches].join(', ')}`;
1041
1043
  }
1042
1044
 
1043
- /** Parse `--alt <name>=<source>:<full>[:<head>]` (issue #454), or return a usage message. */
1044
- function parseAltArg(value: string): AlternateCliInput | string {
1045
- const eq = value.indexOf('=');
1046
- if (eq <= 0) return `--alt "${value}" is not <name>=<source>:<full>[:<head>]`;
1047
- const name = value.slice(0, eq);
1048
- if (name.startsWith('.') || name.includes('/') || name.includes('\\')) return `--alt set name "${name}" may not start with "." or hold a slash`;
1049
- const rest = value.slice(eq + 1);
1050
- const parts = rest.split(':');
1051
- if (parts.length < 2 || parts.length > 3 || parts[0].length === 0 || parts[1].length === 0 || (parts.length === 3 && parts[2].length === 0)) {
1052
- return `--alt "${value}" is not <name>=<source>:<full>[:<head>]`;
1053
- }
1054
- return { name, source: parts[0], full: parts[1], ...(parts.length === 3 ? { head: parts[2] } : {}) };
1055
- }
1056
1045
 
1057
1046
  /**
1058
1047
  * `layers <path>` prints the table; `layers --export <dir> <path>` writes the
@@ -1244,14 +1233,6 @@ function cmdRig(args: string[]): number {
1244
1233
  * the spawn from here. A call that fails carries which rigc ran it, path and
1245
1234
  * version ({@link rigcRunnerAt}, issue #337), and every refusal quoting it says so.
1246
1235
  */
1247
- function rigcRunner(bin: string): RigcRunner {
1248
- return rigcRunnerAt(bin, (b, args) => {
1249
- const r = spawnSync(b, [...args], { encoding: 'utf8', maxBuffer: 1 << 28 });
1250
- if (r.error !== undefined) return { status: 127, out: `could not start ${b}: ${r.error.message}` };
1251
- return { status: r.status ?? 1, out: `${r.stdout ?? ''}${r.stderr ?? ''}` };
1252
- });
1253
- }
1254
-
1255
1236
  /** The command's valued flags as `--flag value` pairs, each one its {@link TAKES} row holds; `required` must all be given. Its bare switches are taken out by the caller before this reads the rest. A string is a usage error. */
1256
1237
  function flags(args: string[], command: Command, required: readonly string[]): Map<string, string> | string {
1257
1238
  const got = new Map<string, string>();
@@ -1877,7 +1858,11 @@ function cmdBuild(args: string[]): number {
1877
1858
  try {
1878
1859
  const r = build(
1879
1860
  { config, source, full, head, out, seam: seam as SeamRule, project: project as ProjectRule, loop, pageEdges: edges, packShape: shape, ...(flags.has('--requirements') ? { requirements: flags.get('--requirements') as string } : {}), idleKeys: keys, ...(leadText === undefined ? {} : { leadIn: Number(leadText) }), seamPairs: on.has('--seam-pairs'), keepStills: on.has('--keep-stills'), ...(alts.length === 0 ? {} : { alts }), ...(flags.has('--set') ? { set: flags.get('--set') as string } : {}), allSets: on.has('--all-sets'), ...(flags.has('--environment') ? { environment: flags.get('--environment') as string } : {}) },
1880
- { rig: rigcRunner(bin), check: rigcRunner(bin), checkBin: bin, scratch: join(scratch, 'rig-gate') },
1861
+ { rig: rigcRunner(bin), check: rigcRunner(bin), checkBin: bin, scratch: join(scratch, 'rig-gate'), stages: {
1862
+ assemble: (input, outputs) => runBuildProcess({ stage: 'assemble', bin, input, outputs }, join(scratch, 'workers')),
1863
+ rig: (input, _rigc, gateScratch) => runBuildProcess({ stage: 'rig', bin, input, scratch: gateScratch }, join(scratch, 'workers')),
1864
+ check: (input, _rigc, checkBin) => runBuildProcess({ stage: 'check', bin: checkBin, input }, join(scratch, 'workers')),
1865
+ } },
1881
1866
  console.log,
1882
1867
  );
1883
1868
  return r.stoppedAt === null ? EXIT_OK : EXIT_REFUSED;