diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 2 | ||||
-rw-r--r-- | source/blender/editors/include/UI_resources.h | 5 | ||||
-rw-r--r-- | source/blender/editors/interface/resources.c | 9 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 33 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 28 |
6 files changed, 82 insertions, 7 deletions
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 58c433d3772..a9712b1557e 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -200,7 +200,7 @@ class USERPREF_PT_interface(Panel): col.prop(view, "show_playback_fps", text="Playback FPS") col.prop(view, "use_global_scene") col.prop(view, "object_origin_size") - + col.separator() col.separator() col.separator() diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index e575d9ac924..0ddb8830c2a 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -223,7 +223,10 @@ enum { TH_AXIS_X, /* X/Y/Z Axis */ TH_AXIS_Y, - TH_AXIS_Z + TH_AXIS_Z, + + TH_BACK_GRAD, + TH_SHOW_BACK_GRAD }; /* XXX WARNING: previous is saved in file, so do not change order! */ diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 25e7a4b58ba..8d19171d591 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -170,6 +170,13 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo else cp = ts->button; break; + case TH_BACK_GRAD: + cp = ts->gradients.gradient; + break; + case TH_SHOW_BACK_GRAD: + cp = &setting; + setting = ts->gradients.show_grad; + break; case TH_TEXT: if (theme_regionid == RGN_TYPE_WINDOW) cp = ts->text; @@ -2099,7 +2106,7 @@ void init_userdef_do_versions(void) rgba_char_args_set(btheme->text.syntaxs, 76, 76, 76, 255); /* Grey (mix between fg/bg) */ } } - + if (U.pixelsize == 0.0f) U.pixelsize = 1.0f; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 43022e2a5d2..f68b61004a7 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -3094,8 +3094,37 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const } } else { - UI_ThemeClearColor(TH_BACK); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + if (UI_GetThemeValue(TH_SHOW_BACK_GRAD)) { + /* only clear depth buffer here */ + glClear(GL_DEPTH_BUFFER_BIT); + + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glShadeModel(GL_SMOOTH); + glBegin(GL_QUADS); + UI_ThemeColor(TH_BACK_GRAD); + glVertex2f(-1.0, -1.0); + glVertex2f(1.0, -1.0); + UI_ThemeColor(TH_BACK); + glVertex2f(1.0, 1.0); + glVertex2f(-1.0, 1.0); + glEnd(); + glShadeModel(GL_FLAT); + + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + + glMatrixMode(GL_MODELVIEW); + glPopMatrix(); + } else { + UI_ThemeClearColor(TH_BACK); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + } } ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 38848e30bf6..d6da03040cc 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -149,6 +149,13 @@ typedef struct uiPanelColors { int pad; } uiPanelColors; +typedef struct uiGradientColors { + char gradient[4]; + char pad[4]; + int show_grad; + int pad2; +} uiGradientColors; + typedef struct ThemeUI { /* Interface Elements (buttons, menus, icons) */ uiWidgetColors wcol_regular, wcol_tool, wcol_text; @@ -210,7 +217,9 @@ typedef struct ThemeSpace { /* note, cannot use name 'panel' because of DNA mapping old files */ uiPanelColors panelcolors; - + + uiGradientColors gradients; + char shade1[4]; char shade2[4]; @@ -437,6 +446,7 @@ typedef struct UserDef { int ndof_flag; /* flags for 3D mouse */ short ogl_multisamples; /* amount of samples for OpenGL FSA, if zero no FSA */ + short pad4; float glalphaclip; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 21b81e3e16a..83162bec7f4 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -758,6 +758,26 @@ static void rna_def_userdef_theme_ui_panel(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_userdef_update"); } +static void rna_def_userdef_theme_ui_gradient(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "ThemeGradientColors", NULL); + RNA_def_struct_sdna(srna, "uiGradientColors"); + RNA_def_struct_clear_flag(srna, STRUCT_UNDO); + RNA_def_struct_ui_text(srna, "Theme Gradient Color", "Theme settings for gradient colors"); + + prop = RNA_def_property(srna, "gradient", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_ui_text(prop, "Gradient Color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "show_grad", PROP_BOOLEAN, PROP_NONE); + 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"); +} + static void rna_def_userdef_theme_ui(BlenderRNA *brna) { StructRNA *srna; @@ -766,7 +786,8 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna) rna_def_userdef_theme_ui_wcol(brna); rna_def_userdef_theme_ui_wcol_state(brna); rna_def_userdef_theme_ui_panel(brna); - + rna_def_userdef_theme_ui_gradient(brna); + srna = RNA_def_struct(brna, "ThemeUserInterface", NULL); RNA_def_struct_sdna(srna, "ThemeUI"); RNA_def_struct_clear_flag(srna, STRUCT_UNDO); @@ -1360,6 +1381,11 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Skin Root", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop = RNA_def_property(srna, "gradients", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_ui_text(prop, "Gradient", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); } |