Edit Mesh: replace DerivedMesh w/ Mesh
authorCampbell Barton <ideasman42@gmail.com>
Tue, 9 Oct 2018 05:52:46 +0000 (16:52 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 9 Oct 2018 06:48:28 +0000 (17:48 +1100)
DerivedMesh is now removed from edit-mesh modifier evaluation.

15 files changed:
source/blender/blenkernel/BKE_DerivedMesh.h
source/blender/blenkernel/BKE_cdderivedmesh.h
source/blender/blenkernel/BKE_editmesh.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/crazyspace.c
source/blender/blenkernel/intern/editderivedmesh.c
source/blender/blenkernel/intern/editmesh.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/object_dupli.c
source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
source/blender/draw/intern/draw_cache_impl_mesh.c
source/blender/editors/space_view3d/view3d_iterators.c
source/blender/editors/util/ed_transverts.c
source/blender/modifiers/intern/MOD_meshdeform.c

index 3db032da1b14e197a43a25057d73127f2d00b3e1..db918bb0fbd3a08e60a7b6b8a29e426b2ccecb5f 100644 (file)
@@ -514,7 +514,7 @@ void DM_interp_poly_data(
  * In use now by vertex/weight paint and particles */
 DMCoNo *mesh_get_mapped_verts_nors(struct Scene *scene, struct Object *ob);
 #endif
-void mesh_get_mapped_verts_coords(DerivedMesh *dm, float (*r_cos)[3], const int totcos);
+void mesh_get_mapped_verts_coords(struct Mesh *me_eval, float (*r_cos)[3], const int totcos);
 
 /* */
 
@@ -537,15 +537,13 @@ DerivedMesh *mesh_create_derived_no_deform_render(
         struct Object *ob, float (*vertCos)[3],
         CustomDataMask dataMask);
 
-DerivedMesh *editbmesh_get_derived_cage(
+struct Mesh *editbmesh_get_eval_cage(
         struct Depsgraph *depsgraph, struct Scene *scene, struct Object *,
         struct BMEditMesh *em, CustomDataMask dataMask);
-DerivedMesh *editbmesh_get_derived_cage_and_final(
+struct Mesh *editbmesh_get_eval_cage_and_final(
         struct Depsgraph *depsgraph, struct Scene *scene, struct Object *,
         struct BMEditMesh *em, CustomDataMask dataMask,
-        DerivedMesh **r_final);
-
-DerivedMesh *object_get_derived_final(struct Object *ob, const bool for_render);
+        struct Mesh **r_final);
 
 float (*editbmesh_get_vertex_cos(struct BMEditMesh *em, int *r_numVerts))[3];
 bool editbmesh_modifier_is_enabled(struct Scene *scene, struct ModifierData *md, bool has_prev_mesh);
index b31a3548a1e6e3b7d8a77a3b728c50d1fe9b16af..6d96bd6ab7cfae764965b2f1be1689f88be0b830 100644 (file)
@@ -178,6 +178,4 @@ void CDDM_set_mface(struct DerivedMesh *dm, struct MFace *mface);
 void CDDM_set_mloop(struct DerivedMesh *dm, struct MLoop *mloop);
 void CDDM_set_mpoly(struct DerivedMesh *dm, struct MPoly *mpoly);
 
-void CDDM_to_mesh__fast_borrow(struct DerivedMesh *dm, struct Mesh *me, const struct Mesh *me_reference);
-
 #endif
index 65c2caa4d78f07f7e3b2eab0ebffeaee6d249b43..de4efaf37b0f7234cd59b015d2bb3790a49130f3 100644 (file)
@@ -64,8 +64,9 @@ typedef struct BMEditMesh {
        struct BMLoop *(*looptris)[3];
        int tottri;
 
+       struct Mesh *mesh_eval_final, *mesh_eval_cage;
+
        /*derivedmesh stuff*/
-       struct DerivedMesh *derivedFinal, *derivedCage;
        CustomDataMask lastDataMask;
        unsigned char (*derivedVertColor)[4];
        int derivedVertColorLen;
index 4fb99008e8c923c275208680795511c5d9f6c4e6..444dd3c0db3857534ff828ac09923485aa90faa5 100644 (file)
@@ -60,6 +60,7 @@
 #include "BKE_material.h"
 #include "BKE_modifier.h"
 #include "BKE_mesh.h"
+#include "BKE_mesh_iterators.h"
 #include "BKE_mesh_mapping.h"
 #include "BKE_mesh_runtime.h"
 #include "BKE_mesh_tangent.h"
@@ -2307,24 +2308,16 @@ static void editbmesh_build_data(
                depsgraph, scene, obedit, em, dataMask,
                &me_cage, &me_final);
 
-       /* TODO(campbell): remove derived mesh conversion. */
-       em->derivedFinal = CDDM_from_mesh_ex(me_final, CD_DUPLICATE, CD_MASK_MESH);
-       BKE_id_free(NULL, me_final);
-       if (me_cage != me_final) {
-               em->derivedCage = CDDM_from_mesh_ex(me_cage, CD_DUPLICATE, CD_MASK_MESH);
-               BKE_id_free(NULL, me_cage);
-       }
-       else {
-               em->derivedCage = em->derivedFinal;
-       }
+       em->mesh_eval_final = me_final;
+       em->mesh_eval_cage = me_cage;
 
+#if 0
        DM_set_object_boundbox(obedit, em->derivedFinal);
+#endif
 
        em->lastDataMask = dataMask;
-       em->derivedFinal->needsFree = 0;
-       em->derivedCage->needsFree = 0;
 
-       BLI_assert(!(em->derivedFinal->dirty & DM_DIRTY_NORMALS));
+       BLI_assert(!(em->mesh_eval_final->runtime.cd_dirty_vert & DM_DIRTY_NORMALS));
 }
 
 static CustomDataMask object_get_datamask(const Depsgraph *depsgraph, Object *ob, bool *r_need_mapping)
@@ -2559,29 +2552,29 @@ DerivedMesh *mesh_create_derived_no_deform(
 
 /***/
 
-DerivedMesh *editbmesh_get_derived_cage_and_final(
+Mesh *editbmesh_get_eval_cage_and_final(
         struct Depsgraph *depsgraph, Scene *scene, Object *obedit, BMEditMesh *em,
         CustomDataMask dataMask,
         /* return args */
-        DerivedMesh **r_final)
+        Mesh **r_final)
 {
        /* if there's no derived mesh or the last data mask used doesn't include
         * the data we need, rebuild the derived mesh
         */
        dataMask |= object_get_datamask(depsgraph, obedit, NULL);
 
-       if (!em->derivedCage ||
+       if (!em->mesh_eval_cage ||
            (em->lastDataMask & dataMask) != dataMask)
        {
                editbmesh_build_data(depsgraph, scene, obedit, em, dataMask);
        }
 
-       *r_final = em->derivedFinal;
-       if (em->derivedFinal) { BLI_assert(!(em->derivedFinal->dirty & DM_DIRTY_NORMALS)); }
-       return em->derivedCage;
+       *r_final = em->mesh_eval_final;
+       if (em->mesh_eval_final) { BLI_assert(!(em->mesh_eval_final->runtime.cd_dirty_vert & DM_DIRTY_NORMALS)); }
+       return em->mesh_eval_cage;
 }
 
-DerivedMesh *editbmesh_get_derived_cage(
+Mesh *editbmesh_get_eval_cage(
         struct Depsgraph *depsgraph, Scene *scene, Object *obedit, BMEditMesh *em,
         CustomDataMask dataMask)
 {
@@ -2590,40 +2583,17 @@ DerivedMesh *editbmesh_get_derived_cage(
         */
        dataMask |= object_get_datamask(depsgraph, obedit, NULL);
 
-       if (!em->derivedCage ||
+       if (!em->mesh_eval_cage ||
            (em->lastDataMask & dataMask) != dataMask)
        {
                editbmesh_build_data(depsgraph, scene, obedit, em, dataMask);
        }
 
-       return em->derivedCage;
+       return em->mesh_eval_cage;
 }
 
 /***/
 
-/* get derived mesh from an object, using editbmesh if available. */
-DerivedMesh *object_get_derived_final(Object *ob, const bool for_render)
-{
-       if (for_render) {
-               /* TODO(sergey): use proper derived render here in the future. */
-               return ob->derivedFinal;
-       }
-
-       /* only return the editmesh if its from this object because
-        * we don't a mesh from another object's modifier stack: T43122 */
-       if (ob->type == OB_MESH) {
-               Mesh *me = ob->data;
-               BMEditMesh *em = me->edit_btmesh;
-               if (em && (em->ob == ob)) {
-                       DerivedMesh *dm = em->derivedFinal;
-                       return dm;
-               }
-       }
-
-       return ob->derivedFinal;
-}
-
-
 /* UNUSED */
 #if 0
 
@@ -2705,20 +2675,20 @@ static void make_vertexcos__mapFunc(
        }
 }
 
-void mesh_get_mapped_verts_coords(DerivedMesh *dm, float (*r_cos)[3], const int totcos)
+void mesh_get_mapped_verts_coords(Mesh *me_eval, float (*r_cos)[3], const int totcos)
 {
-       if (dm->foreachMappedVert) {
+       if (me_eval->runtime.deformed_only == false) {
                MappedUserData userData;
                memset(r_cos, 0, sizeof(*r_cos) * totcos);
                userData.vertexcos = r_cos;
                userData.vertex_visit = BLI_BITMAP_NEW(totcos, "vertexcos flags");
-               dm->foreachMappedVert(dm, make_vertexcos__mapFunc, &userData, DM_FOREACH_NOP);
+               BKE_mesh_foreach_mapped_vert(me_eval, make_vertexcos__mapFunc, &userData, MESH_FOREACH_NOP);
                MEM_freeN(userData.vertex_visit);
        }
        else {
-               int i;
-               for (i = 0; i < totcos; i++) {
-                       dm->getVertCo(dm, i, r_cos[i]);
+               MVert *mv = me_eval->mvert;
+               for (int i = 0; i < totcos; i++, mv++) {
+                       copy_v3_v3(r_cos[i], mv->co);
                }
        }
 }
index 83424da3a3d95eb1f9f123f1a6cf0adedd83e6ad..9043460562deb52547018b7eb3f459411d1a9390 100644 (file)
@@ -2258,29 +2258,3 @@ void CDDM_set_mpoly(DerivedMesh *dm, MPoly *mpoly)
 
        cddm->mpoly = mpoly;
 }
-
-/** Hack to fill in an empty (non library mesh struct) with CDDM values. */
-void CDDM_to_mesh__fast_borrow(DerivedMesh *dm, Mesh *me, const Mesh *me_reference)
-{
-       CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
-       me->totvert = cddm->dm.numVertData;
-       me->totedge = cddm->dm.numEdgeData;
-       me->totloop = cddm->dm.numLoopData;
-       me->totpoly = cddm->dm.numPolyData;
-
-       me->mvert = cddm->mvert;
-       me->medge = cddm->medge;
-       me->mface = cddm->mface;
-       me->mloop = cddm->mloop;
-       me->mpoly = cddm->mpoly;
-
-       me->vdata = dm->vertData;
-       me->edata = dm->edgeData;
-       me->ldata = dm->loopData;
-       me->pdata = dm->polyData;
-
-       if (me_reference) {
-               me->mat = me_reference->mat;
-               me->totcol = me_reference->totcol;
-       }
-}
index 55a62e4981f1cec7ccdca82829b3b00bec8ddc68..bfb6fbd897c352eb71dbf524c675e4c72060a3c2 100644 (file)
@@ -104,7 +104,7 @@ float (*BKE_crazyspace_get_mapped_editverts(
            struct Depsgraph *depsgraph, Scene *scene, Object *obedit))[3]
 {
        Mesh *me = obedit->data;
-       DerivedMesh *dm;
+       Mesh *me_eval;
        float (*vertexcos)[3];
        int nverts = me->edit_btmesh->bm->totvert;
 
@@ -117,11 +117,9 @@ float (*BKE_crazyspace_get_mapped_editverts(
        /* now get the cage */
        vertexcos = MEM_mallocN(sizeof(*vertexcos) * nverts, "vertexcos map");
 
-       dm = editbmesh_get_derived_cage(depsgraph, scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH);
-
-       mesh_get_mapped_verts_coords(dm, vertexcos, nverts);
+       me_eval = editbmesh_get_eval_cage(depsgraph, scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH);
 
-       dm->release(dm);
+       mesh_get_mapped_verts_coords(me_eval, vertexcos, nverts);
 
        /* set back the flag, no new cage needs to be built, transform does it */
        modifiers_disable_subsurf_temporary(obedit);
index 5ca8bcfd74d0750111cf8ca43b6b0118ec500a4f..e6873e66c9146af640bbbbbaa56154573b1a9c0a 100644 (file)
@@ -51,6 +51,7 @@
 #include "BKE_cdderivedmesh.h"
 #include "BKE_deform.h"
 #include "BKE_mesh.h"
+#include "BKE_mesh_iterators.h"
 #include "BKE_editmesh.h"
 #include "BKE_editmesh_bvh.h"
 #include "BKE_editmesh_cache.h"
@@ -528,12 +529,12 @@ static void cage_mapped_verts_callback(
 
 float (*BKE_editmesh_vertexCos_get(struct Depsgraph *depsgraph, BMEditMesh *em, Scene *scene, int *r_numVerts))[3]
 {
-       DerivedMesh *cage, *final;
+       Mesh *cage, *final;
        BLI_bitmap *visit_bitmap;
        struct CageUserData data;
        float (*cos_cage)[3];
 
-       cage = editbmesh_get_derived_cage_and_final(depsgraph, scene, em->ob, em, CD_MASK_BAREMESH, &final);
+       cage = editbmesh_get_eval_cage_and_final(depsgraph, scene, em->ob, em, CD_MASK_BAREMESH, &final);
        cos_cage = MEM_callocN(sizeof(*cos_cage) * em->bm->totvert, "bmbvh cos_cage");
 
        /* when initializing cage verts, we only want the first cage coordinate for each vertex,
@@ -544,7 +545,7 @@ float (*BKE_editmesh_vertexCos_get(struct Depsgraph *depsgraph, BMEditMesh *em,
        data.cos_cage = cos_cage;
        data.visit_bitmap = visit_bitmap;
 
-       cage->foreachMappedVert(cage, cage_mapped_verts_callback, &data, DM_FOREACH_NOP);
+       BKE_mesh_foreach_mapped_vert(cage, cage_mapped_verts_callback, &data, MESH_FOREACH_NOP);
 
        MEM_freeN(visit_bitmap);
 
index 9e1713dc80527507861a757a1b67be277f3a8138..0d09f4be39feaba287803f116f30f23b6c64d1dc 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "BKE_editmesh.h"
 #include "BKE_cdderivedmesh.h"
+#include "BKE_library.h"
 
 
 BMEditMesh *BKE_editmesh_create(BMesh *bm, const bool do_tessellate)
@@ -58,7 +59,7 @@ BMEditMesh *BKE_editmesh_copy(BMEditMesh *em)
        BMEditMesh *em_copy = MEM_callocN(sizeof(BMEditMesh), __func__);
        *em_copy = *em;
 
-       em_copy->derivedCage = em_copy->derivedFinal = NULL;
+       em_copy->mesh_eval_cage = em_copy->mesh_eval_final = NULL;
 
        em_copy->derivedVertColor = NULL;
        em_copy->derivedVertColorLen = 0;
@@ -169,16 +170,13 @@ void BKE_editmesh_tessface_calc(BMEditMesh *em)
 
 void BKE_editmesh_free_derivedmesh(BMEditMesh *em)
 {
-       if (em->derivedCage) {
-               em->derivedCage->needsFree = 1;
-               em->derivedCage->release(em->derivedCage);
+       if (em->mesh_eval_cage) {
+               BKE_id_free(NULL, em->mesh_eval_cage);
        }
-       if (em->derivedFinal && em->derivedFinal != em->derivedCage) {
-               em->derivedFinal->needsFree = 1;
-               em->derivedFinal->release(em->derivedFinal);
+       if (em->mesh_eval_final && em->mesh_eval_final != em->mesh_eval_cage) {
+               BKE_id_free(NULL, em->mesh_eval_final);
        }
-
-       em->derivedCage = em->derivedFinal = NULL;
+       em->mesh_eval_cage = em->mesh_eval_final = NULL;
 }
 
 /*does not free the BMEditMesh struct itself*/
index 71cf08e267dd4623c8ccbe0f5ee61d4f7a36ca27..b1d994b6e18159aa2b1a4cbeb2f5d3f022a12e54 100644 (file)
@@ -2052,7 +2052,11 @@ static void give_parvert(Object *par, int nr, float vec[3])
                BMEditMesh *em = me->edit_btmesh;
                DerivedMesh *dm;
 
+#if 0  /* FIXME(campbell): use mesh for both. */
                dm = (em) ? em->derivedFinal : par->derivedFinal;
+#else
+               dm = par->derivedFinal;
+#endif
 
                if (dm) {
                        int count = 0;
index 6d9520dad1e4f1aae3f4fdbbf1b6a3da085337c8..d9aa6407474a38b0056a9b6294319b800d7921d6 100644 (file)
@@ -488,7 +488,7 @@ static void make_duplis_verts(const DupliContext *ctx)
 
                /* We do not need any render-smecific handling anymore, depsgraph takes care of that. */
                if (vdd.edit_btmesh != NULL) {
-                       /* XXX TODO replace with equivalent of editbmesh_get_derived_cage when available. */
+                       /* XXX TODO replace with equivalent of editbmesh_get_eval_cage when available. */
                        vdd.me_eval = mesh_get_eval_deform(ctx->depsgraph, scene, parent, dm_mask);
                }
                else {
@@ -758,7 +758,7 @@ static void make_duplis_faces(const DupliContext *ctx)
 
                /* We do not need any render-smecific handling anymore, depsgraph takes care of that. */
                if (em != NULL) {
-                       /* XXX TODO replace with equivalent of editbmesh_get_derived_cage when available. */
+                       /* XXX TODO replace with equivalent of editbmesh_get_eval_cage when available. */
                        fdd.me_eval = mesh_get_eval_deform(ctx->depsgraph, scene, parent, dm_mask);
                }
                else {
index 5b52843c1febdd002c6469fa7ba6b0fc16563c98..d7575c35e457b7d3053fa63d860ed18a9dd65fd9 100644 (file)
@@ -466,8 +466,8 @@ void update_mesh_edit_mode_pointers(const Depsgraph *depsgraph,
        mesh_cow->edit_btmesh = (BMEditMesh *)MEM_dupallocN(mesh_orig->edit_btmesh);
        mesh_cow->edit_btmesh->ob =
            (Object *)depsgraph->get_cow_id(&mesh_orig->edit_btmesh->ob->id);
-       mesh_cow->edit_btmesh->derivedFinal = NULL;
-       mesh_cow->edit_btmesh->derivedCage = NULL;
+       mesh_cow->edit_btmesh->mesh_eval_cage = NULL;
+       mesh_cow->edit_btmesh->mesh_eval_final = NULL;
 }
 
 /* Edit data is stored and owned by original datablocks, copied ones
index e1787c2650b3f30f75fed275f543988dbbfdeb85..abf6db99f17b62022147933b2b1fd12211563cb2 100644 (file)
@@ -4464,12 +4464,13 @@ GPUBatch **DRW_mesh_batch_cache_get_surface_shaded(
                /* Hack to show the final result. */
                const bool use_em_final = (
                        me->edit_btmesh &&
-                       me->edit_btmesh->derivedFinal &&
-                       (me->edit_btmesh->derivedFinal->type == DM_TYPE_CDDM));
+                       me->edit_btmesh->mesh_eval_final &&
+                       (me->edit_btmesh->mesh_eval_final->runtime.deformed_only == false));
                Mesh me_fake;
                if (use_em_final) {
-                       memset(&me_fake, 0x0, sizeof(me_fake));
-                       CDDM_to_mesh__fast_borrow(me->edit_btmesh->derivedFinal, &me_fake, me);
+                       me_fake = *me->edit_btmesh->mesh_eval_final;
+                       me_fake.mat = me->mat;
+                       me_fake.totcol = me->totcol;
                        me = &me_fake;
                }
 
index 499331639c4bef8d07d3ca327a3096252b533fa3..1a3b0bf64cd93e08c3187ac263f0b3cd1daf4616 100644 (file)
@@ -43,6 +43,7 @@
 #include "BKE_editmesh.h"
 #include "BKE_context.h"
 #include "BKE_mesh_runtime.h"
+#include "BKE_mesh_iterators.h"
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_query.h"
@@ -158,9 +159,8 @@ void mesh_foreachScreenVert(
         void *userData, eV3DProjTest clip_flag)
 {
        foreachScreenVert_userData data;
-       DerivedMesh *dm;
 
-       dm = editbmesh_get_derived_cage(vc->depsgraph, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
+       Mesh *me = editbmesh_get_eval_cage(vc->depsgraph, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
 
        ED_view3d_check_mats_rv3d(vc->rv3d);
 
@@ -174,9 +174,7 @@ void mesh_foreachScreenVert(
        }
 
        BM_mesh_elem_table_ensure(vc->em->bm, BM_VERT);
-       dm->foreachMappedVert(dm, mesh_foreachScreenVert__mapFunc, &data, DM_FOREACH_NOP);
-
-       dm->release(dm);
+       BKE_mesh_foreach_mapped_vert(me, mesh_foreachScreenVert__mapFunc, &data, MESH_FOREACH_NOP);
 }
 
 /* ------------------------------------------------------------------------ */
@@ -214,9 +212,8 @@ void mesh_foreachScreenEdge(
         void *userData, eV3DProjTest clip_flag)
 {
        foreachScreenEdge_userData data;
-       DerivedMesh *dm;
 
-       dm = editbmesh_get_derived_cage(vc->depsgraph, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
+       Mesh *me = editbmesh_get_eval_cage(vc->depsgraph, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
 
        ED_view3d_check_mats_rv3d(vc->rv3d);
 
@@ -236,9 +233,7 @@ void mesh_foreachScreenEdge(
        }
 
        BM_mesh_elem_table_ensure(vc->em->bm, BM_EDGE);
-       dm->foreachMappedEdge(dm, mesh_foreachScreenEdge__mapFunc, &data);
-
-       dm->release(dm);
+       BKE_mesh_foreach_mapped_edge(me, mesh_foreachScreenEdge__mapFunc, &data);
 }
 
 /* ------------------------------------------------------------------------ */
@@ -262,10 +257,8 @@ void mesh_foreachScreenFace(
         void *userData, const eV3DProjTest clip_flag)
 {
        foreachScreenFace_userData data;
-       DerivedMesh *dm;
-
-       dm = editbmesh_get_derived_cage(vc->depsgraph, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
 
+       Mesh *me = editbmesh_get_eval_cage(vc->depsgraph, vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
        ED_view3d_check_mats_rv3d(vc->rv3d);
 
        data.vc = *vc;
@@ -274,9 +267,7 @@ void mesh_foreachScreenFace(
        data.clip_flag = clip_flag;
 
        BM_mesh_elem_table_ensure(vc->em->bm, BM_FACE);
-       dm->foreachMappedFaceCenter(dm, mesh_foreachScreenFace__mapFunc, &data, DM_FOREACH_NOP);
-
-       dm->release(dm);
+       BKE_mesh_foreach_mapped_face_center(me, mesh_foreachScreenFace__mapFunc, &data, MESH_FOREACH_NOP);
 }
 
 /* ------------------------------------------------------------------------ */
index 3cd74f1266f9d0c057d2ce4fa14ac93501d34b97..583d1116eec3b87af90f526860cf9d7b0129c914 100644 (file)
@@ -43,6 +43,7 @@
 #include "BKE_editmesh.h"
 #include "BKE_DerivedMesh.h"
 #include "BKE_context.h"
+#include "BKE_mesh_iterators.h"
 
 #include "DEG_depsgraph.h"
 
@@ -304,9 +305,9 @@ void ED_transverts_create_from_obedit(TransVertStore *tvs, Object *obedit, const
                        userdata[1] = tvs->transverts;
                }
 
-               if (tvs->transverts && em->derivedCage) {
+               if (tvs->transverts && em->mesh_eval_cage) {
                        BM_mesh_elem_table_ensure(bm, BM_VERT);
-                       em->derivedCage->foreachMappedVert(em->derivedCage, set_mapped_co, userdata, DM_FOREACH_NOP);
+                       BKE_mesh_foreach_mapped_vert(em->mesh_eval_cage, set_mapped_co, userdata, MESH_FOREACH_NOP);
                }
        }
        else if (obedit->type == OB_ARMATURE) {
index 5aa134fc7e10eeb7da796c014994dc06409afcc5..a6afa39b8706e766e444bc349ef0a7fbfd29b02a 100644 (file)
@@ -299,7 +299,7 @@ static void meshdeformModifier_do(
         *
         * Only do this is the target object is in edit mode by itself, meaning
         * we don't allow linked edit meshes here.
-        * This is because editbmesh_get_derived_cage_and_final() might easily
+        * This is because editbmesh_get_mesh_cage_and_final() might easily
         * conflict with the thread which evaluates object which is in the edit
         * mode for this mesh.
         *