Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-06-09 17:13:09 +0300
committerHans Goudey <h.goudey@me.com>2021-06-09 17:13:09 +0300
commitec98bb318b938f829859ee7dfa1a96d1171c2a64 (patch)
tree8f6c55e5e39857c249611b2402667f4742ed8be9 /source/blender
parent3a7ab62eac05e700372a2b17b901b0181be82abe (diff)
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
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_node/drawnode.cc2
-rw-r--r--source/blender/makesdna/DNA_node_types.h6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_collection_info.cc11
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_material_assign.cc11
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_object_info.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_point_instance.cc13
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_select_by_material.cc11
7 files changed, 50 insertions, 6 deletions
diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc
index c6fa6c78f05..1d4c3b67387 100644
--- a/source/blender/editors/space_node/drawnode.cc
+++ b/source/blender/editors/space_node/drawnode.cc
@@ -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:
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 1ab6c5e52a6..c005e1d52d2 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -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? */
diff --git a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
index 9bc8a4bb4be..b2dc4661e9c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
@@ -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, ""},
};
diff --git a/source/blender/nodes/geometry/nodes/node_geo_material_assign.cc b/source/blender/nodes/geometry/nodes/node_geo_material_assign.cc
index 8c245afd3d2..02b2d685bdd 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_material_assign.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_material_assign.cc
@@ -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, ""},
};
diff --git a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
index 16c943b310c..167812d5656 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc
@@ -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, ""},
};
diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc b/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc
index 44b8b14f4e7..e52ab1b2127 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc
@@ -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, ""},
};
diff --git a/source/blender/nodes/geometry/nodes/node_geo_select_by_material.cc b/source/blender/nodes/geometry/nodes/node_geo_select_by_material.cc
index 51be90d316e..9bc963eec43 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_select_by_material.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_select_by_material.cc
@@ -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, ""},
};