Edit Mode: Fix Xray edit mode broken due to recent refactor
authorClément Foucault <foucault.clem@gmail.com>
Tue, 5 Feb 2019 13:47:05 +0000 (14:47 +0100)
committerClément Foucault <foucault.clem@gmail.com>
Tue, 5 Feb 2019 14:02:15 +0000 (15:02 +0100)
source/blender/draw/modes/edit_mesh_mode.c

index bd4a1e85ca8ca536bf6dd7fd775b1a2ef3370e50..b8e05a8eb2c91ba1af71d78c59f38462b2c0d07c 100644 (file)
@@ -328,6 +328,20 @@ static DRWPass *edit_mesh_create_overlay_pass(
        grp = *r_face_cage_shgrp = DRW_shgroup_create_sub(*r_face_shgrp);
        DRW_shgroup_state_enable(grp, DRW_STATE_OFFSET_NEGATIVE);
 
+       /* Verts */
+       if (select_vert) {
+               grp = *r_vert_shgrp = DRW_shgroup_create(vert_sh, pass);
+               DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
+               DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1);
+               DRW_shgroup_uniform_float(grp, "edgeScale", edge_width_scale, 1);
+               DRW_shgroup_uniform_float_copy(grp, "ofs", depth_ofs);
+               DRW_shgroup_state_enable(grp, DRW_STATE_OFFSET_NEGATIVE | DRW_STATE_WRITE_DEPTH);
+               DRW_shgroup_state_disable(grp, DRW_STATE_BLEND);
+               if (rv3d->rflag & RV3D_CLIPPING) {
+                       DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
+               }
+       }
+
        /* Edges */
        grp = *r_edge_deco_shgrp = DRW_shgroup_create(edge_deco_sh, pass);
        DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
@@ -361,19 +375,6 @@ static DRWPass *edit_mesh_create_overlay_pass(
                DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
        }
 
-       /* Verts */
-       if (select_vert) {
-               grp = *r_vert_shgrp = DRW_shgroup_create(vert_sh, pass);
-               DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
-               DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1);
-               DRW_shgroup_uniform_float(grp, "edgeScale", edge_width_scale, 1);
-               DRW_shgroup_uniform_float_copy(grp, "ofs", depth_ofs);
-               DRW_shgroup_state_enable(grp, DRW_STATE_OFFSET_NEGATIVE | DRW_STATE_WRITE_DEPTH);
-               DRW_shgroup_state_disable(grp, DRW_STATE_BLEND);
-               if (rv3d->rflag & RV3D_CLIPPING) {
-                       DRW_shgroup_world_clip_planes_from_rv3d(grp, rv3d);
-               }
-       }
        return pass;
 }
 
@@ -588,15 +589,13 @@ static void edit_mesh_add_ob_to_pass(
        DRWShadingGroup *edge_shgrp = g_data->edge_shgrp;
        DRWShadingGroup *edge_deco_shgrp = g_data->edge_deco_shgrp;
 
+       face_shgrp = (facefill_shgrp != NULL) ? facefill_shgrp : face_shgrp;
+
        geom_tris = DRW_mesh_batch_cache_get_edit_triangles(ob->data);
        geom_edges = DRW_mesh_batch_cache_get_edit_edges(ob->data);
-       DRW_shgroup_call_add(face_shgrp, geom_tris, ob->obmat);
        DRW_shgroup_call_add(edge_shgrp, geom_edges, ob->obmat);
        DRW_shgroup_call_add(edge_deco_shgrp, geom_edges, ob->obmat);
-
-       if (facefill_shgrp) {
-               DRW_shgroup_call_add(facefill_shgrp, geom_tris, ob->obmat);
-       }
+       DRW_shgroup_call_add(face_shgrp, geom_tris, ob->obmat);
 
        if ((tsettings->selectmode & SCE_SELECT_VERTEX) != 0) {
                geom_verts = DRW_mesh_batch_cache_get_edit_vertices(ob->data);