Fix T77239: snap 3D cursor in edit-mode

This commit is contained in:
Campbell Barton 2020-06-02 12:08:17 +10:00
parent 4f3e686cad
commit f58e76119a

@ -143,6 +143,17 @@ struct SnapObjectContext {
/** \} */ /** \} */
/* -------------------------------------------------------------------- */
/** \name Utilities
* \{ */
static bool editmesh_eval_final_is_bmesh(const BMEditMesh *em)
{
return (em->mesh_eval_final->runtime.wrapper_type == ME_WRAPPER_TYPE_BMESH);
}
/** \} */
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/** \name Snap Object Data /** \name Snap Object Data
* \{ */ * \{ */
@ -974,7 +985,7 @@ static void raycast_obj_fn(SnapObjectContext *sctx,
Mesh *me = ob->data; Mesh *me = ob->data;
bool use_hide = false; bool use_hide = false;
if (BKE_object_is_in_editmode(ob)) { if (BKE_object_is_in_editmode(ob)) {
if (use_obedit) { if (use_obedit || editmesh_eval_final_is_bmesh(me->edit_mesh)) {
/* Operators only update the editmesh looptris of the original mesh. */ /* Operators only update the editmesh looptris of the original mesh. */
BMEditMesh *em_orig = BKE_editmesh_from_object(DEG_get_original_object(ob)); BMEditMesh *em_orig = BKE_editmesh_from_object(DEG_get_original_object(ob));
retval = raycastEditMesh(sctx, retval = raycastEditMesh(sctx,
@ -2641,7 +2652,7 @@ static void sanp_obj_fn(SnapObjectContext *sctx,
case OB_MESH: { case OB_MESH: {
Mesh *me = ob->data; Mesh *me = ob->data;
if (BKE_object_is_in_editmode(ob)) { if (BKE_object_is_in_editmode(ob)) {
if (use_obedit) { if (use_obedit || editmesh_eval_final_is_bmesh(me->edit_mesh)) {
/* Operators only update the editmesh looptris of the original mesh. */ /* Operators only update the editmesh looptris of the original mesh. */
BMEditMesh *em_orig = BKE_editmesh_from_object(DEG_get_original_object(ob)); BMEditMesh *em_orig = BKE_editmesh_from_object(DEG_get_original_object(ob));
retval = snapEditMesh(sctx, retval = snapEditMesh(sctx,