mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-15 16:02:32 +08:00
Fix convert to nodes with internal reroutes
This commit is contained in:
parent
f02cb2d3df
commit
e051b5b8d6
@ -267,6 +267,26 @@ describe("group node", () => {
|
|||||||
group.outputs[1].connectTo(nodes.pos.inputs.clip);
|
group.outputs[1].connectTo(nodes.pos.inputs.clip);
|
||||||
group.outputs[1].connectTo(nodes.neg.inputs.clip);
|
group.outputs[1].connectTo(nodes.neg.inputs.clip);
|
||||||
});
|
});
|
||||||
|
test("can handle reroutes used internally", async () => {
|
||||||
|
const { ez, graph, app } = await start();
|
||||||
|
const nodes = createDefaultWorkflow(ez, graph);
|
||||||
|
|
||||||
|
let reroutes = [];
|
||||||
|
let prevNode = nodes.ckpt;
|
||||||
|
for(let i = 0; i < 5; i++) {
|
||||||
|
const reroute = ez.Reroute();
|
||||||
|
prevNode.outputs[0].connectTo(reroute.inputs[0]);
|
||||||
|
prevNode = reroute;
|
||||||
|
reroutes.push(reroute);
|
||||||
|
}
|
||||||
|
prevNode.outputs[0].connectTo(nodes.sampler.inputs.model);
|
||||||
|
|
||||||
|
const group = await convertToGroup(app, graph, "test", [...reroutes, ...Object.values(nodes)]);
|
||||||
|
expect((await graph.toPrompt()).output).toEqual(getOutput());
|
||||||
|
|
||||||
|
group.menu["Convert to nodes"].call();
|
||||||
|
expect((await graph.toPrompt()).output).toEqual(getOutput());
|
||||||
|
});
|
||||||
test("creates with widget values from inner nodes", async () => {
|
test("creates with widget values from inner nodes", async () => {
|
||||||
const { ez, graph, app } = await start();
|
const { ez, graph, app } = await start();
|
||||||
const nodes = createDefaultWorkflow(ez, graph);
|
const nodes = createDefaultWorkflow(ez, graph);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { app } from "../../scripts/app.js";
|
import { app } from "../../scripts/app.js";
|
||||||
import { api } from "../../scripts/api.js";
|
import { api } from "../../scripts/api.js";
|
||||||
import { getWidgetType, addValueControlWidgets } from "../../scripts/widgets.js";
|
import { getWidgetType } from "../../scripts/widgets.js";
|
||||||
import { mergeIfValid } from "./widgetInputs.js";
|
import { mergeIfValid } from "./widgetInputs.js";
|
||||||
|
|
||||||
const GROUP = Symbol();
|
const GROUP = Symbol();
|
||||||
@ -646,10 +646,10 @@ export class GroupNodeHandler {
|
|||||||
newNode.widgets[0].callback?.(newNode.widgets[0].value);
|
newNode.widgets[0].callback?.(newNode.widgets[0].value);
|
||||||
} else {
|
} else {
|
||||||
const map = this.groupData.oldToNewWidgetMap[innerNode.index];
|
const map = this.groupData.oldToNewWidgetMap[innerNode.index];
|
||||||
|
if (map) {
|
||||||
const widgets = Object.keys(map);
|
const widgets = Object.keys(map);
|
||||||
|
|
||||||
for (let i = 0; i < widgets.length; i++) {
|
for (const oldName of widgets) {
|
||||||
const oldName = widgets[i];
|
|
||||||
const newName = map[oldName];
|
const newName = map[oldName];
|
||||||
if (!newName) continue;
|
if (!newName) continue;
|
||||||
|
|
||||||
@ -668,6 +668,7 @@ export class GroupNodeHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Shift each node
|
// Shift each node
|
||||||
for (const newNode of newNodes) {
|
for (const newNode of newNodes) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user