UI: Added Edge Width option in preferences for 3DView and UV/Image Editor

Previously [D16255](https://developer.blender.org/D16255)
There is no option to adjust the edge_width like there is in the preferences for vertex_size and face_dot_size.

I only added the option for 3DView and UV/Image Editor, and limited both to a max size of 5 pixel, since the edges do not look very nice with too high values.
In the UV Editor only, there are always black outlines on the edges, I could not find a way to reduce the increasing thickness of these black outlines.

The default edge_width of 1 pixel:

![shows the marked new attribute with a value of 1 in the settings for the UV/Imageeditor](/attachments/f48fc1e5-2b49-4337-bd86-f2ad4aca42c3)

Here the edge_width with a falue of 3:

![shows the marked new attribute with a value of 3 in the settings for the UV/Imageeditor](/attachments/d0b0b1ea-5967-46b2-80a2-ccae18933638)

And here the visible increase of the dark border of the edges and their overlap (even at the maxed size of 5):

![shows the marked new attribute with a value of 5 in the settings for the UV/Imageeditor and points out the thicker border in the left side UV Editor](/attachments/1590965f-af2a-49d0-a11e-1afecaabf940)

Lastly for the 3DView the max edge_width of 5 looks like this:

![shows the marked new attribute with a value of 5 for the settings for the 3DView and it's resulting wider lines in the right side visible 3DView](/attachments/fcd35341-97a5-4db6-8bbf-c5ce5333e5aa)

Pull Request #104741
This commit is contained in:
Patrick Busch 2023-02-27 20:02:37 +01:00 committed by Clément Foucault
parent f37077ae5a
commit 5ea41a9942
6 changed files with 20 additions and 4 deletions

@ -363,6 +363,7 @@ const bTheme U_theme_default = {
.handle_sel_vect = RGBA(0x40c030ff),
.handle_sel_align = RGBA(0xf090a0ff),
.vertex_size = 3,
.edge_width = 1,
.outline_width = 1,
.obcenter_dia = 6,
.facedot_size = 3,
@ -717,6 +718,7 @@ const bTheme U_theme_default = {
.handle_sel_auto = RGBA(0xf0ff40ff),
.handle_sel_align = RGBA(0xf090a0ff),
.vertex_size = 3,
.edge_width = 1,
.outline_width = 1,
.facedot_size = 3,
.editmesh_active = RGBA(0xffffff40),

@ -175,8 +175,8 @@ void DRW_globals_update(void)
max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * (float)M_SQRT2 / 2.0f);
gb->size_vertex_gpencil = U.pixelsize * UI_GetThemeValuef(TH_GP_VERTEX_SIZE);
gb->size_face_dot = U.pixelsize * UI_GetThemeValuef(TH_FACEDOT_SIZE);
gb->size_edge = U.pixelsize * (1.0f / 2.0f); /* TODO: Theme. */
gb->size_edge_fix = U.pixelsize * (0.5f + 2.0f * (2.0f * (gb->size_edge * (float)M_SQRT1_2)));
gb->size_edge = U.pixelsize * max_ff(1.0f, UI_GetThemeValuef(TH_EDGE_WIDTH)) / 2.0f;
gb->size_edge_fix = U.pixelsize * (0.5f + 2.0f * (1.0f * (gb->size_edge * (float)M_SQRT1_2)));
gb->pixel_fac = *DRW_viewport_pixelsize_get();

@ -79,6 +79,7 @@ typedef enum ThemeColorID {
TH_VERTEX_ACTIVE,
TH_VERTEX_UNREFERENCED,
TH_VERTEX_SIZE,
TH_EDGE_WIDTH,
TH_OUTLINE_WIDTH,
TH_OBCENTER_DIA,
TH_EDGE,

@ -366,6 +366,9 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case TH_EDGE:
cp = ts->edge;
break;
case TH_EDGE_WIDTH:
cp = &ts->edge_width;
break;
case TH_EDGE_SELECT:
cp = ts->edge_select;
break;

@ -309,10 +309,10 @@ typedef struct ThemeSpace {
unsigned char console_output[4], console_input[4], console_info[4], console_error[4];
unsigned char console_cursor[4], console_select[4];
unsigned char vertex_size, outline_width, obcenter_dia, facedot_size;
unsigned char vertex_size, edge_width, outline_width, obcenter_dia, facedot_size;
unsigned char noodle_curving;
unsigned char grid_levels;
char _pad5[3];
char _pad5[2];
float dash_alpha;
/* Syntax for text-window and nodes. */

@ -2200,6 +2200,11 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
prop, "Wire Edit", "Color for wireframe when in edit mode, but edge selection is active");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "edge_width", PROP_INT, PROP_PIXEL);
RNA_def_property_range(prop, 1, 5);
RNA_def_property_ui_text(prop, "Edge Width", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* Grease Pencil */
rna_def_userdef_theme_spaces_gpencil(srna);
@ -3044,6 +3049,11 @@ static void rna_def_userdef_theme_space_image(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Wire Edit", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "edge_width", PROP_INT, PROP_PIXEL);
RNA_def_property_range(prop, 1, 5);
RNA_def_property_ui_text(prop, "Edge Width", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "edge_select", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Edge Select", "");