@rig-c/parts 1.64.0 → 1.65.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/src/build.ts CHANGED
@@ -73,7 +73,7 @@ import {
73
73
  splitSchedule,
74
74
  untestedIntervals,
75
75
  } from './autoreplay.ts';
76
- import { besideIdleLine, checkSummaryLine, inputFileRecord, type InputFileRecord, CLOTH_LINE, type ClothLine, clothWarnText, frameRuns, MOTION_SEAM_LINE, type MotionSeamLine, type MotionSeamPlant, motionSeamWarnText, 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, readCheckEnvironment, 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 } from './check.ts';
76
+ import { besideIdleLine, checkSummaryLine, inputFileRecord, type InputFileRecord, CLOTH_LINE, type ClothLine, clothWarnText, frameRuns, MOTION_SEAM_LINE, type MotionSeamLine, type MotionSeamPlant, motionSeamWarnText, 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, 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';
77
77
  import { type Cut, type Extend, type Limb, loadConfigAndAnimations, loadConfigWithBytes, loadEarlyConfig, type Patch, type PlanEntry } from './config.ts';
78
78
  import { coreCompileGuideLine, failLine, PartsError, type Problem, refuseIfAny } from './errors.ts';
79
79
  import type { MeshQualityReport, MotionSchedule } from 'rig-c/mesh';
@@ -476,6 +476,10 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
476
476
  const hidesSet = new Set(alt.hides ?? []);
477
477
  const declaredSlots = alt.parts !== undefined ? alt.parts.filter((p) => !hidesSet.has(p)) : baseSlots.filter((p) => !hidesSet.has(p));
478
478
  const coveredSet = new Set(declaredSlots);
479
+ const generatedBands: string[] = [];
480
+ for (const limb of Object.values(fields.limbs ?? {})) if (limb.segments.every((sg) => coveredSet.has(sg.part))) {
481
+ for (const sg of limb.segments) if (sg.hybrid !== undefined) { coveredSet.add(sg.hybrid.part); generatedBands.push(sg.hybrid.part); }
482
+ }
479
483
  let rawCuts = alt.cuts !== undefined ? alt.cuts : fields.cuts.filter((c) => coveredSet.has(c.into) && coveredSet.has(c.from)).map((c) => ({ ...c, under: undefined }));
480
484
  let altLimbs: Record<string, Limb> = {};
481
485
  if (fields.limbs !== undefined) {
@@ -688,7 +692,7 @@ export function assembleStage(input: AssembleStageInput, outs: AssembleOutputs,
688
692
  altBuilt.push({
689
693
  record: {
690
694
  name: alt.name,
691
- ...(alt.parts === undefined ? {} : { parts: [...alt.parts] }),
695
+ ...(alt.parts === undefined ? {} : { parts: [...alt.parts, ...generatedBands.filter((n) => !(alt.parts as string[]).includes(n))] }),
692
696
  ...(alt.hides === undefined || alt.hides.length === 0 ? (altFront.size === 0 ? {} : { hides: [...altFront] }) : { hides: [...alt.hides, ...[...altFront].filter((p) => !(alt.hides as string[]).includes(p))] }),
693
697
  ...(altFront.size === 0 ? {} : { front: [...altFront] }),
694
698
  slots,
@@ -1588,6 +1592,11 @@ export interface CheckStageInput {
1588
1592
  * with the physics on is posed under; absent, no render argument and no byte of `check.json` moves.
1589
1593
  */
1590
1594
  environment?: string;
1595
+ /**
1596
+ * `check --wind-band <spec.json>` (issue #590): a `rig-parts-wind-band/1` steady-wind sweep specification;
1597
+ * absent, no sweep runs and no byte of `check.json` moves.
1598
+ */
1599
+ windBand?: string;
1591
1600
  }
1592
1601
 
1593
1602
  /**
@@ -1816,7 +1825,7 @@ export function checkStage(input: CheckStageInput, rigc: RigcRunner, bin: string
1816
1825
  const entryLine = versionLines.find((l) => l.startsWith('entry:'));
1817
1826
  log(` ${rigcIdentity(bin, v)}${entryLine === undefined ? '' : `; ${entryLine}`}`);
1818
1827
  const mode: PackMode = { pageEdges: input.pageEdges ?? DEFAULT_PAGE_EDGES, packShape: input.packShape ?? DEFAULT_PACK_SHAPE };
1819
- const r = runCheck(input.rig, input.out, rigc, input.parts, mode, input.source, input.requirements, input.seamPairs === true, input.keepStills === true, input.set, input.allSets === true, input.environment, input.requirementsAs, input.config);
1828
+ const r = runCheck(input.rig, input.out, rigc, input.parts, mode, input.source, input.requirements, input.seamPairs === true, input.keepStills === true, input.set, input.allSets === true, input.environment, input.requirementsAs, input.config, input.windBand);
1820
1829
  if (r.figures.environment !== undefined) log(` ${environmentLine(r.figures.environment)}`);
1821
1830
  log(` gate rig-play (rigc ${packedBuildLabel(mode)}), verbatim:`);
1822
1831
  for (const l of r.gateHtml) log(l);
@@ -1873,6 +1882,8 @@ export function checkStage(input: CheckStageInput, rigc: RigcRunner, bin: string
1873
1882
  }
1874
1883
  const vsSource = fig[SOURCE_LINE];
1875
1884
  if (vsSource !== undefined) log(` ${judgementLine(SOURCE_LINE, vsSource)}`);
1885
+ const windBand = fig[WIND_BAND_LINE];
1886
+ if (windBand !== undefined) for (const l of windBandLines(windBand)) log(` ${l}`);
1876
1887
  if (r.requirements !== null) {
1877
1888
  for (const [name, line] of Object.entries(r.requirements.lines)) log(` ${requirementText(name, line)}`);
1878
1889
  log(` ${summaryText(r.requirements.summary)}`);
@@ -2162,6 +2173,8 @@ export interface BuildInput {
2162
2173
  allSets?: boolean;
2163
2174
  /** `--environment <file>`, forwarded to the check as `check` takes it (issue #538): read before assemble runs, so a schedule check would refuse is refused first; absent, nothing moves. */
2164
2175
  environment?: string;
2176
+ /** `--wind-band <spec.json>`, forwarded to the check as `check` takes it (issue #590): read before assemble runs, so a spec check would refuse is refused first; absent, nothing moves. */
2177
+ windBand?: string;
2165
2178
  }
2166
2179
 
2167
2180
  /** What `build` does with one flag `check` takes: hands it to its check stage, takes it as its own, or refuses it because build supplies the value itself. */
@@ -2189,6 +2202,7 @@ export const CHECK_FLAGS_IN_BUILD: Readonly<Record<string, CheckFlagInBuild>> =
2189
2202
  '--seam-pairs': { as: 'forwarded' },
2190
2203
  '--keep-stills': { as: 'forwarded' },
2191
2204
  '--environment': { as: 'forwarded' },
2205
+ '--wind-band': { as: 'forwarded' },
2192
2206
  };
2193
2207
 
2194
2208
  /** The requirements file build's check reads (issue #556): `read` is where it is opened, `recorded` what `check.json` names it by. */
@@ -2333,6 +2347,8 @@ export function build(input: BuildInput, run: BuildRunners, log: Log): BuildResu
2333
2347
  if (req !== null) readRequirements(req.read);
2334
2348
  // And the schedule (issue #538), by rigc's own reader, as check reads it.
2335
2349
  if (input.environment !== undefined) readCheckEnvironment(input.environment);
2350
+ // And the steady-wind band spec (issue #590), as check reads it.
2351
+ if (input.windBand !== undefined) readWindBand(input.windBand);
2336
2352
  stages.assemble(
2337
2353
  { source: input.source, full: input.full, head: input.head, config: input.config, seam: input.seam, project: input.project, ...(input.alts === undefined ? {} : { alts: input.alts }) },
2338
2354
  { partsJson: join(out, 'parts.json'), partsDir: join(out, 'parts'), recomposite: join(out, 'recomposite_rig.png'), errorMap: join(out, ERROR_MAP_FILE) },
@@ -2350,7 +2366,7 @@ export function build(input: BuildInput, run: BuildRunners, log: Log): BuildResu
2350
2366
 
2351
2367
  let report: CheckReport;
2352
2368
  try {
2353
- report = stages.check({ rig: join(out, 'rig'), parts: out, out: join(out, 'check'), pageEdges: input.pageEdges, packShape: input.packShape, ...(req === null ? {} : { requirements: req.read, requirementsAs: req.recorded }), seamPairs: input.seamPairs === true, keepStills: input.keepStills === true, ...(input.set === undefined ? {} : { set: input.set }), allSets: input.allSets === true, ...(input.environment === undefined ? {} : { environment: input.environment }), ...(configRecord === null ? {} : { config: configRecord }) }, run.check, run.checkBin, prefixed('check'));
2369
+ report = stages.check({ rig: join(out, 'rig'), parts: out, out: join(out, 'check'), pageEdges: input.pageEdges, packShape: input.packShape, ...(req === null ? {} : { requirements: req.read, requirementsAs: req.recorded }), seamPairs: input.seamPairs === true, keepStills: input.keepStills === true, ...(input.set === undefined ? {} : { set: input.set }), allSets: input.allSets === true, ...(input.environment === undefined ? {} : { environment: input.environment }), ...(input.windBand === undefined ? {} : { windBand: input.windBand }), ...(configRecord === null ? {} : { config: configRecord }) }, run.check, run.checkBin, prefixed('check'));
2354
2370
  } catch (err) {
2355
2371
  return refused('check', err);
2356
2372
  }