From 5fdce48481a937ecd2a5d927d2befde8214813b6 Mon Sep 17 00:00:00 2001 From: ilya Date: Mon, 13 Jul 2020 20:10:30 +0300 Subject: [PATCH] Fixed broken connect method --- src/litegraph.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/litegraph.js b/src/litegraph.js index 0b5b3792c..65117d8f1 100755 --- a/src/litegraph.js +++ b/src/litegraph.js @@ -3603,10 +3603,14 @@ return null; } + var output = this.outputs[slot]; + var input = target_node.inputs[target_slot]; + if (LiteGraph.isValidConnection(output.type, input.type)) { if (target_node.onBeforeConnectInput) { // This way node can choose another slot (if selected is occupied) target_slot = target_node.onBeforeConnectInput(target_slot); + input = target_node.inputs[target_slot]; } //if there is something already plugged there, disconnect @@ -3618,8 +3622,6 @@ //this.setDirtyCanvas(false,true); //this.graph.connectionChange( this ); - var output = this.outputs[slot]; - //allows nodes to block connection if (target_node.onConnectInput) { if ( target_node.onConnectInput(target_slot, output.type, output, this, slot) === false ) { @@ -3627,7 +3629,6 @@ } } - var input = target_node.inputs[target_slot]; var link_info = null; link_info = new LLink(