Fix #147810: Node outline missing theme setting

The subtle outline introduced in 916f0afd45 is too strong in light
themes, with users reporting eye strain (#147810).

Add a theme setting instead so it's possible to adjust it or make
it fully transparent. Similar to panels.

This is also an improvement in accessibility because contrast can be
enhanced in regular nodes, not just the active and selected ones.

See PR for screenshots.

Fixes #147810

Pull Request: https://projects.blender.org/blender/blender/pulls/148532
This commit is contained in:
Pablo Vazquez 2025-10-22 12:32:21 +02:00 • committed by Pablo Vazquez
parent 90f719032a
commit d2ea3598b7
8 changed files with 20 additions and 48 deletions

View file

@ -674,6 +674,7 @@ const bTheme U_theme_default = {
.syntaxc = RGBA(0x374725ff),
.syntaxd = RGBA(0x3e5a5bff),
.syntaxr = RGBA(0x8d8d8dff),
.node_outline = RGBA(0xffffff26),
.nodeclass_output = RGBA(0x3e232aff),
.nodeclass_filter = RGBA(0x412b51ff),
.nodeclass_vector = RGBA(0x3c3c83ff),

View file

@ -780,6 +780,7 @@
wire_inner="#8d8d8d"
wire_select="#ffffffb3"
node_backdrop="#666666ff"
node_outline="#00000026"
converter_node="#4482a3"
color_node="#8e8e3f"
group_node="#566643"

View file

@ -408,6 +408,8 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
style->tooltip.shadowalpha = 0.5f;
style->tooltip.shadowcolor = 0.0f;
}
FROM_DEFAULT_V4_UCHAR(space_node.node_outline);
}
/**

View file

@ -183,6 +183,7 @@ enum ThemeColorID {
TH_EMPTY,
TH_NODE,
TH_NODE_OUTLINE,
TH_NODE_INPUT,
TH_NODE_OUTPUT,
TH_NODE_COLOR,

View file

@ -628,6 +628,9 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case TH_NODE:
cp = ts->syntaxl;
break;
case TH_NODE_OUTLINE:
cp = ts->node_outline;
break;
case TH_NODE_INPUT:
cp = ts->syntaxn;
break;

View file

@ -3266,7 +3266,7 @@ static void node_draw_basis(const bContext &C,
rct.xmin - padding,
rct.xmax + padding,
rct.ymin - padding,
rct.ymax - (NODE_DY + outline_width) + padding,
rct.ymax - NODE_DY + padding,
};
/* Node Group indicator. */
@ -3282,49 +3282,8 @@ static void node_draw_basis(const bContext &C,
}
}
/* Outlines. */
/* Outline around the entire node to highlight selection, alert, or for simulation zones. */
{
/* Body outline. */
const rctf rect_body = {
rct.xmin - 0,
rct.xmax + 0,
rct.ymin,
rct.ymax - (NODE_DY),
};
float color_body[4];
if (node_undefined_or_unsupported(ntree, node)) {
UI_GetThemeColorShade4fv(TH_REDALERT, -40, color_body);
}
else if (node.is_muted()) {
UI_GetThemeColorBlend4f(TH_BACK, TH_NODE, 0.6f, color_body);
}
else {
UI_GetThemeColorShade4fv(TH_NODE, 20, color_body);
}
UI_draw_roundbox_corner_set(UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT);
UI_draw_roundbox_4fv(&rect_body, false, BASIS_RAD, color_body);
/* Header outline. */
const rctf rect_header = {
rct.xmin,
rct.xmax,
rct.ymax - (NODE_DY + outline_width),
rct.ymax,
};
float color_header[4];
if (node_undefined_or_unsupported(ntree, node)) {
UI_GetThemeColorShade4fv(TH_REDALERT, -40, color_header);
}
else if (node.is_muted()) {
UI_GetThemeColorBlend4f(TH_BACK, color_id, 0.6f, color_header);
}
else {
UI_GetThemeColorShade4fv(color_id, 20, color_header);
}
UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
UI_draw_roundbox_4fv(&rect_header, false, BASIS_RAD, color_header);
/* Outline around the entire node to highlight selection, alert, or for simulation zones. */
const rctf rect_node = {
rct.xmin - outline_width,
rct.xmax + outline_width,
@ -3343,8 +3302,7 @@ static void node_draw_basis(const bContext &C,
color_outline[3] = 1.0f;
}
else {
UI_GetThemeColorShade4fv(TH_NODE, 20, color_outline);
color_outline[3] = 0.0f;
UI_GetThemeColor4fv(TH_NODE_OUTLINE, color_outline);
}
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_4fv(&rect_node, false, BASIS_RAD + outline_width, color_outline);
@ -3490,8 +3448,7 @@ static void node_draw_collapsed(const bContext &C,
UI_GetThemeColorBlendShade4fv(TH_BACK, color_id, .4f, 10, color_outline);
}
else {
/* Use a mix of the backdrop and node type color, slightly lighter. */
UI_GetThemeColorBlendShade4fv(TH_BACK, color_id, .8f, 20, color_outline);
UI_GetThemeColor4fv(TH_NODE_OUTLINE, color_outline);
}
UI_draw_roundbox_corner_set(UI_CNR_ALL);

View file

@ -339,7 +339,6 @@ typedef struct ThemeSpace {
unsigned char nurb_uline[4], nurb_vline[4];
unsigned char nurb_sel_uline[4], nurb_sel_vline[4];
char _pad5[4];
/** Dope-sheet. */
unsigned char ds_ipoline[4];
@ -364,6 +363,8 @@ typedef struct ThemeSpace {
unsigned char line_numbers[4];
unsigned char node_outline[4];
unsigned char nodeclass_output[4], nodeclass_filter[4];
unsigned char nodeclass_vector[4], nodeclass_texture[4];
unsigned char nodeclass_shader[4], nodeclass_script[4];

View file

@ -3429,6 +3429,12 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Grid", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "node_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, nullptr, "node_outline");
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Node Outline", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "node_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, nullptr, "select");
RNA_def_property_array(prop, 3);