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
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2013-01-07 19:42:42 +0400
committerAntony Riakiotakis <kalast@gmail.com>2013-01-07 19:42:42 +0400
commitff6339a9799b854e145608c4ed3673227b85d971 (patch)
tree81ee94fdd17495d626f425c035492e2d1cd8faa3
parent12d921eb5b438473cf1cbf287d3f7640cad32f40 (diff)
Make options for background gradient more organized.
This was difficult to do because we group theme colours and display them together in user preferences. To make the background options more presentable and keep them grouped and separate, I needed to group the two gradient colours somehow. I added a separate ThemeSpaceGradient RNA struct as opposed to ThemeSpaceGeneric. This struct is the same as ThemeSpaceGeneric but it lacks the window background option (which does nothing now) and includes the UiGradient struct which now has both gradient colours. I modified the clear functions to use a new high colour from the gradient. Now all options appear grouped and any other editor that may use a gradient for the window background may do so. Also corrected incorrect MAIN_VERSION_ATLEAST macro, it would not detect versions correctly
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_main.h2
-rw-r--r--source/blender/editors/include/UI_resources.h3
-rw-r--r--source/blender/editors/interface/resources.c15
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c6
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c117
8 files changed, 128 insertions, 20 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 10528f1b270..dc3f8dfb964 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 265
-#define BLENDER_SUBVERSION 5
+#define BLENDER_SUBVERSION 6
/* 262 was the last editmesh release but it has compatibility code for bmesh data */
#define BLENDER_MINVERSION 262
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index da0cba422c3..1b7b29432e2 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -93,7 +93,7 @@ typedef struct Main {
} Main;
#define MAIN_VERSION_ATLEAST(main, ver, subver) \
- ((main)->versionfile >= (ver) || (main->versionfile == (ver) && (main)->subversionfile >= (subver)))
+ ((main)->versionfile > (ver) || (main->versionfile == (ver) && (main)->subversionfile >= (subver)))
#ifdef __cplusplus
}
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 0ddb8830c2a..7e7be17d7c6 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -225,7 +225,8 @@ enum {
TH_AXIS_Y,
TH_AXIS_Z,
- TH_BACK_GRAD,
+ TH_LOW_GRAD,
+ TH_HIGH_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 088715218ef..0627fad7227 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -170,9 +170,12 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
else
cp = ts->button;
break;
- case TH_BACK_GRAD:
+ case TH_LOW_GRAD:
cp = ts->gradients.gradient;
break;
+ case TH_HIGH_GRAD:
+ cp = ts->gradients.high_gradient;
+ break;
case TH_SHOW_BACK_GRAD:
cp = &setting;
setting = ts->gradients.show_grad;
@@ -780,6 +783,7 @@ void ui_theme_init_default(void)
rgba_char_args_set(btheme->tv3d.skin_root, 180, 77, 77, 255);
rgba_char_args_set(btheme->tv3d.gradients.gradient, 0, 0, 0, 0);
+ rgba_char_args_set(btheme->tv3d.gradients.high_gradient, 0.225, 0.225, 0.225, 1.0);
btheme->tv3d.gradients.show_grad = FALSE;
/* space buttons */
@@ -2100,7 +2104,7 @@ void init_userdef_do_versions(void)
}
}
- if (!MAIN_VERSION_ATLEAST(bmain, 266, 4)) {
+ if (!MAIN_VERSION_ATLEAST(bmain, 265, 4)) {
bTheme *btheme;
for (btheme = U.themes.first; btheme; btheme = btheme->next) {
rgba_char_args_set(btheme->text.syntaxd, 50, 0, 140, 255); /* Decorator/Preprocessor Dir. Blue-purple */
@@ -2109,6 +2113,13 @@ void init_userdef_do_versions(void)
}
}
+ if (!MAIN_VERSION_ATLEAST(bmain, 265, 6)) {
+ bTheme *btheme;
+ for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+ copy_v4_v4_char(btheme->tv3d.gradients.high_gradient, btheme->tv3d.back);
+ }
+ }
+
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 34a9529d777..740bf797a6b 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -3108,10 +3108,10 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar)
glShadeModel(GL_SMOOTH);
glBegin(GL_QUADS);
- UI_ThemeColor(TH_BACK_GRAD);
+ UI_ThemeColor(TH_LOW_GRAD);
glVertex2f(-1.0, -1.0);
glVertex2f(1.0, -1.0);
- UI_ThemeColor(TH_BACK);
+ UI_ThemeColor(TH_HIGH_GRAD);
glVertex2f(1.0, 1.0);
glVertex2f(-1.0, 1.0);
glEnd();
@@ -3124,7 +3124,7 @@ static void view3d_main_area_clear(Scene *scene, View3D *v3d, ARegion *ar)
glPopMatrix();
}
else {
- UI_ThemeClearColor(TH_BACK);
+ UI_ThemeClearColor(TH_HIGH_GRAD);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
}
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index d6da03040cc..3027a3abd7d 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -151,7 +151,7 @@ typedef struct uiPanelColors {
typedef struct uiGradientColors {
char gradient[4];
- char pad[4];
+ char high_gradient[4];
int show_grad;
int pad2;
} uiGradientColors;
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index e2f72ca339d..29adb8ff599 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -571,6 +571,7 @@ extern StructRNA RNA_ThemeOutliner;
extern StructRNA RNA_ThemeProperties;
extern StructRNA RNA_ThemeSequenceEditor;
extern StructRNA RNA_ThemeSpaceGeneric;
+extern StructRNA RNA_ThemeSpaceGradient;
extern StructRNA RNA_ThemeSpaceListGeneric;
extern StructRNA RNA_ThemeStyle;
extern StructRNA RNA_ThemeTextEditor;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 83162bec7f4..07390958bd9 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -345,6 +345,11 @@ static PointerRNA rna_Theme_space_generic_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGeneric, ptr->data);
}
+static PointerRNA rna_Theme_space_gradient_get(PointerRNA *ptr)
+{
+ return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGradient, ptr->data);
+}
+
static PointerRNA rna_Theme_space_list_generic_get(PointerRNA *ptr)
{
return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceListGeneric, ptr->data);
@@ -766,16 +771,22 @@ static void rna_def_userdef_theme_ui_gradient(BlenderRNA *brna)
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");
+ 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_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);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Gradient Low", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "high_gradient", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Gradient High/Off", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
}
static void rna_def_userdef_theme_ui(BlenderRNA *brna)
@@ -997,6 +1008,83 @@ static void rna_def_userdef_theme_space_generic(BlenderRNA *brna)
/* } */
}
+static void rna_def_userdef_theme_space_gradient(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ThemeSpaceGradient", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_ui_text(srna, "Theme Space Settings", "");
+
+ /* window */
+ prop = RNA_def_property(srna, "title", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Title", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Text Highlight", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* header */
+ prop = RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Header", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "header_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Header Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "header_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Header Text Highlight", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* panel settings */
+ prop = RNA_def_property(srna, "panelcolors", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Panel Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* gradient/background settings */
+ 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 Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* buttons */
+/* if (! ELEM(spacetype, SPACE_BUTS, SPACE_OUTLINER)) { */
+ prop = RNA_def_property(srna, "button", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Region Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "button_title", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Region Text Titles", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "button_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Region Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "button_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Region Text Highlight", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+/* } */
+}
+
/* list / channels */
static void rna_def_userdef_theme_space_list_generic(BlenderRNA *brna)
{
@@ -1039,6 +1127,17 @@ static void rna_def_userdef_theme_spaces_main(StructRNA *srna)
RNA_def_property_ui_text(prop, "Theme Space", "Settings for space");
}
+static void rna_def_userdef_theme_spaces_gradient(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "space", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "ThemeSpaceGradient");
+ RNA_def_property_pointer_funcs(prop, "rna_Theme_space_gradient_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Theme Space", "Settings for space");
+}
+
static void rna_def_userdef_theme_spaces_list_main(StructRNA *srna)
{
PropertyRNA *prop;
@@ -1243,7 +1342,7 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
RNA_def_struct_ui_text(srna, "Theme 3D View", "Theme settings for the 3D View");
- rna_def_userdef_theme_spaces_main(srna);
+ rna_def_userdef_theme_spaces_gradient(srna);
prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
@@ -1381,11 +1480,6 @@ 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");
}
@@ -2562,6 +2656,7 @@ static void rna_def_userdef_dothemes(BlenderRNA *brna)
rna_def_userdef_theme_ui(brna);
rna_def_userdef_theme_space_generic(brna);
+ rna_def_userdef_theme_space_gradient(brna);
rna_def_userdef_theme_space_list_generic(brna);
rna_def_userdef_theme_space_view3d(brna);