Fix #118237: don't allow changing NodeSocket.type directly on built-in nodes
Changing socket types like this is not generally supported. Usually one should modify a property that is stored on the node instead. For custom node trees, one should generally remove one socket and replace it with the new one. Existing addons might use this functionality on custom node trees where it's okayish. This patch forbids changing socket types directly on built-in nodes. Pull Request: https://projects.blender.org/blender/blender/pulls/118794
This commit is contained in:
@@ -263,6 +263,10 @@ static void rna_NodeSocket_type_set(PointerRNA *ptr, int value)
|
||||
bNodeSocket *sock = static_cast<bNodeSocket *>(ptr->data);
|
||||
bNode *node;
|
||||
nodeFindNode(ntree, sock, &node, nullptr);
|
||||
if (node->type != NODE_CUSTOM) {
|
||||
/* Can't change the socket type on built-in nodes like this. */
|
||||
return;
|
||||
}
|
||||
nodeModifySocketTypeStatic(ntree, node, sock, value, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user