framefields 2.9.0 → 2.9.2

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.
Files changed (41) hide show
  1. package/dist/cli/check-worker.mjs +2 -2
  2. package/dist/components/index.d.mts +2 -2
  3. package/dist/components/index.mjs +2 -2
  4. package/dist/effects/index.d.mts +1 -1
  5. package/dist/effects/index.mjs +1 -1
  6. package/dist/{index-CZjrnylh.d.mts → index-Bnh42ouE.d.mts} +657 -636
  7. package/dist/index-Bnh42ouE.d.mts.map +1 -0
  8. package/dist/index-CFoAmh7q.d.mts.map +1 -1
  9. package/dist/{index-Du5YgdzM.d.mts → index-CQ-bbZk3.d.mts} +16 -3
  10. package/dist/index-CQ-bbZk3.d.mts.map +1 -0
  11. package/dist/index.d.mts +2 -2
  12. package/dist/index.mjs +4 -4
  13. package/dist/preview/index.mjs +1 -1
  14. package/dist/{preview-BQVgn6Ho.mjs → preview-DvP8AZuV.mjs} +2 -2
  15. package/dist/{preview-BQVgn6Ho.mjs.map → preview-DvP8AZuV.mjs.map} +1 -1
  16. package/dist/preview-engine/{chunk-GEUUXTDL.mjs → chunk-D73ZKPFN.mjs} +4 -4
  17. package/dist/preview-engine/{chunk-UQKPDGEH.mjs → chunk-EJJITH6U.mjs} +1 -1
  18. package/dist/preview-engine/{chunk-374QY63R.mjs → chunk-KXLXP66K.mjs} +3 -3
  19. package/dist/preview-engine/chunk-XYGDTPO7.mjs +39 -0
  20. package/dist/preview-engine/components.mjs +1 -1
  21. package/dist/preview-engine/effects.mjs +1 -1
  22. package/dist/preview-engine/framefields.mjs +1 -1
  23. package/dist/preview-engine/player.mjs +1 -1
  24. package/dist/preview-engine/{renderers-O55BEDQZ.mjs → renderers-MDHPQY6D.mjs} +1 -1
  25. package/dist/preview-engine/src-4IUYUKIZ.mjs +8 -0
  26. package/dist/renderer/index.mjs +1 -1
  27. package/dist/{renderer-B0piZg9r.mjs → renderer-B2P1vgb7.mjs} +41 -22
  28. package/dist/renderer-B2P1vgb7.mjs.map +1 -0
  29. package/dist/renderer-D5bjOx83.mjs +3 -0
  30. package/dist/{renderer-DsEyjwfT.mjs → renderer-DPAD6fL1.mjs} +2 -2
  31. package/dist/{renderer-DsEyjwfT.mjs.map → renderer-DPAD6fL1.mjs.map} +1 -1
  32. package/dist/{src-CK5rGVbh.mjs → src-DFEqficI.mjs} +72 -24
  33. package/dist/src-DFEqficI.mjs.map +1 -0
  34. package/package.json +59 -59
  35. package/dist/index-CZjrnylh.d.mts.map +0 -1
  36. package/dist/index-Du5YgdzM.d.mts.map +0 -1
  37. package/dist/preview-engine/chunk-CCB3VTY2.mjs +0 -39
  38. package/dist/preview-engine/src-NGVAJYHC.mjs +0 -8
  39. package/dist/renderer-B0piZg9r.mjs.map +0 -1
  40. package/dist/renderer-COR66Sby.mjs +0 -3
  41. package/dist/src-CK5rGVbh.mjs.map +0 -1
@@ -3,10 +3,10 @@ import { F as getPrimitiveGeometry, K as mediaDecoderCache, N as generateExtrude
3
3
  import { a as preflightMediaTime, n as decodeAudioSource } from "./dist-C8Xq3zgx.mjs";
4
4
  import { t as FontManager } from "./fonts-BW0pPcvJ.mjs";
5
5
  import { s as TensorPipeline } from "./dist-Buaaj-Ul.mjs";
6
- import { _ as pinNodeToObject, a as COCO17_KEYPOINT_NAMES, d as VisionNode, f as VisionRunner, g as pinNodeToLandmark, h as mergeSubjectMask, m as maskObject, n as CLIP_SUBJECT, p as analyzeSequence, u as VisionBundle } from "./renderer-B0piZg9r.mjs";
6
+ import { _ as pinNodeToObject, a as COCO17_KEYPOINT_NAMES, d as VisionNode, f as VisionRunner, g as pinNodeToLandmark, h as mergeSubjectMask, m as maskObject, n as CLIP_SUBJECT, p as analyzeSequence, u as VisionBundle } from "./renderer-B2P1vgb7.mjs";
7
7
  import { G as mediaSignalSampler, K as mergeAnimationTracks, N as collectNodeOps, P as compositorToProgram, W as lintComposition, f as LayerAnimation, q as sampleMediaTimeSignal } from "./program-CKpKkllV.mjs";
8
8
  import { C as effectFactories, H as Dither, I as ColorBalance, K as Iridescence, L as ColorKey, M as CRT, R as Contour, S as Vision, T as Ascii, Y as LayerStyle, _ as SelectiveColor, a as CustomEffect, at as Posterize, b as TileOffset, c as GradientMap, d as Levels, et as OpArt, f as Modulate, g as SSAO, h as Relight3D, ht as Vignette, i as Curves, it as Pixelate, l as HalftoneScreen, m as PBRGlass, nt as Painterly, o as DepthOfField, ot as ProceduralVFX, p as MotionBlur, pt as Toon, q as Kaleidoscope, r as Crop, s as FilmGrain, st as RGBSplit, t as ApplyLUT, u as HighPass, v as ShadowsHighlights, w as Blur, x as UnsharpMask, y as TemporalDeflicker } from "./effects-CemgqEPv.mjs";
9
- import { a as HeadlessMediaRenderer, n as renderFrameGrid } from "./renderer-DsEyjwfT.mjs";
9
+ import { a as HeadlessMediaRenderer, n as renderFrameGrid } from "./renderer-DPAD6fL1.mjs";
10
10
  import { z, z as z$2 } from "zod";
11
11
  import path from "node:path";
12
12
  import fs from "node:fs/promises";
@@ -1526,9 +1526,8 @@ var ClipVision = class {
1526
1526
  * subjects kept, null when it holds no subject.
1527
1527
  */
1528
1528
  subject(frame, fps) {
1529
- const c = frame * this.fps / fps;
1530
- if (!this.exact && !this.options.timeRemap && Math.abs(c - Math.round(c)) > 1e-6) return void 0;
1531
- const sourceFrame = this.options.timeRemap || this.exact ? Math.floor(c + 1e-6) : Math.round(c);
1529
+ const sourceFrame = this.sourceFrame(frame, fps);
1530
+ if (sourceFrame === void 0) return void 0;
1532
1531
  const s = this.subjects.get(sourceFrame);
1533
1532
  if (s === void 0) return s;
1534
1533
  if (s === null || !this.sourceWidth) return null;
@@ -1544,6 +1543,45 @@ var ClipVision = class {
1544
1543
  detectionIndex: -1
1545
1544
  };
1546
1545
  }
1546
+ /**
1547
+ * @internal The pose matched to the subject at a source frame of the clip
1548
+ * (`frame` at `fps`), normalized to the source size, for a render-time
1549
+ * skeleton: undefined until that frame and its smoothing window are
1550
+ * analysed, null when no pose matched there.
1551
+ */
1552
+ pose(frame, fps) {
1553
+ const c = this.sourceFrame(frame, fps);
1554
+ if (c === void 0 || !this.tracksPose || !this.sourceWidth) return;
1555
+ for (let g = c - this.smoothing; g <= c + this.smoothing; g++) if (!this.results.has(Math.max(0, g))) return void 0;
1556
+ if (!this.results.get(c)?.kp) return null;
1557
+ const width = this.sourceWidth;
1558
+ const height = this.sourceHeight;
1559
+ return {
1560
+ width,
1561
+ height,
1562
+ keypoints: Array.from({ length: 17 }, (_, k) => {
1563
+ const [x, y, visibility] = this.keypoint(k, c);
1564
+ return {
1565
+ x: x / width,
1566
+ y: y / height,
1567
+ visibility
1568
+ };
1569
+ })
1570
+ };
1571
+ }
1572
+ /** Whether frames carry keypoints: on by default, opt-in for prompted (SAM) clips. */
1573
+ get tracksPose() {
1574
+ return this.exact ? this.options.pose === true : this.options.pose ?? true;
1575
+ }
1576
+ /**
1577
+ * The analysed source frame a render-time read at `frame` (at `fps`) maps to;
1578
+ * undefined for an unprompted clip read between its analysed frames.
1579
+ */
1580
+ sourceFrame(frame, fps) {
1581
+ const c = frame * this.fps / fps;
1582
+ if (!this.exact && !this.options.timeRemap && Math.abs(c - Math.round(c)) > 1e-6) return void 0;
1583
+ return this.options.timeRemap || this.exact ? Math.floor(c + 1e-6) : Math.round(c);
1584
+ }
1547
1585
  /** Composition frame → clip frame (fractional). */
1548
1586
  clipFrame(frame) {
1549
1587
  if (this.options.timeRemap) return mediaSourceTime(this.options.timeRemap, this.localFrame(frame), this.compositionFps) * this.fps;
@@ -1590,7 +1628,7 @@ var ClipVision = class {
1590
1628
  await this.computeSam3(to);
1591
1629
  return;
1592
1630
  }
1593
- const wantPose = this.options.pose ?? true;
1631
+ const wantPose = this.tracksPose;
1594
1632
  const wantMask = this.options.mask ?? true;
1595
1633
  this.runner ??= VisionRunner.create({
1596
1634
  modelsDir: this.options.modelsDir,
@@ -1685,7 +1723,7 @@ var ClipVision = class {
1685
1723
  if (!this.sourceWidth) this.setSize(image.width, image.height);
1686
1724
  const prompt = settings.prompts.find((item) => item.frame === frame);
1687
1725
  const result$1 = await this.sam2Tracker.process(image, frame, prompt?.points);
1688
- const kp = this.options.pose ? await this.matchedPose(image, result$1.mask) : null;
1726
+ const kp = this.tracksPose ? await this.matchedPose(image, result$1.mask) : null;
1689
1727
  this.storeSamFrame(frame, result$1.width, result$1.height, [result$1], kp);
1690
1728
  if (this.unsaved >= 24) {
1691
1729
  await this.saveCache();
@@ -1720,6 +1758,7 @@ var ClipVision = class {
1720
1758
  textThreshold: settings.textThreshold,
1721
1759
  maxObjects: settings.maxObjects,
1722
1760
  merge: settings.merge,
1761
+ redetect: settings.redetect,
1723
1762
  precision: settings.precision,
1724
1763
  acceptLicense: this.options.acceptSamLicense ?? this.options.sam3?.acceptLicense
1725
1764
  });
@@ -1731,7 +1770,7 @@ var ClipVision = class {
1731
1770
  if (!this.sourceWidth) this.setSize(image.width, image.height);
1732
1771
  const prompt = settings.prompts.find((item) => item.frame === frame);
1733
1772
  const result$1 = await this.sam3Tracker.process(image, frame, prompt);
1734
- const kp = this.options.pose ? await this.matchedPose(image, unionMask(result$1.objects, image)) : null;
1773
+ const kp = this.tracksPose ? await this.matchedPose(image, unionMask(result$1.objects, image)) : null;
1735
1774
  this.storeSamFrame(frame, result$1.width, result$1.height, result$1.objects, kp);
1736
1775
  if (this.unsaved >= 24) {
1737
1776
  await this.saveCache();
@@ -1966,7 +2005,7 @@ var ClipVision = class {
1966
2005
  stat.size,
1967
2006
  stat.mtimeMs,
1968
2007
  this.fps,
1969
- o.pose ?? true,
2008
+ this.tracksPose,
1970
2009
  o.mask ?? true,
1971
2010
  this.cell,
1972
2011
  o.variant ?? "s",
@@ -1974,12 +2013,12 @@ var ClipVision = class {
1974
2013
  ...o.sam2 ? [[
1975
2014
  sam?.sam2Revision(o.sam2.model),
1976
2015
  o.sam2,
1977
- 2
2016
+ 3
1978
2017
  ]] : [],
1979
2018
  ...o.sam3 && sam ? [[
1980
2019
  sam.sam3Revision(await sam.sam3Precision(void 0, o.sam3.precision)),
1981
2020
  o.sam3,
1982
- 2
2021
+ 3
1983
2022
  ]] : []
1984
2023
  ]);
1985
2024
  const hash = crypto.createHash("sha256").update(key).digest("hex").slice(0, 24);
@@ -8561,16 +8600,17 @@ var Composition = class Composition {
8561
8600
  * frame — physics, particles — always find every frame before it.
8562
8601
  */
8563
8602
  async prepareVision(frame) {
8564
- this.linkClipMattes();
8603
+ this.linkClipLayers();
8565
8604
  await Promise.all([...this._clipVision.values()].map((clip) => clip.ready(0, frame)));
8566
8605
  }
8567
8606
  /**
8568
- * Points matte-family `withVision` layers at the `comp.vision` clip they
8569
- * show, so the cutout reuses that clip's per-frame subject instead of
8570
- * segmenting the frame again during render. Only layers whose settings
8571
- * would give the same subject are linked; the rest keep their own pass.
8607
+ * Points matte-family and skeleton `withVision` layers at the `comp.vision`
8608
+ * clip they show, so the cutout reuses that clip's per-frame subject and the
8609
+ * skeleton draws its matched pose, instead of analysing the frame again
8610
+ * during render. Only layers whose settings would give the same subject are
8611
+ * linked; the rest keep their own pass.
8572
8612
  */
8573
- linkClipMattes() {
8613
+ linkClipLayers() {
8574
8614
  if (this._clipVision.size === 0) return;
8575
8615
  let layers;
8576
8616
  const walk = (node) => {
@@ -8582,13 +8622,13 @@ var Composition = class Composition {
8582
8622
  return [op.id, op];
8583
8623
  }));
8584
8624
  const layer = layers.get(n.id);
8585
- const clip = this.clipForMatte(n.src ?? n.inputHandleId, n.vision, {
8625
+ const clip = this.clipForLayer(n.src ?? n.inputHandleId, n.vision, {
8586
8626
  trimStartSec: n.trimStartSec,
8587
8627
  startFrame: layer?.startFrame ?? n.startFrame,
8588
8628
  timeRemap: layer?.timeRemap
8589
8629
  });
8590
8630
  if (clip) {
8591
- clip.keepSubjects();
8631
+ if (n.vision.mode !== "skeleton") clip.keepSubjects();
8592
8632
  Object.defineProperty(n.vision, CLIP_SUBJECT, {
8593
8633
  value: clip,
8594
8634
  enumerable: false,
@@ -8600,13 +8640,21 @@ var Composition = class Composition {
8600
8640
  };
8601
8641
  for (const child of this.children) walk(child);
8602
8642
  }
8603
- clipForMatte(source, v, layer) {
8643
+ /** The `comp.vision` clip a matte or skeleton layer of the same source reads instead of analysing. */
8644
+ clipForLayer(source, v, layer) {
8604
8645
  const mode = v.mode ?? "passthrough";
8605
- if (mode !== "matte" && mode !== "mask" && mode !== "crop") return;
8606
- if (v.matteSource === "selfie" || v.keyBackground === true || v.classes !== void 0 || v.enablePose === true || v.enableMatte === true || v.visionBundle !== void 0 || (v.maskThreshold ?? .5) !== .5 || v.featherRadius !== void 0) return;
8646
+ const skeleton = mode === "skeleton";
8647
+ if (mode !== "matte" && mode !== "mask" && mode !== "crop" && !skeleton) return;
8648
+ if (v.classes !== void 0 || v.enableMatte === true || v.visionBundle !== void 0 || !skeleton && (v.matteSource === "selfie" || v.keyBackground === true || v.enablePose === true || (v.maskThreshold ?? .5) !== .5 || v.featherRadius !== void 0)) return;
8607
8649
  for (const clip of this._clipVision.values()) {
8608
8650
  const o = clip.options;
8609
- if (clip.source === source && clip.startFrame === (layer.startFrame ?? 0) && clip.trimStartSec === (layer.trimStartSec ?? 0) && remapKey(o.timeRemap) === remapKey(layer.timeRemap) && (o.variant ?? "s") === (v.variant ?? "s") && (o.confidence ?? .3) === (v.confidence ?? .3)) return clip;
8651
+ if (clip.source === source && clip.startFrame === (layer.startFrame ?? 0) && clip.trimStartSec === (layer.trimStartSec ?? 0) && remapKey(o.timeRemap) === remapKey(layer.timeRemap) && (o.variant ?? "s") === (v.variant ?? "s") && (o.confidence ?? .3) === (v.confidence ?? .3)) {
8652
+ if (skeleton && !clip.tracksPose) {
8653
+ if (clip.exact) throw new Error("A skeleton layer of a prompted comp.vision clip needs `pose: true` on that clip.");
8654
+ continue;
8655
+ }
8656
+ return clip;
8657
+ }
8610
8658
  }
8611
8659
  }
8612
8660
  /**
@@ -9819,4 +9867,4 @@ const Effect = Object.assign(Effect$1, effectFactories, {
9819
9867
 
9820
9868
  //#endregion
9821
9869
  export { glyphAnimator as $, wordRanges as $t, boilKeys as A, squigglePath as At, defineTheme as B, themes as Bt, audioLevelsSchema as C, span as Cn, scaleFrames as Ct, basePropsSchema as D, FRAMEFIELDS_AI_PROXY_URL as Dn, springKeys as Dt, bandEdges as E, ApiError as En, springAt as Et, constantExpression as F, surfaceFill as Ft, elevationStyle as G, transparent as Gt, drawOnKeys as H, toPathData as Ht, contrastRatio as I, targetPoint as It, evaluateEase as J, windowExpression as Jt, ellipsePath as K, typingFrames as Kt, cover as L, targetSchema as Lt, boxPath as M, staggerRanks as Mt, catmullRom as N, stepExpression as Nt, beats as O, ValidationError as On, springSettleFrames as Ot, chain as P, supersede as Pt, frameSpan as Q, wobblePoints as Qt, defineComponent as R, textLayout as Rt, ascending as S, size as Sn, safeArea as St, bakeSamples as T, sup as Tn, smoothRelease as Tt, ease as U, toSeconds as Ut, dist as V, toFrames as Vt, elevate as W, transformPathData as Wt, exitAnimation as X, withDefaults as Xt, evaluateGlyphExpression as Y, withAlpha as Yt, findRange as Z, within as Zt, after as _, italic as _n, resampleBands as _t, Media as a, PhysicsWorld2D as an, last as at, arcPath as b, parseMarkup as bn, rng as bt, section as c, Layer3D as cn, lineShift as ct, analyzeAudio as d, PersonTrack as dn, offsetCues as dt, Styles as en, hashRng as et, KeyBook as f, DEFAULT_CHART_COLORS as fn, parseColor as ft, UNIT_INDEX as g, color as gn, rendererChars as gt, Track as h, code as hn, rangeRects as ht, Light as i, PhysicsBody2D as in, isLight as it, boundsOf as j, staggerOffsets as jt, bind as k, ai as kn, springTrack as kt, bindComponent as l, Particles as ln, luminance as lt, SAFE_INSETS as m, bold as mn, quantize as mt, Effect as n, PhysicsBody3D as nn, holdFirstKeys as nt, blurRegion as o, Lighting as on, lerp2 as ot, MOTION_PRESETS as p, accent as pn, pulseKeys as pt, enterAnimation as q, valueAt as qt, Layer as r, PhysicsWorld3D as rn, inkOn as rt, editTrackedRegion as s, Transition as sn, linePath as st, Composition as t, Physics as tn, hashString as tt, z$2 as u, ClipVision as un, mix as ut, analyzeChannels as v, mark as vn, resolveMotion as vt, bakeFunction as w, sub as wn, scheduleExpression as wt, arrowPaths as x, rich as xn, round as xt, anchorPoint as y, normalizeTextSpans as yn, resolveTarget as yt, defineMeta as z, themeFrames as zt };
9822
- //# sourceMappingURL=src-CK5rGVbh.mjs.map
9870
+ //# sourceMappingURL=src-DFEqficI.mjs.map