Page MenuHome

worldcolor.diff

Authored By
Jacob F (raccoon)
Nov 13 2013, 2:43 PM
Size
9 KB
Subscribers
None

worldcolor.diff

Index: release/scripts/ui/space_view3d.py
===================================================================
--- release/scripts/ui/space_view3d.py (revision 29955)
+++ release/scripts/ui/space_view3d.py (working copy)
@@ -2016,6 +2016,9 @@
sub.prop(view, "grid_lines", text="Lines")
sub.prop(view, "grid_spacing", text="Spacing")
sub.prop(view, "grid_subdivisions", text="Subdivisions")
+
+ col = layout.column()
+ col.prop(view, "display_world_color")
col = layout.column()
col.label(text="Shading:")
Index: source/blender/makesdna/DNA_view3d_types.h
===================================================================
--- source/blender/makesdna/DNA_view3d_types.h (revision 29955)
+++ source/blender/makesdna/DNA_view3d_types.h (working copy)
@@ -250,6 +250,7 @@
#define V3D_RENDER_OVERRIDE 4
#define V3D_SOLID_TEX 8
#define V3D_DISPGP 16
+#define V3D_WORLD_COLOR 32
/* View3D->around */
#define V3D_CENTER 0
Index: source/blender/makesrna/intern/rna_world.c
===================================================================
--- source/blender/makesrna/intern/rna_world.c (revision 29955)
+++ source/blender/makesrna/intern/rna_world.c (working copy)
@@ -476,13 +476,13 @@
RNA_def_property_float_sdna(prop, NULL, "horr");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Horizon Color", "Color at the horizon");
- RNA_def_property_update(prop, 0, "rna_World_update");
+ RNA_def_property_update(prop, 0, "rna_World_draw_update");
prop= RNA_def_property(srna, "zenith_color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "zenr");
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Zenith Color", "Color at the zenith");
- RNA_def_property_update(prop, 0, "rna_World_update");
+ RNA_def_property_update(prop, 0, "rna_World_draw_update");
prop= RNA_def_property(srna, "ambient_color", PROP_FLOAT, PROP_COLOR);
RNA_def_property_float_sdna(prop, NULL, "ambr");
@@ -507,7 +507,7 @@
prop= RNA_def_property(srna, "blend_sky", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYBLEND);
RNA_def_property_ui_text(prop, "Blend Sky", "Render background with natural progression from horizon to zenith");
- RNA_def_property_update(prop, 0, "rna_World_update");
+ RNA_def_property_update(prop, 0, "rna_World_draw_update");
prop= RNA_def_property(srna, "paper_sky", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYPAPER);
Index: source/blender/makesrna/intern/rna_space.c
===================================================================
--- source/blender/makesrna/intern/rna_space.c (revision 29955)
+++ source/blender/makesrna/intern/rna_space.c (working copy)
@@ -1063,6 +1063,11 @@
RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_OVERRIDE);
RNA_def_property_ui_text(prop, "Only Render", "Display only objects which will be rendered");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+ prop= RNA_def_property(srna, "display_world_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_WORLD_COLOR);
+ RNA_def_property_ui_text(prop, "Use World Color", "Use the world settings for the background");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop= RNA_def_property(srna, "occlude_geometry", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ZBUF_SELECT);
Index: source/blender/editors/space_buttons/space_buttons.c
===================================================================
--- source/blender/editors/space_buttons/space_buttons.c (revision 29955)
+++ source/blender/editors/space_buttons/space_buttons.c (working copy)
@@ -207,8 +207,6 @@
#ifdef PY_HEADER
ED_region_header(C, ar);
#else
-
-
/* clear */
UI_ThemeClearColor(ED_screen_area_active(C)?TH_HEADER:TH_HEADERDESEL);
glClear(GL_COLOR_BUFFER_BIT);
Index: source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- source/blender/editors/space_view3d/view3d_draw.c (revision 29955)
+++ source/blender/editors/space_view3d/view3d_draw.c (working copy)
@@ -237,7 +237,7 @@
#define GRID_MIN_PX 6.0f
-static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, char **grid_unit)
+static void drawgrid(UnitSettings *unit, ARegion *ar, Scene *scene, View3D *v3d, char **grid_unit)
{
/* extern short bgpicmode; */
RegionView3D *rv3d= ar->regiondata;
@@ -277,6 +277,12 @@
/* check zoom out */
UI_ThemeColor(TH_GRID);
+
+ if(v3d->flag2 & V3D_WORLD_COLOR) {
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ }
+
if(unit->system) {
/* Use GRID_MIN_PX*2 for units because very very small grid
* items are less useful when dealing with units */
@@ -308,9 +314,12 @@
blend_fac= (blend_fac * blend_fac) * 2.0f;
CLAMP(blend_fac, 0.3f, 1.0f);
+ if((v3d->flag2 & V3D_WORLD_COLOR)==0)
+ UI_ThemeColorBlend(TH_BACK, TH_GRID, blend_fac);
+ else
+ UI_ThemeColorShadeAlpha(TH_GRID, 0, blend_fac * 255 - 255);
+
- UI_ThemeColorBlend(TH_BACK, TH_GRID, blend_fac);
-
drawgrid_draw(ar, wx, wy, x, y, dx_scalar);
}
}
@@ -336,7 +345,10 @@
}
}
else { // start blending out
- UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+ if((v3d->flag2 & V3D_WORLD_COLOR)==0)
+ UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+ else
+ UI_ThemeColorShadeAlpha(TH_GRID, 0, x/(GRID_MIN_PX*6) * 255 - 255);
drawgrid_draw(ar, wx, wy, x, y, dx);
UI_ThemeColor(TH_GRID);
@@ -344,7 +356,10 @@
}
}
else { // start blending out (GRID_MIN_PX < dx < (GRID_MIN_PX*10))
- UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+ if((v3d->flag2 & V3D_WORLD_COLOR)==0)
+ UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+ else
+ UI_ThemeColorShadeAlpha(TH_GRID, 0, dx/(GRID_MIN_PX*6) * 255 - 255);
drawgrid_draw(ar, wx, wy, x, y, dx);
UI_ThemeColor(TH_GRID);
@@ -363,21 +378,30 @@
drawgrid_draw(ar, wx, wy, x, y, dx);
}
else {
- UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+ if((v3d->flag2 & V3D_WORLD_COLOR)==0)
+ UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+ else
+ UI_ThemeColorShadeAlpha(TH_GRID, 0, dx/(GRID_MIN_PX*6) * 255 - 255);
drawgrid_draw(ar, wx, wy, x, y, dx);
UI_ThemeColor(TH_GRID);
drawgrid_draw(ar, wx, wy, x, y, dx*sublines);
}
}
else {
- UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+ if((v3d->flag2 & V3D_WORLD_COLOR)==0)
+ UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+ else
+ UI_ThemeColorShadeAlpha(TH_GRID, 0, dx/(GRID_MIN_PX*6) * 255 - 255);
drawgrid_draw(ar, wx, wy, x, y, dx);
UI_ThemeColor(TH_GRID);
drawgrid_draw(ar, wx, wy, x, y, dx*sublines);
}
}
else {
- UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+ if((v3d->flag2 & V3D_WORLD_COLOR)==0)
+ UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+ else
+ UI_ThemeColorShadeAlpha(TH_GRID, 0, dx/(GRID_MIN_PX*6) * 255 - 255);
drawgrid_draw(ar, wx, wy, x, y, dx);
UI_ThemeColor(TH_GRID);
drawgrid_draw(ar, wx, wy, x, y, dx*sublines);
@@ -385,6 +409,8 @@
}
}
+ if(v3d->flag2 & V3D_WORLD_COLOR)
+ glDisable(GL_BLEND);
x+= (wx);
y+= (wy);
@@ -428,6 +454,7 @@
grid= gridlines*v3d->grid;
UI_GetThemeColor3ubv(TH_GRID, col);
+
UI_GetThemeColor3ubv(TH_BACK, col2);
/* emphasise division lines lighter instead of darker, if background is darker than grid */
@@ -669,7 +696,7 @@
else return ;
glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
UI_icon_draw(5.0, 5.0, icon);
@@ -2208,9 +2235,42 @@
}
/* clear background */
- UI_ThemeClearColor(TH_BACK);
- glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+ if (!scene->world || (v3d->flag2 & V3D_WORLD_COLOR)==0) {
+ UI_ThemeClearColor(TH_BACK);
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+ }
+ else {
+ if(scene->world->skytype & WO_SKYBLEND) {
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glLoadIdentity();
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glShadeModel(GL_SMOOTH);
+ glBegin(GL_QUADS);
+ //horizon
+ glColor3f(scene->world->horr, scene->world->horg, scene->world->horb);
+ glVertex2f(-1.0,-1.0);
+ glVertex2f(1.0,-1.0);
+ //zenith
+ glColor3f(scene->world->zenr, scene->world->zeng, scene->world->zenb);
+ glVertex2f(1.0, 1.0);
+ glVertex2f(-1.0, 1.0);
+ glEnd();
+
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glShadeModel(GL_FLAT);
+ }
+ else {
+ glClearColor(scene->world->horr, scene->world->horg, scene->world->horb, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+ }
+ }
+
+
/* setup view matrices */
view3d_main_area_setup_view(scene, v3d, ar, NULL, NULL);
@@ -2250,7 +2310,7 @@
}
else {
ED_region_pixelspace(ar);
- drawgrid(&scene->unit, ar, v3d, &grid_unit);
+ drawgrid(&scene->unit, ar, scene, v3d, &grid_unit);
/* XXX make function? replaces persp(1) */
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(rv3d->winmat);

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c1/43/87adf3fcee8e34ba94e82565718a

Event Timeline