mirror of
https://git.datalinker.icu/ltdrdata/ComfyUI-Manager
synced 2025-12-09 22:24:23 +08:00
Add node_fixer (recreate) functionality (#892)
Recreated node now copies the following: - Widgets converted to inputs - Output links - Custom size - Title colour - Background colour
This commit is contained in:
parent
229edefb1f
commit
d1a86b36f9
@ -105,6 +105,10 @@ function node_info_copy(src, dest, connect_both) {
|
|||||||
// copy input connections
|
// copy input connections
|
||||||
for(let i in src.inputs) {
|
for(let i in src.inputs) {
|
||||||
let input = src.inputs[i];
|
let input = src.inputs[i];
|
||||||
|
if (input.widget !== undefined) {
|
||||||
|
const destWidget = dest.widgets.find(x => x.name === input.widget.name);
|
||||||
|
dest.convertWidgetToInput(destWidget);
|
||||||
|
}
|
||||||
if(input.link) {
|
if(input.link) {
|
||||||
let link = app.graph.links[input.link];
|
let link = app.graph.links[input.link];
|
||||||
let src_node = app.graph.getNodeById(link.origin_id);
|
let src_node = app.graph.getNodeById(link.origin_id);
|
||||||
@ -138,6 +142,10 @@ function node_info_copy(src, dest, connect_both) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dest.color = src.color;
|
||||||
|
dest.bgcolor = src.bgcolor;
|
||||||
|
dest.size = src.size;
|
||||||
|
|
||||||
app.graph.afterChange();
|
app.graph.afterChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +210,7 @@ app.registerExtension({
|
|||||||
let new_node = LiteGraph.createNode(nodeType.comfyClass);
|
let new_node = LiteGraph.createNode(nodeType.comfyClass);
|
||||||
new_node.pos = [this.pos[0], this.pos[1]];
|
new_node.pos = [this.pos[0], this.pos[1]];
|
||||||
app.canvas.graph.add(new_node, false);
|
app.canvas.graph.add(new_node, false);
|
||||||
node_info_copy(this, new_node);
|
node_info_copy(this, new_node, true);
|
||||||
app.canvas.graph.remove(this);
|
app.canvas.graph.remove(this);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user