Merged changes in the trunk up to revision 52690.
[blender.git] / source / blender / editors / mesh / editmesh_select.c
index 2f40d281505debb82cdda9cb014afdc2e2b0e8a6..cb1b4ebba7228d93928dcbdcabc8847726dc2d0d 100644 (file)
@@ -734,7 +734,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
        EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
        /* select the output */
        EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
        /* select the output */
-       BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_ALL, BM_ELEM_SELECT, TRUE);
+       BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, TRUE);
 
        /* finish the operator */
        if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 
        /* finish the operator */
        if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -775,7 +775,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
        EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
        /* select the output */
        EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
        /* select the output */
-       BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_ALL, BM_ELEM_SELECT, TRUE);
+       BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "edges.out", BM_EDGE, BM_ELEM_SELECT, TRUE);
        EDBM_selectmode_flush(em);
 
        /* finish the operator */
        EDBM_selectmode_flush(em);
 
        /* finish the operator */
@@ -819,7 +819,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
        EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
        /* select the output */
        EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
        /* select the output */
-       BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_ALL, BM_ELEM_SELECT, TRUE);
+       BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, TRUE);
 
        /* finish the operator */
        if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 
        /* finish the operator */
        if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
@@ -1269,12 +1269,12 @@ static float step_cost_3_v3(const float v1[3], const float v2[3], const float v3
        /* The cost is based on the simple sum of the length of the two edgees... */
        sub_v3_v3v3(d1, v2, v1);
        sub_v3_v3v3(d2, v3, v2);
        /* The cost is based on the simple sum of the length of the two edgees... */
        sub_v3_v3v3(d1, v2, v1);
        sub_v3_v3v3(d2, v3, v2);
-       cost = len_v3(d1) + len_v3(d2);
+       cost = normalize_v3(d1) + normalize_v3(d2);
 
        /* but is biased to give higher values to sharp turns, so that it will take
         * paths with fewer "turns" when selecting between equal-weighted paths between
         * the two edges */
 
        /* but is biased to give higher values to sharp turns, so that it will take
         * paths with fewer "turns" when selecting between equal-weighted paths between
         * the two edges */
-       cost = cost + 0.5f * cost * (2.0f - sqrtf(fabsf(dot_v3v3(d1, d2))));
+       cost = cost * (1.0f + 0.5f * (2.0f - sqrtf(fabsf(dot_v3v3(d1, d2)))));
 
        return cost;
 }
 
        return cost;
 }
@@ -1881,7 +1881,7 @@ int EDBM_select_pick(bContext *C, const int mval[2], short extend, short deselec
                        vc.obedit->actcol = efa->mat_nr + 1;
                        vc.em->mat_nr = efa->mat_nr;
 
                        vc.obedit->actcol = efa->mat_nr + 1;
                        vc.em->mat_nr = efa->mat_nr;
 
-                       WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, NULL);
+                       WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, NULL);
 
                }
 
 
                }