Fix #108376: Copy from geometry to other node tree types resets shapes

Socket shapes are used in geometry nodes to indicate field types.
In other tree types (e.g. shaders) the socket shape is not touched at
all. Since nodes can be copied from geometry node trees, we need to
reset the socket shape when copying to a shader, compositor, or texture
tree.

Pull Request: https://projects.blender.org/blender/blender/pulls/108412
This commit is contained in:
Lukas Tönne
2023-06-12 14:21:50 +02:00
parent 18350ba06a
commit f09d465a6d

View File

@@ -245,6 +245,13 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
{
bNode *new_node = bke::node_copy_with_mapping(
&tree, node, LIB_ID_COPY_DEFAULT, true, socket_map);
/* Reset socket shape in case a node is copied to a different tree type. */
LISTBASE_FOREACH (bNodeSocket *, socket, &new_node->inputs) {
socket->display_shape = SOCK_DISPLAY_SHAPE_CIRCLE;
}
LISTBASE_FOREACH (bNodeSocket *, socket, &new_node->outputs) {
socket->display_shape = SOCK_DISPLAY_SHAPE_CIRCLE;
}
node_map.add_new(&node, new_node);
}
else {