From 5c6d5cb8639aa71e2728258e9a4afe7c9d822bc7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 11 Jan 2019 12:59:19 +1100 Subject: Fix background color use in 3D view TH_BACK was being used when drawing the 3D view even though there was no way to set the color in the preferences. The color was zero'd when moving to the new 2.8x theme. Having both gradient and background colors was confusing, especially having to use 'TH_HIGH_GRAD' for the 3D view, 'TH_BACK' for other views. Move the background color back to 'TH_BACK', 'TH_BACK_GRAD' is used when gradients are enabled. RNA is unchanged so presets don't need updating. --- source/blender/makesrna/intern/rna_userdef.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7600c6c98d1..15f20a6aba7 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -418,6 +418,11 @@ static PointerRNA rna_Theme_space_generic_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGeneric, ptr->data); } +static PointerRNA rna_Theme_gradient_colors_get(PointerRNA *ptr) +{ + return rna_pointer_inherit_refine(ptr, &RNA_ThemeGradientColors, ptr->data); +} + static PointerRNA rna_Theme_space_gradient_get(PointerRNA *ptr) { return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGradient, ptr->data); @@ -1045,27 +1050,31 @@ static void rna_def_userdef_theme_ui_panel(BlenderRNA *brna) static void rna_def_userdef_theme_ui_gradient(BlenderRNA *brna) { + /* Fake struct, keep this for compatible theme presets. */ StructRNA *srna; PropertyRNA *prop; srna = RNA_def_struct(brna, "ThemeGradientColors", NULL); - RNA_def_struct_sdna(srna, "uiGradientColors"); + RNA_def_struct_sdna(srna, "ThemeSpace"); RNA_def_struct_clear_flag(srna, STRUCT_UNDO); 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"); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop = RNA_def_property(srna, "gradient", PROP_FLOAT, PROP_COLOR_GAMMA); + prop = RNA_def_property(srna, "high_gradient", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "back"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Gradient Low", ""); + RNA_def_property_ui_text(prop, "Gradient High/Off", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - prop = RNA_def_property(srna, "high_gradient", PROP_FLOAT, PROP_COLOR_GAMMA); + prop = RNA_def_property(srna, "gradient", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "back_grad"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Gradient High/Off", ""); + RNA_def_property_ui_text(prop, "Gradient Low", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); } @@ -1415,6 +1424,8 @@ static void rna_def_userdef_theme_space_gradient(BlenderRNA *brna) /* gradient/background settings */ prop = RNA_def_property(srna, "gradients", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "ThemeGradientColors"); + RNA_def_property_pointer_funcs(prop, "rna_Theme_gradient_colors_get", NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Gradient Colors", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); -- cgit v1.2.3