diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-02-19 21:11:47 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-02-19 21:12:46 +0300 |
commit | 05fd2acf895847c51d8c02166a87d9fa50def39c (patch) | |
tree | 0b0eb65f52501288f897ca1ef4eab7f29d412389 /source/blender/makesrna | |
parent | 2df040ed58fb9e80ae69f50262bb702f50f0d71f (diff) |
Theme: Radial gradient background and enum for gradient type
This commit replaces the "Use Gradient" checkbox theme option with an
enum and implements a radial background.
Whith this change, it should be easier to implemet other types of more
complex background types, like a world space oriented gradient.
Reviewed By: billreynish, fclem, brecht
Differential Revision: https://developer.blender.org/D6825
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7d782efb7cf..571643a91f5 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1306,6 +1306,25 @@ static void rna_def_userdef_theme_ui_panel(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); } +const EnumPropertyItem rna_enum_userdef_theme_background_types_items[] = { + {TH_BACKGROUND_SINGLE_COLOR, + "Single Color", + 0, + "Single Color", + "Use a solid color as viewport background"}, + {TH_BACKGROUND_GRADIENT_LINEAR, + "LINEAR", + 0, + "Linear Gradient", + "Use a screen space vertical linear gradient as viewport background"}, + {TH_BACKGROUND_GRADIENT_RADIAL, + "RADIAL", + 0, + "Vignette", + "Use a radial gradient as viewport background"}, + {0, NULL, 0, NULL, NULL}, +}; + static void rna_def_userdef_theme_ui_gradient(BlenderRNA *brna) { /* Fake struct, keep this for compatible theme presets. */ @@ -1318,10 +1337,10 @@ static void rna_def_userdef_theme_ui_gradient(BlenderRNA *brna) RNA_def_struct_ui_text( srna, "Theme Background Color", "Theme settings for background colors and gradient"); - prop = RNA_def_property(srna, "show_grad", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "show_back_grad", 1); - RNA_def_property_ui_text( - prop, "Use Gradient", "Do a gradient for the background of the viewport working area"); + prop = RNA_def_property(srna, "background_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "background_type"); + RNA_def_property_enum_items(prop, rna_enum_userdef_theme_background_types_items); + RNA_def_property_ui_text(prop, "Background Type", "Type of background in the 3D viewport"); RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); prop = RNA_def_property(srna, "high_gradient", PROP_FLOAT, PROP_COLOR_GAMMA); |