diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-05-12 00:09:08 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-05-12 00:11:19 +0300 |
commit | d3ed8233ffc9c654492fe3c077b5252f44aecbb7 (patch) | |
tree | 3ec1c0e627dc239c3da235e681c64b5a14fd418c /source/blender/editors/mesh/editmesh_path.c | |
parent | 16ce1b78b054a344ee63b578dd9044e399ac3c77 (diff) |
BMesh: use active face fallback w/ select-path
From user perspective, last selected face is the same as the active face,
use this as a fallback.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_path.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_path.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c index 55ed0e521ea..4431712e720 100644 --- a/source/blender/editors/mesh/editmesh_path.c +++ b/source/blender/editors/mesh/editmesh_path.c @@ -588,6 +588,17 @@ static BMElem *edbm_elem_find_nearest(ViewContext *vc, const char htype) return NULL; } +static BMElem *edbm_elem_active_elem_or_face_get(BMesh *bm) +{ + BMElem *ele = BM_mesh_active_elem_get(bm); + + if ((ele == NULL) && bm->act_face && BM_elem_flag_test(bm->act_face, BM_ELEM_SELECT)) { + ele = (BMElem *)bm->act_face; + } + + return ele; +} + static int edbm_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event) { if (RNA_struct_property_is_set(op->ptr, "index")) { @@ -605,7 +616,7 @@ static int edbm_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE view3d_operator_needs_opengl(C); BMElem *ele_src, *ele_dst; - if (!(ele_src = BM_mesh_active_elem_get(em->bm)) || + if (!(ele_src = edbm_elem_active_elem_or_face_get(em->bm)) || !(ele_dst = edbm_elem_find_nearest(&vc, ele_src->head.htype))) { /* special case, toggle edge tags even when we don't have a path */ @@ -655,7 +666,7 @@ static int edbm_shortest_path_pick_exec(bContext *C, wmOperator *op) } BMElem *ele_src, *ele_dst; - if (!(ele_src = BM_mesh_active_elem_get(em->bm)) || + if (!(ele_src = edbm_elem_active_elem_or_face_get(em->bm)) || !(ele_dst = EDBM_elem_from_index_any(em, index))) { return OPERATOR_CANCELLED; |