From 708fabe3d7a4bfd7821472a98125a2fdc7eb2f0a Mon Sep 17 00:00:00 2001 From: Ethan-Hall Date: Thu, 28 Apr 2022 15:05:56 -0500 Subject: [PATCH] Fix: Socket inspection error for data-block sockets After rB47276b847017, for certain socket types such as object or material, the name of the item is not obtained correctly leading the tooltip to display random non-character memory values as text. Differential Revision: https://developer.blender.org/D14762 --- source/blender/editors/space_node/node_draw.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 86a83281ad2..0e02013f527 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -780,26 +780,26 @@ struct SocketTooltipData { static void create_inspection_string_for_generic_value(const GPointer value, std::stringstream &ss) { - auto id_to_inspection_string = [&](ID *id, short idcode) { + auto id_to_inspection_string = [&](const ID *id, const short idcode) { ss << (id ? id->name + 2 : TIP_("None")) << " (" << BKE_idtype_idcode_to_name(idcode) << ")"; }; const CPPType &type = *value.type(); const void *buffer = value.get(); if (type.is()) { - id_to_inspection_string((ID *)buffer, ID_OB); + id_to_inspection_string(*static_cast(buffer), ID_OB); } else if (type.is()) { - id_to_inspection_string((ID *)buffer, ID_MA); + id_to_inspection_string(*static_cast(buffer), ID_MA); } else if (type.is()) { - id_to_inspection_string((ID *)buffer, ID_TE); + id_to_inspection_string(*static_cast(buffer), ID_TE); } else if (type.is()) { - id_to_inspection_string((ID *)buffer, ID_IM); + id_to_inspection_string(*static_cast(buffer), ID_IM); } else if (type.is()) { - id_to_inspection_string((ID *)buffer, ID_GR); + id_to_inspection_string(*static_cast(buffer), ID_GR); } else if (type.is()) { ss << *(int *)buffer << TIP_(" (Integer)");