From aca083fbf38246437caa6e50a6feeeb23b64ee18 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Thu, 21 Apr 2022 15:47:24 +0200 Subject: 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. --- source/blender/makesrna/intern/rna_nodetree.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'source/blender') 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; } -- cgit v1.2.3