From 9661d88f2bb6435aaa41e9347bb0e21301c9ecd2 Mon Sep 17 00:00:00 2001 From: Jason Hays Date: Mon, 18 Jul 2011 16:47:21 +0000 Subject: [PATCH] Fixed an indexing problem with the regular mouse vertex select in weight paint. It will draw vertices in wire mode. --- .../blender/editors/space_view3d/drawobject.c | 29 ++++++++++--------- .../editors/space_view3d/view3d_select.c | 3 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 0196149c789..66539b2b25d 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2619,7 +2619,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D Mesh *me = ob->data; Material *ma= give_current_material(ob, 1); const short hasHaloMat = (ma && (ma->material_type == MA_TYPE_HALO)); - const short is_paint_sel= (ob==OBACT && paint_facesel_test(ob)); + const short is_paint_sel= (ob==OBACT && (paint_facesel_test(ob))); int draw_wire = 0; int /* totvert,*/ totedge, totface; DerivedMesh *dm= mesh_get_derived_final(scene, ob, scene->customdata_mask); @@ -2775,16 +2775,6 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D glDisable(GL_LIGHTING); GPU_disable_material(); - // Jason - if(paint_vertsel_test(ob)) { - glColor3f(0.0f, 0.0f, 0.0f); - glPointSize(2.0f); - dm->drawEdges(dm, (dt==OB_WIRE || totface==0), me->drawflag); - glPointSize(3.0f); - dm->drawSelectedVerts(dm); - //draw_obmode_dm_verts(dm, 1); - glPointSize(1.0f); - } } else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_TEXTURE_PAINT)) { if(me->mcol) @@ -2796,7 +2786,6 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D } } } - /* set default draw color back for wire or for draw-extra later on */ if (dt!=OB_WIRE) { if(base->flag & SELECT) { @@ -2855,7 +2844,21 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D bglPolygonOffset(rv3d->dist, 0.0); } } - + // Jason + if(paint_vertsel_test(ob)) { + glColor3f(0.0f, 0.0f, 0.0f); + glPointSize(2.0f); + // TODO clarify: + // there is clearly something I don't understand, when it was + // dt != OB_WIRE instead, it still drew in wire mode! + if(dt != OB_SOLID) { + dm->drawEdges(dm, (totface==0), TRUE); + } + glPointSize(3.0f); + dm->drawSelectedVerts(dm); + //draw_obmode_dm_verts(dm, 1); + glPointSize(1.0f); + } dm->release(dm); } diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 99f3580fa15..d362575e401 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1913,11 +1913,10 @@ void VIEW3D_OT_select_border(wmOperatorType *ot) WM_operator_properties_gesture_border(ot, TRUE); } /*Jason*/ -static void findnearestWPvert__doClosest(void *userData, MVert *mv, int x, int y, int index) +static void findnearestWPvert__doClosest(void *userData, MVert *mv, int x, int y, int UNUSED(index)) { struct { MVert *mv; short dist, select; int mval[2]; } *data = userData; float temp = abs(data->mval[0]-x) + abs(data->mval[1]-y); - mv = mv+index; if((mv->flag & SELECT)==data->select) temp += 5;