[Bf-blender-cvs] [cd692c69546] master: Geometry Nodes: Add labels for switch node texture sockets

Wannes Malfait noreply at git.blender.org
Tue Aug 10 00:31:40 CEST 2021


Commit: cd692c6954629e977250ec7c12509ffd3f90bd07
Author: Wannes Malfait
Date:   Mon Aug 9 17:30:44 2021 -0500
Branches: master
https://developer.blender.org/rBcd692c6954629e977250ec7c12509ffd3f90bd07

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.

===================================================================

M	source/blender/editors/space_node/drawnode.cc
M	source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc

===================================================================

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, ""},



More information about the Bf-blender-cvs mailing list