Skip to content

One-click character swap for videos: an open-source, local Higgsfield Genjutsu alternative built on ComfyUI and MiniMax H3, with FLUX.3 Klein relighting.

Drop the grey motion reference in Object swap change mode

D3voz25ac36af4a7f
diff --git a/lib/object.ts b/lib/object.ts
index db33f7a..41cbfab 100644
--- a/lib/object.ts
+++ b/lib/object.ts
@@ -55,8 +55,8 @@ export function pruneObject(source: ApiGraph, picture: boolean, settings: Object
delete plan.picture_1_text;
delete ref["ref_images.ref_image_0"];
}
- // A grey shape in the motion reference would come back as a grey object.
- if (settings.mode === "remove") {
+ // H3 copies a grey shape's colour and cut, so a changed top would keep the old silhouette and a removed object would come back grey.
+ if (settings.mode !== "background") {
delete ref["ref_videos.ref_video_0"];
delete ref["ref_video_audios.ref_video_audio_0"];
}
diff --git a/test/object.test.ts b/test/object.test.ts
index 4ff7d13..75eb312 100644
--- a/test/object.test.ts
+++ b/test/object.test.ts
@@ -44,7 +44,11 @@ test("without a picture the picture branch goes", () => {
const pruned = pruneObject(graph, false, settings("change"));
assert.deepEqual(dangling(pruned), []);
assert.ok(!titles(pruned).includes(OBJECT_PICTURE));
- assert.ok(node(pruned, "Reference Conditioning").inputs["ref_videos.ref_video_0"]);
+});
+
+test("change drops the grey motion reference", () => {
+ const ref = node(pruneObject(graph, true, settings("change")), "Reference Conditioning").inputs;
+ assert.deepEqual(Object.keys(ref).filter((name) => name.startsWith("ref_")), ["ref_image_size", "ref_images.ref_image_0"]);
});
test("remove drops the picture and the grey motion reference", () => {
@@ -60,6 +64,7 @@ test("background flips the mask and greys all of it", () => {
assert.equal(pruned[grow].inputs.flip_input, true);
const grey = node(pruned, "Turn it grey (shape and movement only)").inputs;
assert.deepEqual([grey.mask, grey.size], [[grow, 0], [grow, 0]]);
+ assert.ok(node(pruned, "Reference Conditioning").inputs["ref_videos.ref_video_0"]);
});
test("the model settings reach the Object Swap Plan", () => {