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:
authorPhilipp Oeser <info@graphics-engineer.com>2020-05-08 18:34:17 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2020-05-11 21:26:00 +0300
commitacd5f5285e9416f11b462f67f781bfebdbd7e017 (patch)
treee045f07c28d007842480d2bf5ec58df6f92018ae /source/blender
parent365e9cb6aa86869f2f1ddf01ec236b2d77451f4b (diff)
Fix T76538: Prevent nodesocket creation on certain nodes
- no sockets on Frame nodes - no Input sockets on Group Input nodes - no Output sockets on Group Output nodes Maniphest Tasks: T76538 Differential Revision: https://developer.blender.org/D7671
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/node.c4
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c9
2 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index c3c538f3424..5ae44247e13 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -771,6 +771,10 @@ bNodeSocket *nodeAddSocket(bNodeTree *ntree,
const char *identifier,
const char *name)
{
+ BLI_assert(node->type != NODE_FRAME);
+ BLI_assert(!(in_out == SOCK_IN && node->type == NODE_GROUP_INPUT));
+ BLI_assert(!(in_out == SOCK_OUT && node->type == NODE_GROUP_OUTPUT));
+
ListBase *lb = (in_out == SOCK_IN ? &node->inputs : &node->outputs);
bNodeSocket *sock = make_socket(ntree, node, in_out, lb, idname, identifier, name);
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 71b3f1ee94b..5be3db37329 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1893,6 +1893,11 @@ static bNodeSocket *rna_Node_inputs_new(ID *id,
const char *name,
const char *identifier)
{
+
+ if (ELEM(node->type, NODE_GROUP_INPUT, NODE_FRAME)) {
+ BKE_report(reports, RPT_ERROR, "Unable to create socket");
+ return NULL;
+ }
/* 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) {
@@ -1923,6 +1928,10 @@ static bNodeSocket *rna_Node_outputs_new(ID *id,
const char *name,
const char *identifier)
{
+ if (ELEM(node->type, NODE_GROUP_OUTPUT, NODE_FRAME)) {
+ BKE_report(reports, RPT_ERROR, "Unable to create socket");
+ return NULL;
+ }
/* 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) {