mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-16 00:12:33 +08:00
Fix converted widgets not reconnecting
This commit is contained in:
parent
49b97dc5d8
commit
c7eea7cb8e
@ -580,4 +580,30 @@ describe("group node", () => {
|
||||
expect(call).toContain("NotVAEDecode");
|
||||
expect(call).toContain("workflow/testerror");
|
||||
});
|
||||
test("maintains widget inputs on conversion back to nodes", async () => {
|
||||
const { ez, graph, app } = await start();
|
||||
let pos = ez.CLIPTextEncode({ text: "positive" });
|
||||
pos.node.title = "Positive";
|
||||
let neg = ez.CLIPTextEncode({ text: "negative" });
|
||||
neg.node.title = "Negative";
|
||||
pos.widgets.text.convertToInput();
|
||||
neg.widgets.text.convertToInput();
|
||||
|
||||
let primitive = ez.PrimitiveNode();
|
||||
primitive.outputs[0].connectTo(pos.inputs.text);
|
||||
primitive.outputs[0].connectTo(neg.inputs.text);
|
||||
|
||||
const group = await convertToGroup(app, graph, "test", [pos, neg, primitive]);
|
||||
expect(group.widgets["Positive text"].value).toBe("positive");
|
||||
expect(group.widgets["Negative text"].value).toBe("positive");
|
||||
|
||||
const newNodes = group.menu["Convert to nodes"].call();
|
||||
pos = graph.find(newNodes.find((n) => n.title === "Positive"));
|
||||
neg = graph.find(newNodes.find((n) => n.title === "Negative"));
|
||||
primitive = graph.find(newNodes.find((n) => n.type === "PrimitiveNode"));
|
||||
|
||||
expect(pos.inputs).toHaveLength(2);
|
||||
expect(neg.inputs).toHaveLength(2);
|
||||
expect(primitive.outputs[0].connections).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
|
||||
@ -154,13 +154,6 @@ function buildNodeDef(config, nodeName, defs, source = "workflow") {
|
||||
seenInputs[name] = 1;
|
||||
}
|
||||
|
||||
const nodeInput = node.inputs?.findIndex((input) => input.name === inputName);
|
||||
|
||||
// For now internal widget inputs are not supported
|
||||
if (nodeInput > -1 && node.inputs[nodeInput]?.widget) {
|
||||
node.inputs.splice(nodeInput, 1);
|
||||
}
|
||||
|
||||
if (widgetType) {
|
||||
// Store mapping to get a group widget name from an inner id + name
|
||||
if (!slots.widgets[nodeId]) slots.widgets[nodeId] = {};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user