tidy up
[blender.git] / source / blender / editors / space_view3d / view3d_select.c
index aa3166a7a65cce8047f734db69ef31df5a33b57d..d2c7ae337298ec8dbb3628180fc650c42d1ea7ea 100644 (file)
@@ -1976,17 +1976,18 @@ static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], un
 
 /* mouse selection in weight paint */
 /* gets called via generic mouse select operator */
 
 /* mouse selection in weight paint */
 /* gets called via generic mouse select operator */
-int mouse_wp_select(bContext *C, const int mval[2], short extend, Object *obact, Mesh* me)
+static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], short extend, Object *obact)
 {
 {
+       Mesh* me= obact->data; /* already checked for NULL */
        unsigned int index = 0;
        MVert *mv;
        if(vertsel_vert_pick(C, me, mval, &index, 1)) {
                mv = me->mvert+index;
                if(extend) {
        unsigned int index = 0;
        MVert *mv;
        if(vertsel_vert_pick(C, me, mval, &index, 1)) {
                mv = me->mvert+index;
                if(extend) {
-                       mv->flag ^= 1;
+                       mv->flag ^= SELECT;
                } else {
                        paintvert_deselect_all_visible(obact, SEL_DESELECT, FALSE);
                } else {
                        paintvert_deselect_all_visible(obact, SEL_DESELECT, FALSE);
-                       mv->flag |= 1;
+                       mv->flag |= SELECT;
                }
                paintvert_flush_flags(obact);
                WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
                }
                paintvert_flush_flags(obact);
                WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
@@ -2039,12 +2040,10 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
                return PE_mouse_particles(C, event->mval, extend);
        else if(obact && paint_facesel_test(obact))
                retval = paintface_mouse_select(C, obact, event->mval, extend);
                return PE_mouse_particles(C, event->mval, extend);
        else if(obact && paint_facesel_test(obact))
                retval = paintface_mouse_select(C, obact, event->mval, extend);
-       
-       else if (paint_vertsel_test(obact)) {
-               retval = mouse_wp_select(C, event->mval, extend, obact, obact->data);
-       } else {
+       else if (paint_vertsel_test(obact))
+               retval = mouse_weight_paint_vertex_select(C, event->mval, extend, obact);
+       else
                retval = mouse_select(C, event->mval, extend, center, enumerate);
                retval = mouse_select(C, event->mval, extend, center, enumerate);
-       }
 
        /* passthrough allows tweaks
         * FINISHED to signal one operator worked
 
        /* passthrough allows tweaks
         * FINISHED to signal one operator worked