diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-04-17 12:35:20 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-04-18 12:22:08 +0300 |
commit | 63bae864f40302b0a303498d26f230caf4f24339 (patch) | |
tree | ae87ecce8868b872d1f2403add5b9d4d5bf538c9 /source/blender | |
parent | f7a28f0e11be825e8b1f74720f4d0b35a2d0104b (diff) |
Overlay Engine: Option to Disable AA Ortho Grid
When in Axis alligned orthographic view a grid was always displayed.
With this change the user can enable/disable this grid.
The Grid is always visible and editable, but only rendered active when user is in quad view, or axis aligned ortho view.
Reviewers: brecht, fclem
Maniphest Tasks: T63517
Differential Revision: https://developer.blender.org/D4699
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 12 | ||||
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 16 |
5 files changed, 34 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index a68da431d57..523e0b3d340 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -3116,6 +3116,18 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + + /* enable the axis aligned ortho grid by default */ + for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { + for (ScrArea *area = screen->areabase.first; area; area = area->next) { + for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) { + if (sl->spacetype == SPACE_VIEW3D) { + View3D *v3d = (View3D *)sl; + v3d->gridflag |= V3D_SHOW_ORTHO_GRID; + } + } + } + } } { diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 786146dc2ff..1072efb7edd 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -511,6 +511,7 @@ static void OBJECT_engine_init(void *vedata) const bool show_axis_y = (v3d->gridflag & V3D_SHOW_Y) != 0; const bool show_axis_z = (v3d->gridflag & V3D_SHOW_Z) != 0; const bool show_floor = (v3d->gridflag & V3D_SHOW_FLOOR) != 0; + const bool show_ortho_grid = (v3d->gridflag & V3D_SHOW_ORTHO_GRID) != 0; e_data.draw_grid = show_axis_x || show_axis_y || show_axis_z || show_floor; DRW_viewport_matrix_get(winmat, DRW_MAT_WIN); @@ -559,15 +560,15 @@ static void OBJECT_engine_init(void *vedata) grid_res = viewdist / grid_scale; if (ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT)) { - e_data.draw_grid = true; + e_data.draw_grid = show_ortho_grid; e_data.grid_flag = PLANE_YZ | SHOW_AXIS_Y | SHOW_AXIS_Z | SHOW_GRID | GRID_BACK; } else if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) { - e_data.draw_grid = true; + e_data.draw_grid = show_ortho_grid; e_data.grid_flag = PLANE_XY | SHOW_AXIS_X | SHOW_AXIS_Y | SHOW_GRID | GRID_BACK; } else if (ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) { - e_data.draw_grid = true; + e_data.draw_grid = show_ortho_grid; e_data.grid_flag = PLANE_XZ | SHOW_AXIS_X | SHOW_AXIS_Z | SHOW_GRID | GRID_BACK; } else { /* RV3D_VIEW_USER */ diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 434f379c6fe..85264fe4bbc 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -337,7 +337,7 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene) V3D_OVERLAY_EDIT_CREASES | V3D_OVERLAY_EDIT_BWEIGHTS | V3D_OVERLAY_EDIT_CU_HANDLES | V3D_OVERLAY_EDIT_CU_NORMALS; - v3d->gridflag = V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_FLOOR; + v3d->gridflag = V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_FLOOR | V3D_SHOW_ORTHO_GRID; v3d->flag = V3D_SELECT_OUTLINE; v3d->flag2 = V3D_SHOW_RECONSTRUCTION | V3D_SHOW_ANNOTATION; diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 3e409f36724..74277e60c37 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -525,6 +525,7 @@ enum { #define V3D_SHOW_X (1 << 1) #define V3D_SHOW_Y (1 << 2) #define V3D_SHOW_Z (1 << 3) +#define V3D_SHOW_ORTHO_GRID (1 << 4) /** #TransformOrientationSlot.type */ enum { diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index ebfe23942d9..d5b12ed5d5b 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -747,6 +747,12 @@ static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *value ED_view3d_from_m4(mat, rv3d->ofs, rv3d->viewquat, &rv3d->dist); } +static bool rna_RegionView3D_is_orthographic_side_view_get(PointerRNA *ptr) +{ + RegionView3D *rv3d = (RegionView3D *)(ptr->data); + return RV3D_VIEW_IS_AXIS(rv3d->view); +} + static void rna_3DViewShading_type_update(Main *bmain, Scene *scene, PointerRNA *ptr) { ID *id = ptr->id.data; @@ -2931,6 +2937,11 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Show Overlays", "Display overlays like gizmos and outlines"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update"); + prop = RNA_def_property(srna, "show_ortho_grid", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_ORTHO_GRID); + RNA_def_property_ui_text(prop, "Display Grid", "Show grid in othographic side view"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + 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( @@ -3777,6 +3788,11 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Is Perspective", ""); RNA_def_property_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "is_orthographic_side_view", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "view", 0); + RNA_def_property_boolean_funcs(prop, "rna_RegionView3D_is_orthographic_side_view_get", NULL); + RNA_def_property_ui_text(prop, "Is Axis Aligned", "Is current view an orthographic side view"); + /* This isn't directly accessible from the UI, only an operator. */ prop = RNA_def_property(srna, "use_clip_planes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "rflag", RV3D_CLIPPING); |