From ef58bd609b498082e8955b6aad1cdc2bac7bff94 Mon Sep 17 00:00:00 2001 From: W_Cloud Date: Sun, 12 Oct 2025 16:33:50 +0200 Subject: [PATCH] Fix: Nodes: String node initialization regression with link-drag-search I think the special handling for string input node, added in #139478, was broken by #146033. The early check for src_value (`if (!src_value)`) caused the string-specific logic to be skipped. This PR moves the string-specific handling before the src_value check. Pull Request: https://projects.blender.org/blender/blender/pulls/147697 --- source/blender/blenkernel/intern/node.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index eb203d23e77..150ee556b7e 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -3752,6 +3752,17 @@ void node_socket_move_default_value(Main & /*bmain*/, } } + /* Special handling for strings because the generic code below can't handle them. */ + if (src.type == SOCK_STRING && dst.type == SOCK_STRING && + dst_node.is_type("FunctionNodeInputString")) + { + auto *src_value = static_cast(src.default_value); + auto *dst_storage = static_cast(dst_node.storage); + MEM_SAFE_FREE(dst_storage->string); + dst_storage->string = BLI_strdup_null(src_value->value); + return; + } + void *src_value = socket_value_storage(src); if (!src_value) { return; @@ -3768,17 +3779,6 @@ void node_socket_move_default_value(Main & /*bmain*/, return; } - /* Special handling for strings because the generic code below can't handle them. */ - if (src.type == SOCK_STRING && dst.type == SOCK_STRING && - dst_node.is_type("FunctionNodeInputString")) - { - auto *src_value = static_cast(src.default_value); - auto *dst_storage = static_cast(dst_node.storage); - MEM_SAFE_FREE(dst_storage->string); - dst_storage->string = BLI_strdup_null(src_value->value); - return; - } - void *dst_value = node_static_value_storage_for(dst_node, dst); if (!dst_value) { return;