diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-19 16:43:14 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-03-19 16:45:05 +0300 |
commit | e8777a729013d04dcb854b0b9f327e9b90191747 (patch) | |
tree | aa47cd9e4e47cb0d35399f7afa91d27251a72f0d /source | |
parent | 3b9b324bf619a2c2d3cd8d25d5a0f95b7b0c476c (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 248a1486d48..7bd3d5e9b9c 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -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; |