[Bf-blender-cvs] [330007f571f] blender2.8: 3D grid: only draw if needed.

Clément Foucault noreply at git.blender.org
Mon May 29 15:52:55 CEST 2017


Commit: 330007f571f2bb20d91bdec447072e44ed3f5648
Author: Clément Foucault
Date:   Sat May 27 21:28:29 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB330007f571f2bb20d91bdec447072e44ed3f5648

3D grid: only draw if needed.

===================================================================

M	source/blender/draw/modes/object_mode.c

===================================================================

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);




More information about the Bf-blender-cvs mailing list