From 37b70d798701295819a50bc64d373b0e6235cf14 Mon Sep 17 00:00:00 2001 From: pythongosssss <125205205+pythongosssss@users.noreply.github.com> Date: Thu, 16 Mar 2023 14:08:11 +0000 Subject: [PATCH] Made node non collapsable Fixed color of first input link --- web/extensions/core/rerouteNode.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/extensions/core/rerouteNode.js b/web/extensions/core/rerouteNode.js index 54356462..8a951d41 100644 --- a/web/extensions/core/rerouteNode.js +++ b/web/extensions/core/rerouteNode.js @@ -34,6 +34,7 @@ app.registerExtension({ let currentNode = this; let updateNodes = []; let inputType = null; + let inputNode = null; while (currentNode) { updateNodes.unshift(currentNode); const linkId = currentNode.inputs[0].link; @@ -46,6 +47,7 @@ app.registerExtension({ currentNode = node; } else { // We've found the end + inputNode = currentNode; inputType = node.outputs[link.origin_slot].type; break; } @@ -93,6 +95,7 @@ app.registerExtension({ } const displayType = inputType || outputType || "*"; + const color = LGraphCanvas.link_type_colors[displayType]; // Update the types of each node for (const node of updateNodes) { @@ -103,11 +106,14 @@ app.registerExtension({ node.outputs[0].name = node.properties.showOutputText ? displayType : ""; node.size = node.computeSize(); - const color = LGraphCanvas.link_type_colors[displayType]; for (const l of node.outputs[0].links || []) { app.graph.links[l].color = color; } } + + if (inputNode) { + app.graph.links[inputNode.inputs[0].link].color = color; + } }; this.clone = function () { @@ -173,6 +179,7 @@ app.registerExtension({ Object.assign(RerouteNode, { title_mode: LiteGraph.NO_TITLE, title: "Reroute", + collapsable: false, }) );