[Bf-blender-cvs] [37d2c774c12] blender-v3.1-release: Fix T96073: Don't remove links when inserting reroute nodes

Jacques Lucke noreply at git.blender.org
Mon Feb 28 16:43:25 CET 2022


Commit: 37d2c774c1240014dca8933545a735091b156e5b
Author: Jacques Lucke
Date:   Mon Feb 28 16:42:15 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rB37d2c774c1240014dca8933545a735091b156e5b

Fix T96073: Don't remove links when inserting reroute nodes

This was an oversight in rB06ac5992618a75c453e495e06af7c5faf30499a7.

===================================================================

M	source/blender/editors/space_node/node_relationships.cc

===================================================================

diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc
index d92f86c2cfc..1ebbc71c177 100644
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@ -2452,16 +2452,18 @@ void ED_node_link_insert(Main *bmain, ScrArea *area)
   bNodeSocket *best_input = get_main_socket(ntree, *node_to_insert, SOCK_IN);
   bNodeSocket *best_output = get_main_socket(ntree, *node_to_insert, SOCK_OUT);
 
-  /* Ignore main sockets when the types don't match. */
-  if (best_input != nullptr && ntree.typeinfo->validate_link != nullptr &&
-      !ntree.typeinfo->validate_link(static_cast<eNodeSocketDatatype>(old_link->fromsock->type),
-                                     static_cast<eNodeSocketDatatype>(best_input->type))) {
-    best_input = nullptr;
-  }
-  if (best_output != nullptr && ntree.typeinfo->validate_link != nullptr &&
-      !ntree.typeinfo->validate_link(static_cast<eNodeSocketDatatype>(best_output->type),
-                                     static_cast<eNodeSocketDatatype>(old_link->tosock->type))) {
-    best_output = nullptr;
+  if (node_to_insert->type != NODE_REROUTE) {
+    /* Ignore main sockets when the types don't match. */
+    if (best_input != nullptr && ntree.typeinfo->validate_link != nullptr &&
+        !ntree.typeinfo->validate_link(static_cast<eNodeSocketDatatype>(old_link->fromsock->type),
+                                       static_cast<eNodeSocketDatatype>(best_input->type))) {
+      best_input = nullptr;
+    }
+    if (best_output != nullptr && ntree.typeinfo->validate_link != nullptr &&
+        !ntree.typeinfo->validate_link(static_cast<eNodeSocketDatatype>(best_output->type),
+                                       static_cast<eNodeSocketDatatype>(old_link->tosock->type))) {
+      best_output = nullptr;
+    }
   }
 
   bNode *from_node = old_link->fromnode;



More information about the Bf-blender-cvs mailing list