[Bf-blender-cvs] [708fabe3d7a] master: Fix: Socket inspection error for data-block sockets
Ethan-Hall
noreply at git.blender.org
Thu Apr 28 22:06:38 CEST 2022
Commit: 708fabe3d7a4bfd7821472a98125a2fdc7eb2f0a
Author: Ethan-Hall
Date: Thu Apr 28 15:05:56 2022 -0500
Branches: master
https://developer.blender.org/rB708fabe3d7a4bfd7821472a98125a2fdc7eb2f0a
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
===================================================================
M source/blender/editors/space_node/node_draw.cc
===================================================================
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)");
More information about the Bf-blender-cvs
mailing list