Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2022-04-21 16:47:24 +0300
committerJacques Lucke <jacques@blender.org>2022-04-21 16:48:02 +0300
commitaca083fbf38246437caa6e50a6feeeb23b64ee18 (patch)
tree8eb7d8f51e00405f715013deddce56c3acf5a213 /source/blender/makesrna/intern/rna_nodetree.c
parent75a9830d84f68c8f1e1d4d132def28ef25b5cabd (diff)
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.
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c18
1 files changed, 14 insertions, 4 deletions
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;
}