[Bf-blender-cvs] [5c23b86] blender2.8: fix grid floor drawing assert

Mike Erwin noreply at git.blender.org
Fri Oct 7 19:00:45 CEST 2016


Commit: 5c23b863f8c62e88406911aa90682fba8d434c16
Author: Mike Erwin
Date:   Fri Oct 7 13:00:23 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB5c23b863f8c62e88406911aa90682fba8d434c16

fix grid floor drawing assert

@dfelinto reported crash when setting grid subdivisions too low.

Code was setting color twice and Gawain was catching this. Fix is to only set regular grid color when we have regular grid lines to draw.  Then emphasized grid lines are free to set their own color further down.

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

M	source/blender/editors/space_view3d/view3d_draw.c

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

diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 584b6dc..5f3a075 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -730,13 +730,14 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr
 
 			/* draw normal grid lines */
 			UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10);
-			immAttrib3ubv(color, col_grid_light);
 
 			for (int a = 1; a <= gridlines; a++) {
 				/* skip emphasised divider lines */
 				if (a % sublines != 0) {
 					const float line = a * grid_scale;
 
+					immAttrib3ubv(color, col_grid_light);
+
 					immVertex2f(pos, -grid, -line);
 					immVertex2f(pos, +grid, -line);
 					immVertex2f(pos, -grid, +line);




More information about the Bf-blender-cvs mailing list