@rig-c/pose 0.31.1 → 0.33.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/rigc.ts CHANGED
@@ -231,6 +231,24 @@ export function folds(build: string, animation: string, dir: string, fps: number
231
231
  };
232
232
  }
233
233
 
234
+ /**
235
+ * `rigc render --seam <a>:<b>,…` over one animation (rig-c/pose#216): its own
236
+ * render, apart from the folds' so a seam refusal cannot cost the fold reading
237
+ * and the fold render's arguments stay what they were. `seam` is the set's
238
+ * `seam.json` text, null when the render did not run green; `frames` is its
239
+ * `frames.json`, for the render domain.
240
+ */
241
+ export function seamRender(build: string, animation: string, dir: string, fps: number, pairs: ReadonlyArray<readonly [string, string]>): { run: RigcRun; seam: { text: string; path: string } | null; frames: unknown } {
242
+ const out = join(dir, 'render');
243
+ const run = runRigc(['render', '--candidate', build, '--animation', animation, '--seam', pairs.map(([a, b]) => `${a}:${b}`).join(','), '--fps', String(fps), '--out', out]);
244
+ if (run.status !== 0 || !existsSync(join(out, 'frames.json'))) return { run, seam: null, frames: null };
245
+ const framesDoc = JSON.parse(readFileSync(join(out, 'frames.json'), 'utf8')) as { sets: Array<{ dir: string; animation: string }> };
246
+ const set = framesDoc.sets.find((s) => s.animation === animation);
247
+ const path = set === undefined ? null : join(resolve(out), set.dir, 'seam.json');
248
+ if (path === null || !existsSync(path)) return { run, seam: null, frames: framesDoc };
249
+ return { run, seam: { text: readFileSync(path, 'utf8'), path }, frames: framesDoc };
250
+ }
251
+
234
252
  /** rig-c's version and the entry its launcher picked (`rigc --version`), so a run names the compiler that gated it. */
235
253
  export function rigcVersion(): { version: string; entry: string } {
236
254
  const r = runRigc(['--version']);