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
This commit is contained in:
parent
365e9cb6aa
commit
acd5f5285e
Notes:
blender-bot
2023-02-13 22:35:25 +01:00
Referenced by issue #76538, Creating links to nowhere
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue