The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Canvas and Cinema: a clean Idol splat's camera still is never a tile
Adarsh05d927102f89
diff --git a/src/components/canvas/canvas-context.tsx b/src/components/canvas/canvas-context.tsxindex fa441d80..af5e3a67 100644--- a/src/components/canvas/canvas-context.tsx+++ b/src/components/canvas/canvas-context.tsx@@ -18,6 +18,7 @@ import {} from "@/lib/catalog/canvas";import type { Engine, Generation, GenerationStatus, ModelDef, Operation, OutputFile } from "@/lib/catalog/types";import type { EngineMode } from "@/lib/api";+import { showableOutputs } from "@/lib/av/idol-camera-still";export { ICONS, NodeIcon } from "./node-icon";@@ -42,7 +43,7 @@ export interface NodeResults {progress: number | null;message: string | null;error: string | null;- /** Every output of the latest run, in order. */+ /** Every output of the latest run, in order, but a clean Idol splat's camera still (src/lib/av/idol-camera-still.ts). */outputs: { g: Generation; o: OutputFile; i: number }[];}@@ -61,7 +62,7 @@ export function foldResults(gens: Generation[], out?: string): NodeResults {progress: progress && progress > 0 ? progress : null,message: live[0]?.message ?? null,error: gens.find((g) => g.status === "failed")?.error ?? null,- outputs: gens.flatMap((g) => (g.status === "succeeded" && (!out || g.id === out) ? g.outputs.map((o, i) => ({ g, o, i })) : [])),+ outputs: gens.flatMap((g) => (g.status === "succeeded" && (!out || g.id === out) ? showableOutputs(g).map((i) => ({ g, o: g.outputs[i], i })) : [])),};}diff --git a/src/components/cinema/cinema-feed.tsx b/src/components/cinema/cinema-feed.tsxindex 378a0534..1d6a9022 100644--- a/src/components/cinema/cinema-feed.tsx+++ b/src/components/cinema/cinema-feed.tsx@@ -54,6 +54,7 @@ import { useSoulFinish } from "@/components/studio/soul-finish";import { Viewer } from "@/components/studio/viewer";import { PlaceholderChip } from "@/components/demo-mode";import { getModel } from "@/lib/catalog";+import { showableOutputs } from "@/lib/av/idol-camera-still";import type { CinemaFolder } from "@/lib/catalog/cinema";import type { Generation, OutputFile } from "@/lib/catalog/types";import { formatCost, timeAgo } from "@/lib/format";@@ -120,7 +121,7 @@ function usePrefs(): [Prefs, (p: Partial<Prefs>) => void] {}/** One tile: a pending/failed take, one output of a take, a tile cut from a grid sheet, or a 3D scene (shown by its still). */-interface Unit {+export interface Unit {key: string;g: CinemaGeneration;output?: OutputFile;@@ -131,7 +132,8 @@ interface Unit {const active = (g: Generation) => g.status === "queued" || g.status === "running";-function units(items: CinemaGeneration[]): Unit[] {+/** The feed's tiles, in order (exported for tests). */+export function units(items: CinemaGeneration[]): Unit[] {const out: Unit[] = [];for (const g of items) {if (g.status !== "succeeded") {@@ -146,8 +148,9 @@ function units(items: CinemaGeneration[]): Unit[] {}// Open-source grids return the sheet first, then its tiles.const sheetTiles = g.feature === "cinema-grid" && g.outputs.length > 1;- const outputs = sheetTiles ? g.outputs.slice(0, 1) : g.outputs;- outputs.forEach((o, i) => out.push({ key: `${g.id}:${i}`, g, output: o, index: i }));+ // Every output but a clean Idol splat's camera still (src/lib/av/idol-camera-still.ts).+ const shown = sheetTiles ? [0] : showableOutputs(g);+ shown.forEach((i) => out.push({ key: `${g.id}:${i}`, g, output: g.outputs[i], index: i }));const tiles = g.tiles?.length ? g.tiles.map((t) => ({ url: t.url, row: t.row, col: t.col })) : sheetTiles ? g.outputs.slice(1).map((o, i) => ({ url: o.url, row: -1, col: i })) : [];tiles.forEach((t, i) => out.push({ key: `${g.id}:t${i}`, g, output: { url: t.url, kind: "image" }, index: i, tile: { row: t.row, col: t.col } }));}diff --git a/src/lib/av/idol-camera-still.ts b/src/lib/av/idol-camera-still.tsindex 6e834fa9..a3d3c3a6 100644--- a/src/lib/av/idol-camera-still.ts+++ b/src/lib/av/idol-camera-still.ts@@ -7,7 +7,8 @@ import type { Generation, OutputFile } from "@/lib/catalog/types";* here can tell a good one from a collapsed one, so the still is never a result's cover, poster, tile or shown piece:* the orbit (its still, else its first frame) and the photo stand in. Every place that lists a result's outputs or picks* its picture asks here: the card (model3d.ts), the Library and feed Viewer and tiles (output-actions.ts modelPreview),- * share and Publish pages (output-actions.ts sharedOutputs), Assist's chat and project tiles.+ * share and Publish pages (output-actions.ts sharedOutputs), Assist's chat and project tiles, a Canvas node's results+ * (canvas-context.tsx foldResults) and a Cinema project's tiles (cinema-feed.tsx units).*//** Whether a splat came from the clean graph: its saved file says it was pruned (the core graph's says it wasn't). */diff --git a/tests/idol-camera-still.test.ts b/tests/idol-camera-still.test.tsindex 98c15025..e110938d 100644--- a/tests/idol-camera-still.test.ts+++ b/tests/idol-camera-still.test.ts@@ -176,6 +176,37 @@ describe("Assist: the chat's and the project's tiles", () => {});});+describe("Canvas and Cinema tiles", () => {+ it.each(both)("a Canvas node that ran the %s splat tiles the splat and its orbit, never the camera still", async (_, r) => {+ const { foldResultsKeep } = await import("@/components/canvas/canvas-context");+ const res = foldResultsKeep(undefined, [full(r)]);+ // The node's tiles, its Viewer's arrows and "Use result as an input" all read these.+ expect(res.outputs.map((x) => x.i)).toEqual([0, 1]);+ expect(res.outputs.map((x) => x.o.url)).not.toContain(byRole(r, "preview").url);+ expect(res.outputs.find((x) => ["image", "video", "audio"].includes(x.o.kind))?.o.url).toBe(byRole(r, "turntable").url);+ });++ it.each(both)("a Cinema project holding the %s splat tiles the splat and its orbit, at their own indexes", async (_, r) => {+ const { units } = await import("@/components/cinema/cinema-feed");+ const tiles = units([{ ...full(r), folderId: null, projectId: "p" } as never]);+ expect(tiles.map((u) => u.index)).toEqual([0, 1]);+ expect(tiles.map((u) => u.output?.url)).toEqual([r.outputs[0].url, byRole(r, "turntable").url]);+ });++ it("any other result keeps every tile (a picture run's takes, a grid's sheet)", async () => {+ const { foldResultsKeep } = await import("@/components/canvas/canvas-context");+ const { units } = await import("@/components/cinema/cinema-feed");+ const takes = { ...full(runs.stiletto), kind: "image", op: "t2i", outputs: [{ url: "/api/files/1.png", kind: "image", meta: { role: "preview" } }, { url: "/api/files/2.png", kind: "image" }] } as Generation;+ expect(foldResultsKeep(undefined, [takes]).outputs.map((x) => x.i)).toEqual([0, 1]);+ expect(units([{ ...takes, folderId: null, projectId: "p" } as never]).map((u) => u.index)).toEqual([0, 1]);+ const grid = { ...takes, feature: "cinema-grid" };+ expect(units([{ ...grid, folderId: null, projectId: "p" } as never]).map((u) => [u.index, !!u.tile])).toEqual([+ [0, false],+ [0, true],+ ]);+ });+});+describe("the result card and its next steps", () => {it("a clean splat with no orbit: the photo, never the camera still", async () => {const r = runs.stiletto;