[Bf-blender-cvs] [aca083fbf38] master: Nodes: raise exception when creating node group input/output fails

Jacques Lucke noreply at git.blender.org
Thu Apr 21 15:48:14 CEST 2022


Commit: aca083fbf38246437caa6e50a6feeeb23b64ee18
Author: Jacques Lucke
Date:   Thu Apr 21 15:47:24 2022 +0200
Branches: master
https://developer.blender.org/rBaca083fbf38246437caa6e50a6feeeb23b64ee18

Nodes: raise exception when creating node group input/output fails

Previously this would silently return `None`.
Now the behavior is similar to when new sockets are added to a node.

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

M	source/blender/makesrna/intern/rna_nodetree.c

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

diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 31b2d36dcfd..090d4a81210 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1420,8 +1420,13 @@ static bNodeSocket *rna_NodeTree_inputs_new(
 
   bNodeSocket *sock = ntreeAddSocketInterface(ntree, SOCK_IN, type, name);
 
-  ED_node_tree_propagate_change(NULL, bmain, ntree);
-  WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+  if (sock == NULL) {
+    BKE_report(reports, RPT_ERROR, "Unable to create socket");
+  }
+  else {
+    ED_node_tree_propagate_change(NULL, bmain, ntree);
+    WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+  }
 
   return sock;
 }
@@ -1435,8 +1440,13 @@ static bNodeSocket *rna_NodeTree_outputs_new(
 
   bNodeSocket *sock = ntreeAddSocketInterface(ntree, SOCK_OUT, type, name);
 
-  ED_node_tree_propagate_change(NULL, bmain, ntree);
-  WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+  if (sock == NULL) {
+    BKE_report(reports, RPT_ERROR, "Unable to create socket");
+  }
+  else {
+    ED_node_tree_propagate_change(NULL, bmain, ntree);
+    WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+  }
 
   return sock;
 }



More information about the Bf-blender-cvs mailing list