Commit: 2c1b0536c9e89eb401c422bed78edd3c35fb8b01
Author: Antony Riakiotakis
Date:   Tue Feb 17 11:37:20 2015 +0100
Branches: master
https://developer.blender.org/rB2c1b0536c9e89eb401c422bed78edd3c35fb8b01

Fix T43697, grid drawing over wires and grease pencil. Props to Julian
for figuring out a simple solution to that :)

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

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 ba031c8..f552d5c 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2656,8 +2656,6 @@ void ED_view3d_update_viewmat(Scene *scene, View3D *v3d, 
ARegion *ar, float view
        }
 }
 
-
-
 /**
  * Shared by #ED_view3d_draw_offscreen and #view3d_main_area_draw_objects
  *
@@ -2673,8 +2671,10 @@ static void view3d_draw_objects(
        RegionView3D *rv3d = ar->regiondata;
        Base *base;
        const bool do_camera_frame = !draw_offscreen;
-       const bool draw_floor = (rv3d->view == RV3D_VIEW_USER) || (rv3d->persp 
!= RV3D_ORTHO);
        const bool draw_grids = !draw_offscreen && (v3d->flag2 & 
V3D_RENDER_OVERRIDE) == 0;
+       const bool draw_floor = (rv3d->view == RV3D_VIEW_USER) || (rv3d->persp 
!= RV3D_ORTHO);
+       /* only draw grids after in solid modes, else it hovers over mesh wires 
*/
+       const bool draw_grids_after = draw_grids && draw_floor && 
(v3d->drawtype > OB_WIRE);
        bool xrayclear = true;
 
        if (!draw_offscreen) {
@@ -2722,6 +2722,9 @@ static void view3d_draw_objects(
                        glMatrixMode(GL_MODELVIEW);
                        glLoadMatrixf(rv3d->viewmat);
                }
+               else {
+                       drawfloor(scene, v3d, grid_unit);
+               }
        }
 
        /* important to do before clipping */
@@ -2796,6 +2799,11 @@ static void view3d_draw_objects(
                }
        }
 
+       /* perspective floor goes last to use scene depth and avoid writing to 
depth buffer */
+       if (draw_grids_after) {
+               drawfloor(scene, v3d, grid_unit);
+       }
+
        /* must be before xray draw which clears the depth buffer */
        if (v3d->flag2 & V3D_SHOW_GPENCIL) {
                /* must be before xray draw which clears the depth buffer */
@@ -2804,11 +2812,6 @@ static void view3d_draw_objects(
                if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
        }
 
-       /* perspective floor goes last to use scene depth and avoid writing to 
depth buffer */
-       if (draw_grids && draw_floor) {
-               drawfloor(scene, v3d, grid_unit);
-       }
-
        /* transp and X-ray afterdraw stuff */
        if (v3d->afterdraw_transp.first)     view3d_draw_transp(scene, ar, v3d);
        if (v3d->afterdraw_xray.first)       view3d_draw_xray(scene, ar, v3d, 
&xrayclear);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to