From 549ac6ddebef8113f8a84a945a40280f6fe9d565 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 10 Sep 2018 15:42:40 +1000 Subject: 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. --- source/blender/editors/mesh/editmesh_path.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/mesh/editmesh_path.c') 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. */ -- cgit v1.2.3