diff options
author | Ethan-Hall <Ethan1080> | 2022-04-28 23:05:56 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-04-28 23:06:24 +0300 |
commit | 708fabe3d7a4bfd7821472a98125a2fdc7eb2f0a (patch) | |
tree | 895677e137ebab1bc2314b605294abbad0a3daff /source/blender/editors/space_node/node_draw.cc | |
parent | 8095875dffebed289791491ff15d68d49deb85ef (diff) |
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
Diffstat (limited to 'source/blender/editors/space_node/node_draw.cc')
-rw-r--r-- | source/blender/editors/space_node/node_draw.cc | 12 |
1 files 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<Object *>()) { - id_to_inspection_string((ID *)buffer, ID_OB); + id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_OB); } else if (type.is<Material *>()) { - id_to_inspection_string((ID *)buffer, ID_MA); + id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_MA); } else if (type.is<Tex *>()) { - id_to_inspection_string((ID *)buffer, ID_TE); + id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_TE); } else if (type.is<Image *>()) { - id_to_inspection_string((ID *)buffer, ID_IM); + id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_IM); } else if (type.is<Collection *>()) { - id_to_inspection_string((ID *)buffer, ID_GR); + id_to_inspection_string(*static_cast<const ID *const *>(buffer), ID_GR); } else if (type.is<int>()) { ss << *(int *)buffer << TIP_(" (Integer)"); |