UI: Add the option to not display some socket labels

This commit adds a flag to disable displaying some socket labels which
just redundant eye sores. We still want to have a label, because that
information can potentially be accessed elsewhere in the UI.

The flag is used in a few geometry nodes.

Differential Revision: https://developer.blender.org/D11540
This commit is contained in:
Hans Goudey 2021-06-09 09:13:09 -05:00
parent 3a7ab62eac
commit ec98bb318b
Notes: blender-bot 2023-02-14 04:46:12 +01:00
Referenced by issue #88542, Add the option to not display some socket labels
7 changed files with 50 additions and 6 deletions

View File

@ -3541,6 +3541,8 @@ static void std_node_socket_draw(
return;
}
text = (sock->flag & SOCK_HIDE_LABEL) ? "" : text;
switch (type) {
case SOCK_FLOAT:
case SOCK_INT:

View File

@ -210,6 +210,12 @@ typedef enum eNodeSocketFlag {
SOCK_COMPACT = (1 << 10),
/** Make the input socket accept multiple incoming links in the UI. */
SOCK_MULTI_INPUT = (1 << 11),
/**
* Don't show the socket's label in the interface, for situations where the type is obvious and
* the name takes up too much space. Note that it doesn't really make sense for this to be stored
* in runtime data.
*/
SOCK_HIDE_LABEL = (1 << 12),
} eNodeSocketFlag;
/* limit data in bNode to what we want to see saved? */

View File

@ -24,7 +24,16 @@
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_collection_info_in[] = {
{SOCK_COLLECTION, N_("Collection")},
{SOCK_COLLECTION,
N_("Collection"),
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
PROP_NONE,
SOCK_HIDE_LABEL},
{-1, ""},
};

View File

@ -26,7 +26,16 @@
static bNodeSocketTemplate geo_node_material_assign_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_MATERIAL, N_("Material")},
{SOCK_MATERIAL,
N_("Material"),
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
PROP_NONE,
SOCK_HIDE_LABEL},
{SOCK_STRING, N_("Selection")},
{-1, ""},
};

View File

@ -22,7 +22,7 @@
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_object_info_in[] = {
{SOCK_OBJECT, N_("Object")},
{SOCK_OBJECT, N_("Object"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, PROP_NONE, SOCK_HIDE_LABEL},
{-1, ""},
};

View File

@ -26,8 +26,17 @@
static bNodeSocketTemplate geo_node_point_instance_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_OBJECT, N_("Object")},
{SOCK_COLLECTION, N_("Collection")},
{SOCK_OBJECT, N_("Object"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, PROP_NONE, SOCK_HIDE_LABEL},
{SOCK_COLLECTION,
N_("Collection"),
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
PROP_NONE,
SOCK_HIDE_LABEL},
{SOCK_INT, N_("Seed"), 0, 0, 0, 0, -10000, 10000},
{-1, ""},
};

View File

@ -28,7 +28,16 @@
static bNodeSocketTemplate geo_node_select_by_material_in[] = {
{SOCK_GEOMETRY, N_("Geometry")},
{SOCK_MATERIAL, N_("Material")},
{SOCK_MATERIAL,
N_("Material"),
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
PROP_NONE,
SOCK_HIDE_LABEL},
{SOCK_STRING, N_("Selection")},
{-1, ""},
};