[Bf-blender-cvs] [dc00c330c52] blender2.8: Improvement to MESH_OT_shortest_path_pick behaviour

Dalai Felinto noreply at git.blender.org
Wed Aug 22 15:02:45 CEST 2018


Commit: dc00c330c52f060ac9c1027a4541212e8198e537
Author: Dalai Felinto
Date:   Tue Aug 21 13:27:06 2018 -0300
Branches: blender2.8
https://developer.blender.org/rBdc00c330c52f060ac9c1027a4541212e8198e537

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).

===================================================================

M	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 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)))



More information about the Bf-blender-cvs mailing list