mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 23:00:51 +08:00
Merge branch 'comfyanonymous:master' into refactor/onprompt
This commit is contained in:
commit
0402640fa6
@ -24,9 +24,13 @@ app.registerExtension({
|
|||||||
// Ignore wildcard nodes as these will be updated to real types
|
// Ignore wildcard nodes as these will be updated to real types
|
||||||
const types = new Set(this.outputs[0].links.map((l) => app.graph.links[l].type).filter((t) => t !== "*"));
|
const types = new Set(this.outputs[0].links.map((l) => app.graph.links[l].type).filter((t) => t !== "*"));
|
||||||
if (types.size > 1) {
|
if (types.size > 1) {
|
||||||
|
const linksToDisconnect = [];
|
||||||
for (let i = 0; i < this.outputs[0].links.length - 1; i++) {
|
for (let i = 0; i < this.outputs[0].links.length - 1; i++) {
|
||||||
const linkId = this.outputs[0].links[i];
|
const linkId = this.outputs[0].links[i];
|
||||||
const link = app.graph.links[linkId];
|
const link = app.graph.links[linkId];
|
||||||
|
linksToDisconnect.push(link);
|
||||||
|
}
|
||||||
|
for (const link of linksToDisconnect) {
|
||||||
const node = app.graph.getNodeById(link.target_id);
|
const node = app.graph.getNodeById(link.target_id);
|
||||||
node.disconnectInput(link.target_slot);
|
node.disconnectInput(link.target_slot);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,6 +59,10 @@ function convertToInput(node, widget, config) {
|
|||||||
widget: { name: widget.name, config },
|
widget: { name: widget.name, config },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
for (const widget of node.widgets) {
|
||||||
|
widget.last_y += LiteGraph.NODE_SLOT_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
// Restore original size but grow if needed
|
// Restore original size but grow if needed
|
||||||
node.setSize([Math.max(sz[0], node.size[0]), Math.max(sz[1], node.size[1])]);
|
node.setSize([Math.max(sz[0], node.size[0]), Math.max(sz[1], node.size[1])]);
|
||||||
}
|
}
|
||||||
@ -68,6 +72,10 @@ function convertToWidget(node, widget) {
|
|||||||
const sz = node.size;
|
const sz = node.size;
|
||||||
node.removeInput(node.inputs.findIndex((i) => i.widget?.name === widget.name));
|
node.removeInput(node.inputs.findIndex((i) => i.widget?.name === widget.name));
|
||||||
|
|
||||||
|
for (const widget of node.widgets) {
|
||||||
|
widget.last_y -= LiteGraph.NODE_SLOT_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
// Restore original size but grow if needed
|
// Restore original size but grow if needed
|
||||||
node.setSize([Math.max(sz[0], node.size[0]), Math.max(sz[1], node.size[1])]);
|
node.setSize([Math.max(sz[0], node.size[0]), Math.max(sz[1], node.size[1])]);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user