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.

Character Swap Studio: an example that opens a two-person swap ready to run

Adarshba920c251230
diff --git a/src/lib/examples/catalog.ts b/src/lib/examples/catalog.ts
index a8c76de9..13b8dd33 100644
--- a/src/lib/examples/catalog.ts
+++ b/src/lib/examples/catalog.ts
@@ -271,7 +271,7 @@ function buildCard(row: PlanRow): ExampleCard {
/** A look card's link: a page of this site that loads one of its own examples (`?example=<id>`). */
function lookHref(row: PlanRow): string {
const href = row.href!;
- const id = /[?&]example=([a-z0-9-]+.d+)(?:&|$)/.exec(href)?.[1];
+ const id = /[?&]example=([a-z0-9-]+\.\d+)(?:&|$)/.exec(href)?.[1];
if (!href.startsWith("/") || href.startsWith("//") || !id) fail(row, "a look card's link opens a page with one of its examples (/page?example=<id>)");
if (Object.keys(row.inputs).length) fail(row, "a look card with a link shows no inputs (the link opens them)");
return href;
diff --git a/src/lib/examples/plan.json b/src/lib/examples/plan.json
index 532d4eec..b1c8c239 100644
--- a/src/lib/examples/plan.json
+++ b/src/lib/examples/plan.json
@@ -4816,5 +4816,21 @@
"at": 1.5,
"from": 0
}
+ },
+ {
+ "id": "character-swap.1",
+ "surface": "tool:character-swap",
+ "rank": 1,
+ "caption": "Two people swapped in one take",
+ "words": "A couple on sunny stone steps becomes two new people. The kiss on the cheek, the laugh and the light stay as filmed.",
+ "load": "look",
+ "href": "/genjutsu?mode=character&example=genjutsu-character.1",
+ "inputs": {},
+ "output": "/examples/genjutsu-character/1/show.mp4",
+ "rest": {
+ "src": "/examples/genjutsu-character/1/show.peak.webp",
+ "at": 4.717,
+ "from": 0
+ }
}
]
diff --git a/tests/examples-catalog.test.ts b/tests/examples-catalog.test.ts
index a4372f54..ee8a38eb 100644
--- a/tests/examples-catalog.test.ts
+++ b/tests/examples-catalog.test.ts
@@ -258,11 +258,23 @@ describe("the examples' catalog", () => {
}
}
// Video upscale, FPS Boost, SDR to HDR and Export never show a still photo's app.
- for (const m of ["video", "fps", "hdr", "export"]) expect(exampleRow(`hub:upscale/${m}` as never), m).toBeNull();
+ for (const m of ["video", "fps", "hdr", "export"]) expect(exampleRow(`hub:upscale/${m}` as never)?.cards.filter((c) => c.id.startsWith("more.")) ?? [], m).toEqual([]);
// Every row names its page, so a linked example loads only where it belongs.
for (const s of [...exampleSurfaces(), ...Object.keys(FALLBACK_ROWS)]) expect(exampleRow(s as never)?.surface, s).toBe(s);
});
+ it("links a card that opens another page to an example that page loads", () => {
+ for (const c of cards) {
+ if (c.load.via !== "look" || !c.load.href) continue;
+ const id = new URL(c.load.href, "https://x").searchParams.get("example")!;
+ expect(exampleById(id), `${c.id} → ${id}`).toBeTruthy();
+ const surface = exampleSurfaceOf(id)!;
+ // The link opens the page of the example it names (a Genjutsu mode's: Genjutsu, on that mode).
+ const page = surface.startsWith("tool:genjutsu/") ? `/genjutsu?mode=${surface.split("/")[1]}` : undefined;
+ if (page) expect(c.load.href.startsWith(page), c.id).toBe(true);
+ }
+ });
+
it("loads a linked example only on its own page (or a motion's, an effect's or a clip app's in the Video studio)", () => {
expect(exampleSurfaceOf("effect-levitation.1")).toBe("preset:effect-levitation");
expect(exampleFits("preset:effect-levitation", "studio:video")).toBe(true);