diff options
author | Fabian Schempp <fabian_schempp> | 2021-02-24 22:01:24 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-02-24 22:01:24 +0300 |
commit | b54b56fcbea62b958dc48441b150aecfb04c8a00 (patch) | |
tree | c18ef6b6519c80d2cb4a68bfb01ce0b1eac56905 /source/blender/editors | |
parent | 89196765ba28e3d48e45c0f9f3c69d9d0b5fb624 (diff) |
UI: Make node virtual sockets more visible
This commit tweaks how virtual sockets (unconnected node group input
and output sockets) are drawn to make them more recognizable. The
outline is changed to a gray color, and they get a dark inner color.
Differential Revision: https://developer.blender.org/D10080
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_draw.cc | 18 |
2 files changed, 17 insertions, 6 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 4716f1c29ea..82a1cd818c9 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -3261,6 +3261,8 @@ void ED_init_custom_node_socket_type(bNodeSocketType *stype) stype->draw = node_socket_button_label; } +static const float virtual_node_socket_color[4] = {0.2, 0.2, 0.2, 1.0}; + /* maps standard socket integer type to a color */ static const float std_node_socket_colors[][4] = { {0.63, 0.63, 0.63, 1.0}, /* SOCK_FLOAT */ @@ -3461,8 +3463,7 @@ static void node_socket_virtual_draw_color(bContext *UNUSED(C), PointerRNA *UNUSED(node_ptr), float *r_color) { - /* alpha = 0, empty circle */ - zero_v4(r_color); + copy_v4_v4(r_color, virtual_node_socket_color); } void ED_init_node_socket_type_virtual(bNodeSocketType *stype) diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 40d62b0b10f..83c7dd8eea5 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -791,7 +791,11 @@ static void node_socket_draw_multi_input(const float color[4], &rect, color, nullptr, 1.0f, color_outline, outline_width, width - outline_width * 0.5f); } -static void node_socket_outline_color_get(bool selected, float r_outline_color[4]) +static const float virtual_node_socket_outline_color[4] = {0.5, 0.5, 0.5, 1.0}; + +static void node_socket_outline_color_get(const bool selected, + const int socket_type, + float r_outline_color[4]) { if (selected) { UI_GetThemeColor4fv(TH_TEXT_HI, r_outline_color); @@ -801,6 +805,12 @@ static void node_socket_outline_color_get(bool selected, float r_outline_color[4 copy_v4_fl(r_outline_color, 0.0f); r_outline_color[3] = 0.6f; } + + /* Until there is a better place for per socket color, + * the outline color for virtual sockets is set here. */ + if (socket_type == SOCK_CUSTOM) { + copy_v4_v4(r_outline_color, virtual_node_socket_outline_color); + } } /* Usual convention here would be node_socket_get_color(), but that's already used (for setting a @@ -836,7 +846,7 @@ static void node_socket_draw_nested(const bContext *C, float outline_color[4]; node_socket_color_get((bContext *)C, ntree, node_ptr, sock, color); - node_socket_outline_color_get(selected, outline_color); + node_socket_outline_color_get(selected, sock->type, outline_color); node_socket_draw(sock, color, @@ -862,7 +872,7 @@ void ED_node_socket_draw(bNodeSocket *sock, const rcti *rect, const float color[ rcti draw_rect = *rect; float outline_color[4] = {0}; - node_socket_outline_color_get(sock->flag & SELECT, outline_color); + node_socket_outline_color_get(sock->flag & SELECT, sock->type, outline_color); BLI_rcti_resize(&draw_rect, size, size); @@ -1177,7 +1187,7 @@ void node_draw_sockets(const View2D *v2d, float color[4]; float outline_color[4]; node_socket_color_get((bContext *)C, ntree, &node_ptr, socket, color); - node_socket_outline_color_get(selected, outline_color); + node_socket_outline_color_get(selected, socket->type, outline_color); node_socket_draw_multi_input(color, outline_color, width, height, socket->locx, socket->locy); } |