diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 794031c7057..0f49cddcdc1 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -1583,6 +1583,31 @@ static void create_inspection_string_for_geometry_socket(std::stringstream &ss, } } +static void create_inspection_string_for_default_socket_value(const bNodeSocket &socket, + std::stringstream &ss) +{ + if (!socket.is_input()) { + return; + } + if (socket.is_directly_linked()) { + return; + } + if (const nodes::SocketDeclaration *socket_decl = socket.runtime->declaration) { + if (socket_decl->input_field_type == nodes::InputSocketFieldType::Implicit) { + return; + } + } + if (socket.typeinfo->base_cpp_type == nullptr) { + return; + } + + const CPPType &value_type = *socket.typeinfo->base_cpp_type; + BUFFER_FOR_CPP_TYPE_VALUE(value_type, socket_value); + socket.typeinfo->get_base_cpp_value(socket.default_value, socket_value); + create_inspection_string_for_generic_value(socket, GPointer(value_type, socket_value), ss); + value_type.destruct(socket_value); +} + static std::optional create_description_inspection_string(const bNodeSocket &socket) { if (socket.runtime->declaration == nullptr) { @@ -1732,6 +1757,18 @@ static std::optional create_multi_input_log_inspection_string( return str; } +static std::optional create_default_value_inspection_string(const bNodeSocket &socket) +{ + std::stringstream ss; + create_inspection_string_for_default_socket_value(socket, ss); + + std::string str = ss.str(); + if (str.empty()) { + return std::nullopt; + } + return str; +} + static std::string node_socket_get_tooltip(const SpaceNode *snode, const bNodeTree &ntree, const bNodeSocket &socket) @@ -1754,6 +1791,9 @@ static std::string node_socket_get_tooltip(const SpaceNode *snode, if (std::optional info = create_log_inspection_string(geo_tree_log, socket)) { inspection_strings.append(std::move(*info)); } + else if (std::optional info = create_default_value_inspection_string(socket)) { + inspection_strings.append(std::move(*info)); + } else if (std::optional info = create_multi_input_log_inspection_string( ntree, socket, tree_draw_ctx)) {