Skip to content

armgit / fuobe

Public Imported from GitHub
0

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.

Cinema Studio: "Don't ask again" holds for one price and can be undone

Claudec63037438e79
diff --git a/src/components/cinema/cinema-feed.tsx b/src/components/cinema/cinema-feed.tsx
index 6d11b3a0..4732b062 100644
--- a/src/components/cinema/cinema-feed.tsx
+++ b/src/components/cinema/cinema-feed.tsx
@@ -474,7 +474,7 @@ function TileView({
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
- <button type="button" onClick={() => handlers.onCreateScene(g, u.output!.url)} className="grid size-7 place-items-center rounded-lg text-white/90 hover:bg-white/20 hover:text-white" aria-label="Create 3D scene">
+ <button type="button" onClick={() => handlers.onCreateScene(g, u.output!.url)} className="grid size-7 place-items-center rounded-lg text-white/90 hover:bg-white/20 hover:text-white" aria-label={`Create 3D scene · ${handlers.scenePrice}`}>
<Box className="size-4" />
</button>
</TooltipTrigger>
diff --git a/src/components/cinema/scene-actions.tsx b/src/components/cinema/scene-actions.tsx
index fd388a1f..860b4e17 100644
--- a/src/components/cinema/scene-actions.tsx
+++ b/src/components/cinema/scene-actions.tsx
@@ -51,14 +51,24 @@ export function usePlanPrice(plan: CinemaPlan): { cost: number | null; label: st
const SKIP_KEY = "fuobe.cinema.sceneConfirm";
-export function skipSceneConfirm(): boolean {
+/**
+ * "Don't ask again" holds for the price it was ticked at (kept in this browser): another price (a different engine,
+ * a key added, demo mode off) asks again, and the toast of a build that didn't ask offers "Ask first".
+ */
+export function skipSceneConfirm(price: string): boolean {
try {
- return localStorage.getItem(SKIP_KEY) === "skip";
+ return localStorage.getItem(SKIP_KEY) === `skip:${price}`;
} catch {
return false;
}
}
+export function askSceneConfirmAgain() {
+ try {
+ localStorage.removeItem(SKIP_KEY);
+ } catch {}
+}
+
export interface ScenePlanContext {
engine: Engine;
settings: DirectorSettings;
@@ -118,7 +128,7 @@ export function SceneCreateDialog({
{!open && <p className="text-[12px] text-muted-foreground">Each re-render of a captured view is priced again before it runs.</p>}
</div>
<label htmlFor={skipId} className="flex items-center gap-2 text-[13px] text-muted-foreground">
- <Checkbox id={skipId} checked={skip} onCheckedChange={(v) => setSkip(v === true)} /> Don&apos;t ask again
+ <Checkbox id={skipId} checked={skip} onCheckedChange={(v) => setSkip(v === true)} /> Don&apos;t ask again at this price
</label>
<DialogFooter>
<Button variant="ghost" onClick={() => onOpenChange(false)}>
@@ -129,7 +139,7 @@ export function SceneCreateDialog({
onClick={() => {
if (skip)
try {
- localStorage.setItem(SKIP_KEY, "skip");
+ localStorage.setItem(SKIP_KEY, `skip:${price.label}`);
} catch {}
onConfirm();
}}
diff --git a/src/components/cinema/workspace.tsx b/src/components/cinema/workspace.tsx
index ab661f18..a52d426a 100644
--- a/src/components/cinema/workspace.tsx
+++ b/src/components/cinema/workspace.tsx
@@ -30,7 +30,7 @@ import { foreign, useAutosave, useCinemaGenerate, useCinemaItems, useCinemaProje
import { cutGrid } from "./media";
import { ProjectDialog } from "./project-settings";
import { PromptBar, useAddRefs } from "./prompt-bar";
-import { SceneCreateDialog, sceneTake, skipSceneConfirm, usePlanPrice, useScenePlan, type SceneTake } from "./scene-actions";
+import { SceneCreateDialog, askSceneConfirmAgain, sceneTake, skipSceneConfirm, usePlanPrice, useScenePlan, type SceneTake } from "./scene-actions";
import { SidePanel } from "./side-panel";
import { SoulCastDialog, SoulLocationDialog } from "./soul-builders";
@@ -214,7 +214,8 @@ function Workspace({ data, items, loading }: { data: ProjectView; items: CinemaG
const scenePrice = usePlanPrice(useScenePlan(ANY_STILL, undefined, sceneCtx)).label;
const scenePlan = useScenePlan(sceneFrom?.url ?? null, sceneFrom?.g.request.params?.aspectRatio, sceneCtx);
const building = useRef(new Set<string>());
- const createScene = (g: CinemaGeneration, url: string) => {
+ /** `asked` = false when "Don't ask again" skipped the dialog: the toast then names the price and can undo that. */
+ const createScene = (g: CinemaGeneration, url: string, asked = true) => {
setSceneFrom(null);
generate.mutate(
{
@@ -224,7 +225,11 @@ function Workspace({ data, items, loading }: { data: ProjectView; items: CinemaG
{
onSuccess: (r) => {
r.items.forEach((x) => building.current.add(x.id));
- toast(engine === "open" ? "Building the 3D scene on your ComfyUI…" : "Building the 3D scene…", { description: "It appears next to the still; you'll get a note when it's ready.", duration: 3000 });
+ toast(engine === "open" ? "Building the 3D scene on your ComfyUI…" : "Building the 3D scene…", {
+ description: `${asked ? "" : `${scenePrice} · `}It appears next to the still; you'll get a note when it's ready.`,
+ duration: asked ? 3000 : 6000,
+ ...(asked ? {} : { action: { label: "Ask first", onClick: askSceneConfirmAgain } }),
+ });
},
onError: (e) => toast.error((e as Error).message),
},
@@ -300,7 +305,7 @@ function Workspace({ data, items, loading }: { data: ProjectView; items: CinemaG
onError: (e) => toast.error((e as Error).message),
},
),
- onCreateScene: (g, url) => (skipSceneConfirm() ? createScene(g, url) : setSceneFrom({ g, url })),
+ onCreateScene: (g, url) => (skipSceneConfirm(scenePrice) ? createScene(g, url, false) : setSceneFrom({ g, url })),
onOpenScene: (g) => {
const t = sceneTake(g);
if (t) setOpenScene(t);
diff --git a/tests/e2e/cinema-scene.mjs b/tests/e2e/cinema-scene.mjs
index d4f55f55..b2d3fc67 100644
--- a/tests/e2e/cinema-scene.mjs
+++ b/tests/e2e/cinema-scene.mjs
@@ -1,9 +1,10 @@
// Cinema Studio's 3D scene in a real browser (the app must be running in demo mode; WebGL runs on SwiftShader).
// Usage: node tests/e2e/cinema-scene.mjs [appUrl] [--shots=dir]. Exits 1 on the first failure.
//
-// 1. Cloud: "Create 3D scene" on a still asks first with the price, builds the demo depth map, and the viewer
-// opens it as a point cloud; W A S D and the arrows move the view; Capture uploads the frame as a PNG in the
-// frame's ratio and queues a recomposition with the capture as image 1 and the still as image 2.
+// 1. Cloud: "Create 3D scene" on a still asks first with the price, builds the demo depth map (painted with the
+// Spectral colour map, as Marigold's), and the viewer opens it as a point cloud; W A S D and the arrows move the
+// view; Capture uploads the frame as a PNG in the frame's ratio and queues a recomposition with the capture as
+// image 1 and the still as image 2. "Don't ask again" skips the question at that price until the toast's "Ask first".
// 2. Open engine: the scene is MoGe's mesh (the demo GLB here) and opens with its triangle count; at 390 px the
// viewer fits, offers the Camera sheet and keeps Capture in reach.
import assert from "node:assert/strict";
@@ -75,6 +76,7 @@ try {
await dialog.getByText("Cloud · Marigold V2 depth").waitFor();
await dialog.getByRole("button", { name: /Build 3D scene · Demo · free/ }).waitFor();
await shoot(page, "scene-create-dialog");
+ await dialog.getByRole("checkbox", { name: "Don't ask again at this price" }).click();
await dialog.getByRole("button", { name: /Build 3D scene/ }).click();
await page.locator("[data-sonner-toast]").filter({ hasText: "Your 3D scene is ready" }).getByRole("button", { name: "Open" }).click({ timeout: 90_000 });
await page.getByText(/Point cloud from a depth map · \d+k points/).waitFor({ timeout: 60_000 });
@@ -108,6 +110,16 @@ try {
const png = Buffer.from(await (await (await api).fetch(app + capture)).body());
assert.deepEqual([png.readUInt32BE(16), png.readUInt32BE(20)], [864, 1536], "the capture is the 9:16 frame");
await page.getByRole("button", { name: "Close the 3D scene" }).click();
+
+ step("Don't ask again holds at this price: the next build names it in its toast, which can turn the question back on");
+ const quick = page.getByRole("button", { name: "Create 3D scene · Demo · free" }).last();
+ await quick.click({ force: true });
+ const built = page.locator("[data-sonner-toast]").filter({ hasText: "Demo · free · It appears next to the still" });
+ await built.getByRole("button", { name: "Ask first" }).click({ timeout: 30_000 });
+ assert.equal(await page.getByRole("dialog").count(), 0, "no question while skipped");
+ await quick.click({ force: true });
+ await page.getByRole("dialog").getByText("Cloud · Marigold V2 depth").waitFor();
+ await page.getByRole("dialog").getByRole("button", { name: "Cancel" }).click();
await ctx.close();
step("open engine: MoGe's mesh opens, and fits a phone with the Camera sheet");