diff options
author | Wannes Malfait <Wannes> | 2021-08-10 01:30:44 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-08-10 01:30:44 +0300 |
commit | cd692c6954629e977250ec7c12509ffd3f90bd07 (patch) | |
tree | e202963e9dafa7982c8171674fc79588f5208870 /source | |
parent | 3b87fd376adb599877740ca52ee8098622ba56fb (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_node/drawnode.cc | 22 | ||||
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc | 2 |
2 files changed, 21 insertions, 3 deletions
diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index 95eb1ccc025..b5acdede81b 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -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: { diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc index e0a3f5ad334..5f02061da97 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc @@ -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, ""}, |