The VS Code of video editing, built for agents.
TypeScript
Enhance node capture logic to validate timeline clocks and improve error handling
konstantin-paulusaa0162b1f17e
diff --git a/apps/web/src/components/engine/encode/image-encoder.ts b/apps/web/src/components/engine/encode/image-encoder.tsindex 4e78815e..27ca04c7 100644--- a/apps/web/src/components/engine/encode/image-encoder.ts+++ b/apps/web/src/components/engine/encode/image-encoder.ts@@ -107,7 +107,7 @@ export async function createImageEncoder(sourceWorld: EngineWorld, config: Imageconst startFrame = c.Computed.start[rootEid] ?? 0;// Entities in the clone that own a timeline clock- const clockEids = clonedEids.filter(eid => hasComponent(world, eid, c.Playback));+ const clockEids = [...query(world, [c.Playback, Not(c.Deleted)])];const seek = (frame: number) => {const stageFrame = startFrame + frame;diff --git a/apps/web/src/context/editor-api/node.ts b/apps/web/src/context/editor-api/node.tsindex 682a433f..e30c0b2d 100644--- a/apps/web/src/context/editor-api/node.ts+++ b/apps/web/src/context/editor-api/node.ts@@ -13,6 +13,7 @@ import {deleteEntity,isText,isScene,+ getSceneAncestor,getEntityTree,cloneSubtree,serializeEntity,@@ -294,6 +295,14 @@ export function handleNodeCapture(engine: Accessor<Engine>) {const eid = resolveNodeEid(w, id);+ if (!hasComponent(w, eid, w.components.Playback)) {+ const scene = getSceneAncestor(w, eid);+ const hint = scene !== null ? ` Capture its scene (id ${scene}) instead.` : "";+ throw new Error(+ `Node ${id} has no timeline clock and cannot be captured on its own.${hint}`,+ );+ }+// `undefined` means the node's first visible frame (the encoder's frame 0).let shots = frames;if (shots === undefined || shots.length === 0) {