diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-22 14:57:42 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-22 22:47:51 +0300 |
commit | 15ca90489fa85cb5c61be98eeafc2c35fdcbaa7f (patch) | |
tree | a0b7e724d9554501c8dba07aa942af71fbf188ac /source/blender/makesrna/intern/rna_userdef.c | |
parent | b8404be8a880626b2fa2b761cc650d3ea7adec38 (diff) |
UI: make button roundness themeable.
Diffstat (limited to 'source/blender/makesrna/intern/rna_userdef.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7fa43e0187b..9ff2ee4fe4b 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -640,6 +640,19 @@ static StructRNA *rna_AddonPref_refine(PointerRNA *ptr) return (ptr->type) ? ptr->type : &RNA_AddonPreferences; } +static float rna_ThemeUI_roundness_get(PointerRNA *ptr) +{ + /* Remap from relative radius to 0..1 range. */ + uiWidgetColors *tui = (uiWidgetColors *)ptr->data; + return tui->roundness * 2.0f; +} + +static void rna_ThemeUI_roundness_set(PointerRNA *ptr, float value) +{ + uiWidgetColors *tui = (uiWidgetColors *)ptr->data; + tui->roundness = value * 0.5f; +} + #else /* TODO(sergey): This technically belongs to blenlib, but we don't link @@ -810,6 +823,11 @@ static void rna_def_userdef_theme_ui_wcol(BlenderRNA *brna) RNA_def_property_range(prop, -100, 100); RNA_def_property_ui_text(prop, "Shade Down", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "roundness", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_funcs(prop, "rna_ThemeUI_roundness_get", "rna_ThemeUI_roundness_set", NULL); + RNA_def_property_ui_text(prop, "Roundness", "Amount of edge rounding"); + RNA_def_property_update(prop, 0, "rna_userdef_update"); } static void rna_def_userdef_theme_ui_wcol_state(BlenderRNA *brna) |