Fix T62732: Bpy/Python is letting create inputs at the node level for node groups that make blend file unsaveable.

Group nodes should not allow to add IO sockets to themselves directly,
in that case we actually want to add IO sockets to their underlying
node tree. Fairly straioght forward to support actually.
This commit is contained in:
Bastien Montagne 2019-03-19 14:43:14 +01:00
parent 3b9b324bf6
commit e8777a7290
Notes: blender-bot 2023-02-14 19:18:46 +01:00
Referenced by issue blender/blender-addons#62732, Bpy/Python is letting create inputs at the node level for node groups that make blend file unsaveable
1 changed files with 10 additions and 0 deletions

View File

@ -1619,6 +1619,11 @@ static void rna_Node_name_set(PointerRNA *ptr, const char *value)
static bNodeSocket *rna_Node_inputs_new(ID *id, bNode *node, Main *bmain, ReportList *reports, const char *type, const char *name, const char *identifier)
{
/* Adding an input to a group node is not working, simpler to add it to its underlying nodetree. */
if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != NULL) {
return rna_NodeTree_inputs_new((bNodeTree *)node->id, bmain, reports, type, name);
}
bNodeTree *ntree = (bNodeTree *)id;
bNodeSocket *sock;
@ -1637,6 +1642,11 @@ static bNodeSocket *rna_Node_inputs_new(ID *id, bNode *node, Main *bmain, Report
static bNodeSocket *rna_Node_outputs_new(ID *id, bNode *node, Main *bmain, ReportList *reports, const char *type, const char *name, const char *identifier)
{
/* Adding an output to a group node is not working, simpler to add it to its underlying nodetree. */
if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != NULL) {
return rna_NodeTree_outputs_new((bNodeTree *)node->id, bmain, reports, type, name);
}
bNodeTree *ntree = (bNodeTree *)id;
bNodeSocket *sock;