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

Merged
Clément Foucault merged 4 commits from Xylvier/blender:xylvier-edge-width-patch into main 2023-02-27 20:02:49 +01:00
6 changed files with 20 additions and 4 deletions

View File

@ -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),

View File

@ -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)));
fclem marked this conversation as resolved

I don't understand this value. It looks like it was copied from gb->size_vertex. For point size it make sense because there was a square dot to circle dot surface conversion (from the 2.8 days).

To me, the right value should be:

U.pixelsize * max_ff(1.0f, UI_GetThemeValuef(TH_EDGE_WIDTH)) / 2.0f;
I don't understand this value. It looks like it was copied from `gb->size_vertex`. For point size it make sense because there was a square dot to circle dot surface conversion (from the 2.8 days). To me, the right value should be: ``` U.pixelsize * max_ff(1.0f, UI_GetThemeValuef(TH_EDGE_WIDTH)) / 2.0f;
gb->pixel_fac = *DRW_viewport_pixelsize_get();

View File

@ -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,

View File

@ -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;

View File

@ -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. */

View File

@ -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", "");