diff options
author | George Vogiatzis <Gvgeo> | 2019-05-04 15:03:51 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-04 15:11:04 +0300 |
commit | b8d806caf7c904b5489d9e5ed74fcb081379a4ec (patch) | |
tree | 872e13f77ee17edba491c2ff275ef8d39b50b18a /source | |
parent | e474549da5e2a5fa8dc3e80ce01aa8dc08d2f265 (diff) |
UI: Add Look Developer Balls Size option
Note: Some adjustments were made compared to the diff mainly for code
readability and made the default ball size 150px.
Reviewed By: fclem
Differential Revision: http://developer.blender.org/D4793
Diffstat (limited to 'source')
4 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index 91611fe8c74..46fd58e59c1 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -551,6 +551,10 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) userdef->vbocollectrate = 60; userdef->vbotimeout = 120; } + + if (userdef->lookdev_ball_size == 0) { + userdef->lookdev_ball_size = 150; + } } if (userdef->pixelsize == 0.0f) { diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c index 4be87bf1a5e..13f7ab1c562 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.c +++ b/source/blender/draw/engines/eevee/eevee_lookdev.c @@ -76,7 +76,11 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, rcti rect; ED_region_visible_rect(draw_ctx->ar, &rect); - const int ball_size = max_ii(BLI_rcti_size_x(&rect) * 0.1f, 100.0f) * U.dpi_fac; + /* Make the viewport width scale the lookdev balls a bit. + * Scale between 1000px and 2000px. */ + const float viewport_scale = clamp_f( + BLI_rcti_size_x(&rect) / (2000.0f * U.dpi_fac), 0.5f, 1.0f); + const int ball_size = U.lookdev_ball_size * U.dpi_fac * viewport_scale; if (ball_size != effects->ball_size || rect.xmax != effects->anchor[0] || rect.ymin != effects->anchor[1]) { diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 4a7b46fc154..e3773e8b670 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -643,7 +643,7 @@ typedef struct UserDef { char _pad3[4]; short gizmo_flag, gizmo_size; short edit_studio_light; - char _pad6[2]; + short lookdev_ball_size; short vbotimeout, vbocollectrate; short textimeout, texcollectrate; int memcachelimit; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index eade12be631..a9bec8262dd 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -4108,6 +4108,15 @@ 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"); + /* Lookdev */ + prop = RNA_def_property(srna, "lookdev_ball_size", PROP_INT, PROP_PIXEL); + RNA_def_property_int_sdna(prop, NULL, "lookdev_ball_size"); + RNA_def_property_range(prop, 50, 400); + RNA_def_property_int_default(prop, 150); + RNA_def_property_ui_text( + prop, "LookDev Balls Size", "Maximum diameter of the LookDev balls size"); + 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"); |