Geometry Nodes: Add labels for switch node texture sockets

This makes texture sockets have a label by default. This can be changed
by adding the SOCK_HIDE_LABEL flag to the socket. With this change the
switch node now shows the labels "True" and "False" like for the other
types of sockets.
This commit is contained in:
Wannes Malfait 2021-08-09 17:30:44 -05:00 committed by Hans Goudey
parent 3b87fd376a
commit cd692c6954
Notes: blender-bot 2023-02-14 09:48:25 +01:00
Referenced by commit d9930cddfd, Fix invalid string comparison in cd692c6954
2 changed files with 21 additions and 3 deletions

View File

@ -3596,8 +3596,26 @@ static void std_node_socket_draw(
break;
}
case SOCK_TEXTURE: {
uiTemplateID(
layout, C, ptr, "default_value", "texture.new", nullptr, nullptr, 0, ICON_NONE, nullptr);
if (text == "") {
uiTemplateID(layout,
C,
ptr,
"default_value",
"texture.new",
nullptr,
nullptr,
0,
ICON_NONE,
nullptr);
}
else {
/* 0.3 split ratio is inconsistent, but use it here because the "New" button is large. */
uiLayout *row = uiLayoutSplit(layout, 0.3f, false);
uiItemL(row, text, 0);
uiTemplateID(
row, C, ptr, "default_value", "texture.new", nullptr, nullptr, 0, ICON_NONE, nullptr);
}
break;
}
case SOCK_MATERIAL: {

View File

@ -30,7 +30,7 @@
static bNodeSocketTemplate geo_node_attribute_sample_texture_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_TEXTURE, N_("Texture")},
{SOCK_TEXTURE, N_("Texture"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, PROP_NONE, SOCK_HIDE_LABEL},
{SOCK_STRING, N_("Mapping")},
{SOCK_STRING, N_("Result")},
{-1, ""},