UI: move object origin size preference to themes

Differential Revision: https://developer.blender.org/D4657
This commit is contained in:
George Vogiatzis 2019-05-01 17:42:50 +02:00 • committed by Brecht Van Lommel
parent 5b7806510f
commit a8bdb357b4
11 changed files with 28 additions and 23 deletions

View file

@ -355,6 +355,7 @@ const bTheme U_theme_default = {
.handle_sel_align = RGBA(0xf090a0ff),
.vertex_size = 3,
.outline_width = 1,
.obcenter_dia = 6,
.facedot_size = 3,
.editmesh_active = RGBA(0xffffff80),
.clipping_border_3d = RGBA(0x313131ff),

View file

@ -408,6 +408,7 @@
paint_curve_handle="#7fff7f7f"
paint_curve_pivot="#ff7f7f7f"
outline_width="1"
obcenter_dia="6"
>
<space>
<ThemeSpaceGradient

View file

@ -579,10 +579,7 @@ class USERPREF_PT_viewport_display(PreferencePanel, Panel):
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
col = flow.column()
col.prop(view, "gizmo_size", text="Gizmo Size")
col.prop(view, "object_origin_size")
col.separator()
flow.prop(view, "gizmo_size", text="Gizmo Size")
flow.separator()

View file

@ -113,6 +113,15 @@ static void do_versions_theme(UserDef *userdef, bTheme *btheme)
FROM_DEFAULT_V4_UCHAR(space_info.info_info);
}
/**
* Include next version bump.
*/
{
if (btheme->space_view3d.obcenter_dia == 0) {
btheme->space_view3d.obcenter_dia = U_theme_default.space_view3d.obcenter_dia;
}
}
#undef FROM_DEFAULT_V4_UCHAR
#undef USER_VERSION_ATLEAST
@ -212,9 +221,6 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
}
if (!USER_VERSION_ATLEAST(240, 0)) {
userdef->uiflag |= USER_PLAINMENUS;
if (userdef->obcenter_dia == 0) {
userdef->obcenter_dia = 6;
}
}
if (!USER_VERSION_ATLEAST(242, 0)) {
/* set defaults for 3D View rotating axis indicator */

View file

@ -142,7 +142,7 @@ void DRW_globals_update(void)
UI_GetThemeColorShadeAlpha4fv(TH_WIRE, 0, -30, gb->colorOutline);
UI_GetThemeColorShadeAlpha4fv(TH_LIGHT, 0, 255, gb->colorLightNoAlpha);
gb->sizeLightCenter = (U.obcenter_dia + 1.5f) * U.pixelsize;
gb->sizeLightCenter = (UI_GetThemeValuef(TH_OBCENTER_DIA) + 1.5f) * U.pixelsize;
gb->sizeLightCircle = U.pixelsize * 9.0f;
gb->sizeLightCircleShadow = gb->sizeLightCircle + U.pixelsize * 3.0f;

View file

@ -1502,7 +1502,7 @@ static void OBJECT_cache_init(void *vedata)
psl->ob_center = DRW_pass_create("Obj Center Pass", state);
outlineWidth = 1.0f * U.pixelsize;
size = U.obcenter_dia * U.pixelsize + outlineWidth;
size = UI_GetThemeValuef(TH_OBCENTER_DIA) * U.pixelsize + outlineWidth;
GPUShader *sh = GPU_shader_get_builtin_shader_with_config(
GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA, draw_ctx->sh_cfg);

View file

@ -92,6 +92,7 @@ typedef enum ThemeColorID {
TH_VERTEX_UNREFERENCED,
TH_VERTEX_SIZE,
TH_OUTLINE_WIDTH,
TH_OBCENTER_DIA,
TH_EDGE,
TH_EDGE_SELECT,
TH_EDGE_SEAM,

View file

@ -366,6 +366,9 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case TH_OUTLINE_WIDTH:
cp = &ts->outline_width;
break;
case TH_OBCENTER_DIA:
cp = &ts->obcenter_dia; break;
break;
case TH_EDGE:
cp = ts->edge;
break;

View file

@ -758,7 +758,6 @@ void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, bool a
short flag = v3d->flag;
float glalphaclip = U.glalphaclip;
int obcenter_dia = U.obcenter_dia;
/* temp set drawtype to solid */
/* Setting these temporarily is not nice */
v3d->flag &= ~V3D_SELECT_OUTLINE;
@ -766,7 +765,6 @@ void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, bool a
/* not that nice but means we wont zoom into billboards */
U.glalphaclip = alphaoverride ? 0.5f : glalphaclip;
U.obcenter_dia = 0;
/* Tools may request depth outside of regular drawing code. */
UI_Theme_Store(&theme_state);
@ -797,7 +795,6 @@ void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, bool a
U.glalphaclip = glalphaclip;
v3d->flag = flag;
U.obcenter_dia = obcenter_dia;
UI_Theme_Restore(&theme_state);
}

View file

@ -300,12 +300,12 @@ typedef struct ThemeSpace {
char keytype_keyframe_select[4], keytype_extreme_select[4], keytype_breakdown_select[4],
keytype_jitter_select[4], keytype_movehold_select[4];
char keyborder[4], keyborder_select[4];
char _pad4[4];
char _pad4[3];
char console_output[4], console_input[4], console_info[4], console_error[4];
char console_cursor[4], console_select[4];
char vertex_size, outline_width, facedot_size;
char vertex_size, outline_width, obcenter_dia, facedot_size;
char noodle_curving;
/* syntax for textwindow and nodes */
@ -650,8 +650,7 @@ typedef struct UserDef {
int prefetchframes;
/** Control the rotation step of the view when PAD2, PAD4, PAD6&PAD8 is use. */
float pad_rot_angle;
char _pad12[2];
short obcenter_dia;
char _pad12[4];
/** Rotating view icon size. */
short rvisize;
/** Rotating view icon brightness. */

View file

@ -2031,6 +2031,13 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
RNA_def_property_range(prop, 1, 5);
RNA_def_property_ui_text(prop, "Outline Width", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "object_origin_size", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "obcenter_dia");
RNA_def_property_range(prop, 4, 10);
RNA_def_property_ui_text(
prop, "Object Origin Size", "Diameter in Pixels for Object/Light origin display");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_graph(BlenderRNA *brna)
@ -4101,13 +4108,6 @@ static void rna_def_userdef_view(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Gizmo Size", "Diameter of the gizmo");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "object_origin_size", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "obcenter_dia");
RNA_def_property_range(prop, 4, 10);
RNA_def_property_ui_text(
prop, "Object Origin Size", "Diameter in Pixels for Object/Light origin display");
RNA_def_property_update(prop, 0, "rna_userdef_update");
/* View2D Grid Displays */
prop = RNA_def_property(srna, "view2d_grid_spacing_min", PROP_INT, PROP_PIXEL);
RNA_def_property_int_sdna(prop, NULL, "v2d_min_gridsize");