diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-09-10 08:42:40 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-09-10 09:02:12 +0300 |
commit | 549ac6ddebef8113f8a84a945a40280f6fe9d565 (patch) | |
tree | 3e1793410b9279c3640c4d64f46bc8b2d44b8d6a /source/blender/editors/mesh/editmesh_path.c | |
parent | fc06bd723617bb57e38c9cd1db247267246a07dc (diff) |
Edit Mesh: pass Base array to picking functions
In some cases we need to use this array afterwards,
so this gives control over which objects are used for picking.
Also use an index argument as return argument
so callers that need to know the index in the array
don't need to calculate it afterwards.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_path.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_path.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c index 5795c8bb938..f127b85b19c 100644 --- a/source/blender/editors/mesh/editmesh_path.c +++ b/source/blender/editors/mesh/editmesh_path.c @@ -635,9 +635,16 @@ static int edbm_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE view3d_operator_needs_opengl(C); - if (EDBM_unified_findnearest(&vc, &basact, &eve, &eed, &efa)) { - ED_view3d_viewcontext_init_object(&vc, basact->object); - em = vc.em; + { + int base_index = -1; + uint bases_len = 0; + Base **bases = BKE_view_layer_array_from_bases_in_edit_mode(vc.view_layer, &bases_len); + if (EDBM_unified_findnearest(&vc, bases, bases_len, base_index, &eve, &eed, &efa)) { + basact = bases[base_index]; + ED_view3d_viewcontext_init_object(&vc, basact->object); + em = vc.em; + } + MEM_freeN(bases); } /* If nothing is selected, let's select the picked vertex/edge/face. */ |