@rig-c/parts 2.47.1 → 2.49.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/takeregion.ts CHANGED
@@ -121,12 +121,14 @@ export function deriveTakenRegion(base: Layer, donor: Layer, painting: Raster, s
121
121
  export function applyTakenRegions(runs: Runs, painting: Raster, cfg: Pick<AssembleConfig, 'depth'> & {
122
122
  seethrough: Pick<AssembleConfig['seethrough'], 'head_box'> | undefined;
123
123
  assemble: Pick<AssembleConfig['assemble'], 'take' | 'plan'>;
124
- }, configPath: string, setup: SetupPainting | undefined, receipts: ReceiptLedger, sourcePath?: string): Runs {
124
+ }, configPath: string, setup: SetupPainting | undefined, receipts: ReceiptLedger, sourcePath?: string, requirementsPath?: string): Runs {
125
125
  const declarations = (cfg.assemble.take ?? []).filter((item): item is TakeRegion => 'seed' in item);
126
126
  if (declarations.length === 0) return runs;
127
127
  const tolerance = setup?.rgb_tolerance;
128
128
  if (typeof tolerance !== 'number' || !Number.isSafeInteger(tolerance) || tolerance < 0 || tolerance > 255) {
129
- return refuse('ASSEMBLE_REGION_TAKE_TOLERANCE', 'config.assemble.take', 'a region take requires --requirements declaring setup_painting.rgb_tolerance, the same authored integer check reads; no default is supplied');
129
+ return refuse('ASSEMBLE_REGION_TAKE_TOLERANCE', 'config.assemble.take', requirementsPath === undefined
130
+ ? 'no requirements file is given: config.requirements is absent and --requirements was not passed; a region take requires setup_painting.rgb_tolerance, an authored integer 0-255 that check reads too, with no default — name a requirements file in config.requirements and declare setup_painting.rgb_tolerance there'
131
+ : `${requirementsPath} declares no setup_painting.rgb_tolerance; a region take requires that authored integer 0-255, the one check reads too, with no default — declare it under setup_painting in that file, the one config.requirements names`);
130
132
  }
131
133
  if (cfg.depth !== undefined || [...runs.full.layers, ...runs.head.layers].some(layer => layer.depthSheet !== undefined)) {
132
134
  return refuse('ASSEMBLE_REGION_TAKE_BINDING', 'config.assemble.take', 'active scalar depth sheets have no region donor binding; a run without active scalar depth is required');