From 862b5b18421a986b3d2cf8b0951f1a58797aaa52 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 14 Oct 2020 14:49:22 +1100 Subject: Fix T81511: Loop-cut overlay doesn't follow deformed cage With constructive + deform modifiers, loop-cut visualization wasn't following the displayed mesh. This now gets the coordinates from the cage when available. --- source/blender/blenkernel/intern/editmesh.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'source/blender/blenkernel/intern/editmesh.c') diff --git a/source/blender/blenkernel/intern/editmesh.c b/source/blender/blenkernel/intern/editmesh.c index 1a5b7685c0e..c5a4b48aed8 100644 --- a/source/blender/blenkernel/intern/editmesh.c +++ b/source/blender/blenkernel/intern/editmesh.c @@ -36,6 +36,7 @@ #include "BKE_lib_id.h" #include "BKE_mesh.h" #include "BKE_mesh_iterators.h" +// #include "BKE_jesh_runtime.h" #include "BKE_mesh_wrapper.h" #include "BKE_object.h" @@ -228,6 +229,34 @@ float (*BKE_editmesh_vert_coords_alloc(struct Depsgraph *depsgraph, return cos_cage; } +const float (*BKE_editmesh_vert_coords_when_deformed(struct Depsgraph *depsgraph, + BMEditMesh *em, + struct Scene *scene, + Object *ob, + int *r_vert_len, + bool *r_is_alloc))[3] +{ + const float(*coords)[3] = NULL; + *r_is_alloc = false; + + Mesh *me = ob->data; + + if ((me->runtime.edit_data != NULL) && (me->runtime.edit_data->vertexCos != NULL)) { + /* Deformed, and we have deformed coords already. */ + coords = me->runtime.edit_data->vertexCos; + } + else if ((em->mesh_eval_final != NULL) && + (em->mesh_eval_final->runtime.wrapper_type == ME_WRAPPER_TYPE_BMESH)) { + /* If this is an edit-mesh type, leave NULL as we can use the vertex coords. . */ + } + else { + /* Constructive modifiers have been used, we need to allocate coordinates. */ + *r_is_alloc = true; + coords = BKE_editmesh_vert_coords_alloc(depsgraph, em, scene, ob, r_vert_len); + } + return coords; +} + float (*BKE_editmesh_vert_coords_alloc_orco(BMEditMesh *em, int *r_vert_len))[3] { return BM_mesh_vert_coords_alloc(em->bm, r_vert_len); -- cgit v1.2.3