diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-08-21 19:19:02 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-08-22 15:59:56 +0300 |
commit | c32cc3e43e49009892e3ecfe0f9e91c98592f98a (patch) | |
tree | 4c7c173e7fdeb1bbb5ea2081710aa3aa24137f84 /source/blender/editors/mesh/editmesh_path.c | |
parent | 4abb060edfc741c19ec0105d7be6a27fb4153b9f (diff) |
Multi-Objects: MESH_OT_shortest_path_pick
This fully works as "expected", however it seems strange when
there is no selected vertex in the non-active object.
In 2.7x if you join two monkeys, select a vertex in one of them and
try to use this operator in the other it will select the lonely newly
selected vertex.
If you split both monkeys and do this in 2.8 while multi-editing them
you won't get nothing when trying to ctrl+RMB any vertex in the monkey
object that has nothing selected yet.
I propose to have this addressed in an upcoming patch where we always
select a vertex if no vertex was previously selected.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_path.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_path.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editmesh_path.c b/source/blender/editors/mesh/editmesh_path.c index 7bc12aa9ebf..1f6a48b41b3 100644 --- a/source/blender/editors/mesh/editmesh_path.c +++ b/source/blender/editors/mesh/editmesh_path.c @@ -619,6 +619,11 @@ static int edbm_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE return edbm_shortest_path_pick_exec(C, op); } + Base *basact = NULL; + BMVert *eve = NULL; + BMEdge *eed = NULL; + BMFace *efa = NULL; + ViewContext vc; BMEditMesh *em; bool track_active = true; @@ -629,6 +634,11 @@ 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; + } + 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))) @@ -658,6 +668,12 @@ static int edbm_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmE return OPERATOR_PASS_THROUGH; } + if (vc.view_layer->basact != basact) { + vc.view_layer->basact = basact; + DEG_id_tag_update(&vc.scene->id, DEG_TAG_SELECT_UPDATE); + WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, vc.scene); + } + /* to support redo */ BM_mesh_elem_index_ensure(em->bm, ele_dst->head.htype); int index = EDBM_elem_to_index_any(em, ele_dst); |