Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-01-11 04:59:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-11 04:59:19 +0300
commit5c6d5cb8639aa71e2728258e9a4afe7c9d822bc7 (patch)
tree6633ee4150ef2246ffa8ced974f1b883d1d4bb44 /source
parentf98e4cbedbb73d22b649275208e0318838dea089 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c16
-rw-r--r--source/blender/draw/engines/eevee/eevee_lookdev.c2
-rw-r--r--source/blender/draw/engines/workbench/workbench_data.c4
-rw-r--r--source/blender/draw/intern/draw_common.c4
-rw-r--r--source/blender/draw/intern/draw_view.c6
-rw-r--r--source/blender/editors/include/UI_resources.h4
-rw-r--r--source/blender/editors/interface/resources.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_utils.c2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h14
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c21
11 files changed, 49 insertions, 36 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index bc2212f6091..25daceab13d 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -28,7 +28,7 @@
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION 40
+#define BLENDER_SUBVERSION 41
/* Several breakages with 280, e.g. collections vs layers */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 4fed46170a9..3143c5069e6 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -108,6 +108,10 @@ static void do_versions_theme(UserDef *userdef, bTheme *btheme)
copy_v4_v4_char(btheme->tuserpref.execution_buts, btheme->tuserpref.navigation_bar);
}
+ if (!USER_VERSION_ATLEAST(280, 41)) {
+ copy_v4_v4_char(btheme->tv3d.back, U_theme_default.tv3d.back);
+ }
+
#undef USER_VERSION_ATLEAST
}
@@ -465,10 +469,7 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
USER_UIFLAG_DEPRECATED_22);
}
- /**
- * Include next version bump.
- */
- {
+ if (!USER_VERSION_ATLEAST(280, 41)) {
/* (keep this block even if it becomes empty). */
if (userdef->pie_tap_timeout == 0) {
@@ -476,6 +477,13 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
}
}
+ /**
+ * Include next version bump.
+ */
+ {
+ /* (keep this block even if it becomes empty). */
+ }
+
if (userdef->pixelsize == 0.0f)
userdef->pixelsize = 1.0f;
diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c
index aa2f480597b..e611894443d 100644
--- a/source/blender/draw/engines/eevee/eevee_lookdev.c
+++ b/source/blender/draw/engines/eevee/eevee_lookdev.c
@@ -109,7 +109,7 @@ void EEVEE_lookdev_cache_init(
stl->g_data->light_cache = stl->lookdev_lightcache;
static float background_color[4];
- UI_GetThemeColor4fv(TH_HIGH_GRAD, background_color);
+ UI_GetThemeColor4fv(TH_BACK, background_color);
/* XXX: Really quick conversion to avoid washed out background.
* Needs to be addressed properly (color managed using ocio). */
srgb_to_linearrgb_v4(background_color, background_color);
diff --git a/source/blender/draw/engines/workbench/workbench_data.c b/source/blender/draw/engines/workbench/workbench_data.c
index a4a449c1ee5..937378dabb4 100644
--- a/source/blender/draw/engines/workbench/workbench_data.c
+++ b/source/blender/draw/engines/workbench/workbench_data.c
@@ -67,8 +67,8 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
copy_v3_v3(wd->background_color_high, v3d->shading.background_color);
}
else if (v3d) {
- UI_GetThemeColor3fv(UI_GetThemeValue(TH_SHOW_BACK_GRAD) ? TH_LOW_GRAD : TH_HIGH_GRAD, wd->background_color_low);
- UI_GetThemeColor3fv(TH_HIGH_GRAD, wd->background_color_high);
+ UI_GetThemeColor3fv(UI_GetThemeValue(TH_SHOW_BACK_GRAD) ? TH_BACK_GRAD : TH_BACK, wd->background_color_low);
+ UI_GetThemeColor3fv(TH_BACK, wd->background_color_high);
/* XXX: Really quick conversion to avoid washed out background.
* Needs to be addressed properly (color managed using ocio). */
diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c
index 6514e4baaf3..c0e735b02a6 100644
--- a/source/blender/draw/intern/draw_common.c
+++ b/source/blender/draw/intern/draw_common.c
@@ -60,8 +60,8 @@ void DRW_globals_update(void)
UI_GetThemeColor4fv(TH_WIRE_EDIT, ts.colorWireEdit);
UI_GetThemeColor4fv(TH_ACTIVE, ts.colorActive);
UI_GetThemeColor4fv(TH_SELECT, ts.colorSelect);
- UI_GetThemeColorBlend4f(TH_SELECT, TH_HIGH_GRAD, 0.66f, ts.colorDupliSelect);
- UI_GetThemeColorBlend4f(TH_WIRE, TH_HIGH_GRAD, 0.66f, ts.colorDupli);
+ UI_GetThemeColorBlend4f(TH_SELECT, TH_BACK, 0.5f, ts.colorDupliSelect);
+ UI_GetThemeColorBlend4f(TH_WIRE, TH_BACK, 0.5f, ts.colorDupli);
UI_COLOR_RGBA_FROM_U8(0x88, 0xFF, 0xFF, 155, ts.colorLibrarySelect);
UI_COLOR_RGBA_FROM_U8(0x55, 0xCC, 0xCC, 155, ts.colorLibrary);
UI_GetThemeColor4fv(TH_TRANSFORM, ts.colorTransform);
diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c
index 4c53049e772..5f4b22c572b 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -95,8 +95,8 @@ void DRW_draw_background(void)
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR_DITHER);
- UI_GetThemeColor3ubv(TH_LOW_GRAD, col_lo);
- UI_GetThemeColor3ubv(TH_HIGH_GRAD, col_hi);
+ UI_GetThemeColor3ubv(TH_BACK_GRAD, col_lo);
+ UI_GetThemeColor3ubv(TH_BACK, col_hi);
immBegin(GPU_PRIM_TRI_FAN, 4);
immAttr3ubv(color, col_lo);
@@ -118,7 +118,7 @@ void DRW_draw_background(void)
}
else {
/* Solid background Color */
- UI_ThemeClearColorAlpha(TH_HIGH_GRAD, 1.0f);
+ UI_ThemeClearColorAlpha(TH_BACK, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
}
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 74991ad8ab1..ef0ae332fad 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -58,6 +58,8 @@ typedef enum ThemeColorID {
// common colors among spaces
TH_BACK,
+ /** Use when 'TH_SHOW_BACK_GRAD' is set (the lower, darker color). */
+ TH_BACK_GRAD,
TH_TEXT,
TH_TEXT_HI,
TH_TITLE,
@@ -296,8 +298,6 @@ typedef enum ThemeColorID {
TH_GIZMO_A,
TH_GIZMO_B,
- TH_LOW_GRAD,
- TH_HIGH_GRAD,
TH_SHOW_BACK_GRAD,
TH_INFO_SELECTED,
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 5f132295c04..3aadfeb5321 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -194,15 +194,13 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
}
cp = back;
break;
- case TH_LOW_GRAD:
- cp = ts->gradients.gradient;
- break;
- case TH_HIGH_GRAD:
- cp = ts->gradients.high_gradient;
+ case TH_BACK_GRAD:
+ cp = ts->back_grad;
break;
+
case TH_SHOW_BACK_GRAD:
cp = &setting;
- setting = ts->gradients.show_grad;
+ setting = ts->show_back_grad;
break;
case TH_TEXT:
if (theme_regionid == RGN_TYPE_WINDOW)
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c
index 540806d4b67..96f18ade149 100644
--- a/source/blender/editors/space_view3d/view3d_utils.c
+++ b/source/blender/editors/space_view3d/view3d_utils.c
@@ -88,7 +88,7 @@ void ED_view3d_background_color_get(const Scene *scene, const View3D *v3d, float
return;
}
- UI_GetThemeColor3fv(TH_HIGH_GRAD, r_color);
+ UI_GetThemeColor3fv(TH_BACK, r_color);
}
void ED_view3d_cursor3d_calc_mat3(const Scene *scene, float mat[3][3])
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 301dba3fac2..a749fba5026 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -164,13 +164,6 @@ typedef struct uiPanelColors {
char pad2[4];
} uiPanelColors;
-typedef struct uiGradientColors {
- char gradient[4];
- char high_gradient[4];
- int show_grad;
- int pad2;
-} uiGradientColors;
-
typedef struct ThemeUI {
/* Interface Elements (buttons, menus, icons) */
uiWidgetColors wcol_regular, wcol_tool, wcol_toolbar_item, wcol_text;
@@ -227,6 +220,11 @@ typedef struct ThemeUI {
typedef struct ThemeSpace {
/* main window colors */
char back[4];
+ char back_grad[4];
+
+ char show_back_grad;
+ char _pad0[3];
+
/** Panel title. */
char title[4];
char text[4];
@@ -277,8 +275,6 @@ typedef struct ThemeSpace {
/* note, cannot use name 'panel' because of DNA mapping old files */
uiPanelColors panelcolors;
- uiGradientColors gradients;
-
char shade1[4];
char shade2[4];
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");