diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-08-21 19:27:06 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-08-22 15:59:56 +0300 |
commit | dc00c330c52f060ac9c1027a4541212e8198e537 (patch) | |
tree | c48aefa45861010648e9104af09528768c5f847e /source/blender/editors/mesh/editmesh_path.c | |
parent | c32cc3e43e49009892e3ecfe0f9e91c98592f98a (diff) |
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).
Diffstat (limited to 'source/blender/editors/mesh/editmesh_path.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_path.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c index 1f6a48b41b3..cbfb33af937 100644 --- a/source/blender/editors/mesh/editmesh_path.c +++ b/source/blender/editors/mesh/editmesh_path.c @@ -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))) |