Nodes: Add dropdown to select group socket subtype #105614

Merged
Hans Goudey merged 5 commits from HooglyBoogly/blender:node-group-io-subtype into main 2023-04-03 18:23:42 +02:00
1 changed files with 8 additions and 3 deletions
Showing only changes of commit 7bcda420ae - Show all commits

View File

@ -1683,9 +1683,14 @@ void nodeModifySocketType(bNodeTree *ntree,
}
if (sock->default_value) {
socket_id_user_decrement(sock);
MEM_freeN(sock->default_value);
sock->default_value = nullptr;
if (sock->type != socktype->type) {
/* Only reallocate the default value if the type changed so that UI data like min and max
* isn't removed. This assumes that the default value is stored in the same format for all
* socket types with the same #eNodeSocketDatatype. */
socket_id_user_decrement(sock);
MEM_freeN(sock->default_value);
sock->default_value = nullptr;
}
}
BLI_strncpy(sock->idname, idname, sizeof(sock->idname));