Improvement to MESH_OT_shortest_path_pick behaviour

Select a vertex/edge/face if there was nothing previously selected
(if the click hit something, of course).
This commit is contained in:
Dalai Felinto 2018-08-21 13:27:06 -03:00
parent c32cc3e43e
commit dc00c330c5
1 changed files with 10 additions and 0 deletions

View File

@ -639,6 +639,16 @@ static int edbm_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE
em = vc.em;
}
/* If nothing is selected, let's select the picked vertex/edge/face. */
if ((vc.em->bm->totvertsel == 0) && (eve || eed || efa)) {
/* TODO (dfelinto) right now we try to find the closest element twice.
* The ideal is to refactor EDBM_select_pick so it doesn't
* have to pick the nearest vert/edge/face again.
*/
EDBM_select_pick(C, event->mval, true, false, false);
return OPERATOR_FINISHED;
}
BMElem *ele_src, *ele_dst;
if (!(ele_src = edbm_elem_active_elem_or_face_get(em->bm)) ||
!(ele_dst = edbm_elem_find_nearest(&vc, ele_src->head.htype)))