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:
-rw-r--r--source/blender/editors/space_node/drawnode.c5
-rw-r--r--source/blender/editors/space_node/node_draw.cc18
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);
}