From e4f65749f9c522476f646004c06556b0fc5c4b4d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 1 Jan 2013 11:47:47 +0000 Subject: remove vertex selection check for weight paint mode so you can paint `through` the mesh. also made the wire draw without depth masking when the depth check is off, similar to mesh editmode drawing, nice hint about whats going on. --- release/scripts/startup/bl_ui/space_view3d.py | 2 +- source/blender/editors/sculpt_paint/paint_vertex.c | 10 +++++----- source/blender/editors/space_view3d/drawmesh.c | 20 ++++++++++++++++---- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index d2183b80476..8189ee21bc8 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -71,7 +71,7 @@ class VIEW3D_HT_header(Header): # Occlude geometry if ((view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'} and (mode == 'PARTICLE_EDIT' or (mode == 'EDIT' and obj.type == 'MESH'))) or - (mode == 'WEIGHT_PAINT' and obj.data.use_paint_mask_vertex)): + (mode == 'WEIGHT_PAINT')): row.prop(view, "use_occlude_geometry", text="") # Proportional editing diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 819305f9508..15d5257af60 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2194,7 +2194,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P float alpha; float mval[2]; int use_vert_sel; - int use_zbuf; + int use_depth; MDeformWeight *(*dw_func)(MDeformVert *, const int) = (brush->vertexpaint_tool == PAINT_BLEND_BLUR) ? @@ -2258,10 +2258,10 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P swap_m4m4(wpd->vc.rv3d->persmat, mat); use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0; - use_zbuf = use_vert_sel && (vc->v3d->flag & V3D_ZBUF_SELECT); + use_depth = (vc->v3d->flag & V3D_ZBUF_SELECT); /* which faces are involved */ - if (use_zbuf) { + if (use_depth) { if (wp->flag & VP_AREA) { /* Ugly hack, to avoid drawing vertex index when getting the face index buffer - campbell */ me->editflag &= ~ME_EDIT_PAINT_VERT_SEL; @@ -2310,7 +2310,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P } (void)0 - if (use_zbuf) { + if (use_depth) { for (index = 0; index < totindex; index++) { if (indexar[index] && indexar[index] <= me->totpoly) { MPoly *mpoly = me->mpoly + (indexar[index] - 1); @@ -2372,7 +2372,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P } \ } (void)0 - if (use_zbuf) { + if (use_depth) { for (index = 0; index < totindex; index++) { if (indexar[index] && indexar[index] <= me->totpoly) { diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index ad7d3b1bddd..0e86438997c 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -1066,12 +1066,18 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, draw_mesh_face_select(rv3d, me, dm); } else if ((do_light == FALSE) || (ob->dtx & OB_DRAWWIRE)) { + const int use_depth = (v3d->flag & V3D_ZBUF_SELECT); /* weight paint in solid mode, special case. focus on making the weights clear * rather than the shading, this is also forced in wire view */ - bglPolygonOffset(rv3d->dist, 1.0); - glDepthMask(0); /* disable write in zbuffer, selected edge wires show better */ + if (use_depth) { + bglPolygonOffset(rv3d->dist, 1.0); + glDepthMask(0); /* disable write in zbuffer, selected edge wires show better */ + } + else { + glDisable(GL_DEPTH_TEST); + } glEnable(GL_BLEND); glColor4ub(255, 255, 255, 96); @@ -1080,8 +1086,14 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, dm->drawEdges(dm, 1, 1); - bglPolygonOffset(rv3d->dist, 0.0); - glDepthMask(1); + if (use_depth) { + bglPolygonOffset(rv3d->dist, 0.0); + glDepthMask(1); + } + else { + glEnable(GL_DEPTH_TEST); + } + glDisable(GL_LINE_STIPPLE); glDisable(GL_BLEND); } -- cgit v1.2.3