diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-05-27 22:28:29 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-05-29 16:52:27 +0300 |
commit | 330007f571f2bb20d91bdec447072e44ed3f5648 (patch) | |
tree | 222d50a072355cdfde61e7b37bc17ef075e6a29a | |
parent | e104d82376134acd9b6c8729f271a03e83b64003 (diff) |
3D grid: only draw if needed.
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 735c1173353..133995269a4 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -214,6 +214,7 @@ static struct { int grid_flag; int zpos_flag; int zneg_flag; + bool draw_grid; /* Temp buffer textures */ struct GPUTexture *outlines_depth_tx; struct GPUTexture *outlines_color_tx; @@ -320,6 +321,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; + e_data.draw_grid = show_axis_x || show_axis_y || show_axis_z || show_floor; DRW_viewport_matrix_get(winmat, DRW_MAT_WIN); DRW_viewport_matrix_get(viewmat, DRW_MAT_VIEW); @@ -1652,7 +1654,9 @@ static void OBJECT_draw_scene(void *vedata) DRW_draw_pass(psl->reference_image); if (!DRW_state_is_select()) { - DRW_draw_pass(psl->grid); + if (e_data.draw_grid) { + DRW_draw_pass(psl->grid); + } /* Combine with scene buffer last */ DRW_draw_pass(psl->outlines_resolve); |