Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-10-14 06:49:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-10-14 06:49:22 +0300
commit862b5b18421a986b3d2cf8b0951f1a58797aaa52 (patch)
tree65feaeec60b4a789c5ceec4baf6c70f60024dc9e /source/blender/blenkernel/intern/editmesh.c
parentdeca7c795411975e3bfb11cd6934ace768be772b (diff)
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.
Diffstat (limited to 'source/blender/blenkernel/intern/editmesh.c')
-rw-r--r--source/blender/blenkernel/intern/editmesh.c29
1 files changed, 29 insertions, 0 deletions
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);