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.
This commit is contained in:
Jacques Lucke 2022-04-21 15:47:24 +02:00
parent 75a9830d84
commit aca083fbf3
1 changed files with 14 additions and 4 deletions

View File

@ -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;
}