[Bf-blender-cvs] [731f3777836] blender-v3.1-release: Fix T96386: crash when changing shader to node group in properties

Jacques Lucke noreply at git.blender.org
Mon Mar 21 14:06:51 CET 2022


Commit: 731f3777836999c425888e22dba140bda18a09be
Author: Jacques Lucke
Date:   Wed Mar 16 11:23:45 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rB731f3777836999c425888e22dba140bda18a09be

Fix T96386: crash when changing shader to node group in properties

The previous code updated the wrong node tree. The result was that
the new group node did not have the socket that was supposed to
be linked.

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

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

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

diff --git a/source/blender/editors/space_node/node_templates.cc b/source/blender/editors/space_node/node_templates.cc
index 113e2bd3bb3..5b790002e78 100644
--- a/source/blender/editors/space_node/node_templates.cc
+++ b/source/blender/editors/space_node/node_templates.cc
@@ -82,11 +82,11 @@ static bool node_link_item_compare(bNode *node, NodeLinkItem *item)
   return true;
 }
 
-static void node_link_item_apply(Main *bmain, bNode *node, NodeLinkItem *item)
+static void node_link_item_apply(bNodeTree *ntree, bNode *node, NodeLinkItem *item)
 {
   if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP)) {
     node->id = (ID *)item->ngroup;
-    BKE_ntree_update_main_tree(bmain, item->ngroup, nullptr);
+    BKE_ntree_update_tag_node_property(ntree, node);
   }
   else {
     /* nothing to do for now */
@@ -250,7 +250,8 @@ static void node_socket_add_replace(const bContext *C,
       nodePositionRelative(node_from, node_to, sock_from_tmp, sock_to);
     }
 
-    node_link_item_apply(bmain, node_from, item);
+    node_link_item_apply(ntree, node_from, item);
+    ED_node_tree_propagate_change(C, bmain, ntree);
   }
 
   nodeSetActive(ntree, node_from);



More information about the Bf-blender-cvs mailing list