From d1a86b36f9429a81b33320cc90299278c0849e85 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Mon, 22 Jul 2024 23:02:22 +1000 Subject: [PATCH] Add node_fixer (recreate) functionality (#892) Recreated node now copies the following: - Widgets converted to inputs - Output links - Custom size - Title colour - Background colour --- js/node_fixer.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/node_fixer.js b/js/node_fixer.js index 94b4c747..f83022f5 100644 --- a/js/node_fixer.js +++ b/js/node_fixer.js @@ -105,6 +105,10 @@ function node_info_copy(src, dest, connect_both) { // copy input connections for(let i in src.inputs) { 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) { let link = app.graph.links[input.link]; 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(); } @@ -202,7 +210,7 @@ app.registerExtension({ let new_node = LiteGraph.createNode(nodeType.comfyClass); new_node.pos = [this.pos[0], this.pos[1]]; 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); }, });