Page MenuHome

multi-axis-grids.diff

multi-axis-grids.diff

Index: release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- release/scripts/startup/bl_ui/space_view3d.py (revision 35980)
+++ release/scripts/startup/bl_ui/space_view3d.py (working copy)
@@ -2086,9 +2086,16 @@
col = layout.column()
col.active = display_all
+
split = col.split(percentage=0.55)
- split.prop(view, "show_floor", text="Grid Floor")
+ split.label(text="Grid Floors:")
+ row = split.row(align=True)
+ row.prop(view, "show_x_floor", text="X", toggle=True)
+ row.prop(view, "show_y_floor", text="Y", toggle=True)
+ row.prop(view, "show_floor", text="Z", toggle=True)
+ split = col.split(percentage=0.55)
+ split.label(text="Axis Lines:")
row = split.row(align=True)
row.prop(view, "show_axis_x", text="X", toggle=True)
row.prop(view, "show_axis_y", text="Y", toggle=True)
Index: source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- source/blender/editors/space_view3d/view3d_draw.c (revision 35980)
+++ source/blender/editors/space_view3d/view3d_draw.c (working copy)
@@ -425,7 +425,7 @@
static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
{
float vert[3], grid, grid_scale;
- int a, gridlines, emphasise;
+ int a, gridlines, regular, emphasise;
unsigned char col[3], col2[3];
short draw_line = 0;
@@ -460,103 +460,170 @@
/* emphasise division lines lighter instead of darker, if background is darker than grid */
if ( ((col[0]+col[1]+col[2])/3+10) > (col2[0]+col2[1]+col2[2])/3 )
- emphasise = 20;
+ regular = 10;
else
- emphasise = -10;
-
- /* draw the Y axis and/or grid lines */
- for(a= -gridlines;a<=gridlines;a++) {
- if(a==0) {
- /* check for the 'show Y axis' preference */
- if (v3d->gridflag & V3D_SHOW_Y) {
- UI_make_axis_color(col, col2, 'Y');
- glColor3ubv(col2);
-
- draw_line = 1;
- } else if (v3d->gridflag & V3D_SHOW_FLOOR) {
+ regular = -10;
+
+ emphasise = regular*2;
+
+
+
+ /* draw the axis lines */
+
+ if (v3d->gridflag & V3D_SHOW_X) {
+ glBegin(GL_LINE_STRIP);
+ UI_make_axis_color(col, col2, 'X');
+ glColor3ubv(col2);
+ vert[0]= grid;
+ vert[1]= 0;
+ vert[2]= 0;
+ glVertex3fv(vert );
+ vert[0]= -grid;
+ glVertex3fv(vert);
+ glEnd();
+ }
+
+ if (v3d->gridflag & V3D_SHOW_Y) {
+ glBegin(GL_LINE_STRIP);
+ UI_make_axis_color(col, col2, 'Y');
+ glColor3ubv(col2);
+ vert[0]= 0;
+ vert[1]= grid;
+ vert[2]= 0;
+ glVertex3fv(vert);
+ vert[1]= -grid;
+ glVertex3fv(vert);
+ glEnd();
+ }
+
+ if (v3d->gridflag & V3D_SHOW_Z) {
+ glBegin(GL_LINE_STRIP);
+ UI_make_axis_color(col, col2, 'Z');
+ glColor3ubv(col2);
+ vert[0]= 0;
+ vert[1]= 0;
+ vert[2]= grid;
+ glVertex3fv(vert );
+ vert[2]= -grid;
+ glVertex3fv(vert);
+ glEnd();
+ }
+
+
+
+
+ /* draw the grid line floor, with z=0, normal default */
+
+ if (v3d->gridflag & V3D_SHOW_FLOOR)
+ for(a= -gridlines;a<=gridlines;a++) {
+
+ if (!(v3d->gridflag & V3D_SHOW_Y) || (a!=0)) {
+ glBegin(GL_LINE_STRIP);
+ if ((a % 10)==0)
UI_ThemeColorShade(TH_GRID, emphasise);
- } else {
- draw_line = 0;
- }
- } else {
- /* check for the 'show grid floor' preference */
- if (v3d->gridflag & V3D_SHOW_FLOOR) {
- if( (a % 10)==0) {
- UI_ThemeColorShade(TH_GRID, emphasise);
- }
- else UI_ThemeColorShade(TH_GRID, 10);
-
- draw_line = 1;
- } else {
- draw_line = 0;
- }
- }
-
- if (draw_line) {
- glBegin(GL_LINE_STRIP);
+ else UI_ThemeColorShade(TH_GRID, regular);
vert[0]= a * grid_scale;
vert[1]= grid;
+ vert[2]= 0;
glVertex3fv(vert);
vert[1]= -grid;
glVertex3fv(vert);
glEnd();
}
+
+ if (!(v3d->gridflag & V3D_SHOW_X) || (a!=0)) {
+ glBegin(GL_LINE_STRIP);
+ if ((a % 10)==0)
+ UI_ThemeColorShade(TH_GRID, emphasise);
+ else UI_ThemeColorShade(TH_GRID, regular);
+ vert[0]= grid;
+ vert[1]= a * grid_scale;
+ vert[2]= 0;
+ glVertex3fv(vert );
+ vert[0]= -grid;
+ glVertex3fv(vert);
+ glEnd();
+ }
}
-
- /* draw the X axis and/or grid lines */
- for(a= -gridlines;a<=gridlines;a++) {
- if(a==0) {
- /* check for the 'show X axis' preference */
- if (v3d->gridflag & V3D_SHOW_X) {
- UI_make_axis_color(col, col2, 'X');
- glColor3ubv(col2);
-
- draw_line = 1;
- } else if (v3d->gridflag & V3D_SHOW_FLOOR) {
+
+
+
+
+ /* grid line floor with y=0, not normally shown */
+
+ if (v3d->gridflag & V3D_SHOW_FLOORY)
+ for(a= -gridlines;a<=gridlines;a++) {
+
+
+ if (!(v3d->gridflag & V3D_SHOW_Z) || (a!=0)) {
+ glBegin(GL_LINE_STRIP);
+ if ((a % 10)==0)
UI_ThemeColorShade(TH_GRID, emphasise);
- } else {
- draw_line = 0;
- }
- } else {
- /* check for the 'show grid floor' preference */
- if (v3d->gridflag & V3D_SHOW_FLOOR) {
- if( (a % 10)==0) {
- UI_ThemeColorShade(TH_GRID, emphasise);
- }
- else UI_ThemeColorShade(TH_GRID, 10);
-
- draw_line = 1;
- } else {
- draw_line = 0;
- }
+ else UI_ThemeColorShade(TH_GRID, regular);
+ vert[0]= a * grid_scale;
+ vert[1]= 0;
+ vert[2]= grid;
+ glVertex3fv(vert );
+ vert[2]= -grid;
+ glVertex3fv(vert);
+ glEnd();
}
-
- if (draw_line) {
+
+
+ if (!(v3d->gridflag & V3D_SHOW_X) || (a!=0)) {
glBegin(GL_LINE_STRIP);
- vert[1]= a * grid_scale;
+ if ((a % 10)==0)
+ UI_ThemeColorShade(TH_GRID, emphasise);
+ else UI_ThemeColorShade(TH_GRID, regular);
vert[0]= grid;
+ vert[1]= 0;
+ vert[2]= a * grid_scale;
glVertex3fv(vert );
vert[0]= -grid;
glVertex3fv(vert);
glEnd();
}
+
}
-
- /* draw the Z axis line */
- /* check for the 'show Z axis' preference */
- if (v3d->gridflag & V3D_SHOW_Z) {
- UI_make_axis_color(col, col2, 'Z');
- glColor3ubv(col2);
-
- glBegin(GL_LINE_STRIP);
- vert[0]= 0;
- vert[1]= 0;
- vert[2]= grid;
- glVertex3fv(vert );
- vert[2]= -grid;
- glVertex3fv(vert);
- glEnd();
+
+
+
+ /* grid line floor with x=0, not normally shown */
+
+ if (v3d->gridflag & V3D_SHOW_FLOORX)
+ for(a= -gridlines;a<=gridlines;a++) {
+
+
+ if (!(v3d->gridflag & V3D_SHOW_Z) || (a!=0)) {
+ glBegin(GL_LINE_STRIP);
+ if ((a % 10)==0)
+ UI_ThemeColorShade(TH_GRID, emphasise);
+ else UI_ThemeColorShade(TH_GRID, regular);
+ vert[0]= 0;
+ vert[1]= a * grid_scale;
+ vert[2]= grid;
+ glVertex3fv(vert );
+ vert[2]= -grid;
+ glVertex3fv(vert);
+ glEnd();
+ }
+
+ if (!(v3d->gridflag & V3D_SHOW_Y) || (a!=0)) {
+ glBegin(GL_LINE_STRIP);
+ if ((a % 10)==0)
+ UI_ThemeColorShade(TH_GRID, emphasise);
+ else UI_ThemeColorShade(TH_GRID, regular);
+ vert[0]= 0;
+ vert[1]= grid;
+ vert[2]= a * grid_scale;
+ glVertex3fv(vert );
+ vert[1]= -grid;
+ glVertex3fv(vert);
+ glEnd();
+ }
+
}
+
if(v3d->zbuf && scene->obedit) glDepthMask(1);
Index: source/blender/makesdna/DNA_view3d_types.h
===================================================================
--- source/blender/makesdna/DNA_view3d_types.h (revision 35980)
+++ source/blender/makesdna/DNA_view3d_types.h (working copy)
@@ -267,6 +267,8 @@
#define V3D_SHOW_X 2
#define V3D_SHOW_Y 4
#define V3D_SHOW_Z 8
+#define V3D_SHOW_FLOORX 16
+#define V3D_SHOW_FLOORY 32
/* View3d->twtype (bits, we can combine them) */
#define V3D_MANIP_TRANSLATE 1
Index: source/blender/makesrna/intern/rna_space.c
===================================================================
--- source/blender/makesrna/intern/rna_space.c (revision 35980)
+++ source/blender/makesrna/intern/rna_space.c (working copy)
@@ -1160,8 +1160,18 @@
prop= RNA_def_property(srna, "show_floor", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_FLOOR);
- RNA_def_property_ui_text(prop, "Display Grid Floor", "Show the ground plane grid in perspective view");
+ RNA_def_property_ui_text(prop, "Display Grid Floor", "Show the Z-axis ground plane grid in perspective view");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+ prop= RNA_def_property(srna, "show_x_floor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_FLOORX);
+ RNA_def_property_ui_text(prop, "Display X Grid Floor", "Show the X-axis ground plane grid in perspective view");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+ prop= RNA_def_property(srna, "show_y_floor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_FLOORY);
+ RNA_def_property_ui_text(prop, "Display Y Grid Floor", "Show the Y-axis ground plane grid in perspective view");
+ RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
prop= RNA_def_property(srna, "show_axis_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_X);

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a9/7c/0f693d290dac19dd18411e23475b

Event Timeline