diff options
Diffstat (limited to 'source/blender')
20 files changed, 103 insertions, 106 deletions
diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h index 67b21eb764c..8bfee836c0d 100644 --- a/source/blender/blenkernel/BKE_bmesh.h +++ b/source/blender/blenkernel/BKE_bmesh.h @@ -99,7 +99,7 @@ typedef struct BME_Glob { /* stored in Global G for Transform() purposes */ struct BME_TransData *BME_get_transdata(struct BME_TransData_Head *td, struct BMVert *v); void BME_free_transdata(struct BME_TransData_Head *td); -struct BMesh *BME_bevel(struct BMEditMesh *em, float value, int res, int options, int defgrp_index, float angle, - BME_TransData_Head **rtd, int do_tessface); +struct BMesh *BME_bevel(struct BMesh *bm, float value, int res, int options, int defgrp_index, float angle, + BME_TransData_Head **rtd); #endif diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h index d7882d8e7ec..2b2497f3f50 100644 --- a/source/blender/blenkernel/BKE_cdderivedmesh.h +++ b/source/blender/blenkernel/BKE_cdderivedmesh.h @@ -55,8 +55,10 @@ int CDDM_Check(struct DerivedMesh *dm); * data to not overwrite the original */ struct DerivedMesh *CDDM_from_mesh(struct Mesh *mesh, struct Object *ob); +struct DerivedMesh *CDDM_from_bmesh(struct BMesh *bm, int use_mdisps); + /* creates a CDDerivedMesh from the given BMEditMesh */ -DerivedMesh *CDDM_from_BMEditMesh(struct BMEditMesh *em, struct Mesh *me, int use_mdisps, int use_tessface); +DerivedMesh *CDDM_from_editbmesh(struct BMEditMesh *em, int use_mdisps, int use_tessface); /* merge verts */ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 49025ceaaa1..4c4f7bdad80 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -903,7 +903,7 @@ static DerivedMesh *create_orco_dm(Object *ob, Mesh *me, BMEditMesh *em, int lay float (*orco)[3]; int free; - if (em) dm = CDDM_from_BMEditMesh(em, me, FALSE, FALSE); + if (em) dm = CDDM_from_editbmesh(em, FALSE, FALSE); else dm = CDDM_from_mesh(me, ob); orco = get_orco_coords_dm(ob, em, layer, &free); @@ -1976,7 +1976,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D } else { - dm = CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE); + dm = CDDM_from_editbmesh(em, FALSE, FALSE); if (deformedVerts) { CDDM_apply_vert_coords(dm, deformedVerts); diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 7c13f041e98..1f02ad1ea5a 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -1791,10 +1791,10 @@ DerivedMesh *CDDM_from_curve_displist(Object *ob, ListBase *dispbase, int **orco } static void loops_to_customdata_corners(BMesh *bm, CustomData *facedata, - int cdindex, BMLoop *l3[3], + int cdindex, const BMLoop *l3[3], int numCol, int numTex) { - BMLoop *l; + const BMLoop *l; BMFace *f = l3[0]->f; MTFace *texface; MTexPoly *texpoly; @@ -1837,13 +1837,16 @@ static void loops_to_customdata_corners(BMesh *bm, CustomData *facedata, } } -DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdisps, int use_tessface) +/* used for both editbmesh and bmesh */ +static DerivedMesh *cddm_from_bmesh_ex(struct BMesh *bm, int use_mdisps, + /* EditBMesh vars for use_tessface */ + int use_tessface, + const int em_tottri, const BMLoop *(*em_looptris)[3] + ) { - BMesh *bm = em->bm; - DerivedMesh *dm = CDDM_new(bm->totvert, bm->totedge, - use_tessface ? em->tottri : 0, + use_tessface ? em_tottri : 0, bm->totloop, bm->totface); @@ -1889,7 +1892,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis /* add tessellation mface layers */ if (use_tessface) { - CustomData_from_bmeshpoly(&dm->faceData, &dm->polyData, &dm->loopData, em->tottri); + CustomData_from_bmeshpoly(&dm->faceData, &dm->polyData, &dm->loopData, em_tottri); } index = dm->getVertDataArray(dm, CD_ORIGINDEX); @@ -1955,7 +1958,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis index = dm->getTessFaceDataArray(dm, CD_ORIGINDEX); for (i = 0; i < dm->numTessFaceData; i++, index++, polyindex++) { MFace *mf = &mface[i]; - BMLoop **l = em->looptris[i]; + const BMLoop **l = em_looptris[i]; efa = l[0]->f; mf->v1 = BM_elem_index_get(l[0]->v); @@ -2005,6 +2008,20 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis return dm; } +struct DerivedMesh *CDDM_from_bmesh(struct BMesh *bm, int use_mdisps) +{ + return cddm_from_bmesh_ex(bm, use_mdisps, FALSE, + /* these vars are for editmesh only */ + 0, NULL); +} + +DerivedMesh *CDDM_from_editbmesh(BMEditMesh *em, int use_mdisps, int use_tessface) +{ + return cddm_from_bmesh_ex(em->bm, use_mdisps, + /* editmesh */ + use_tessface, em->tottri, (const BMLoop *(*)[3])em->looptris); +} + static DerivedMesh *cddm_copy_ex(DerivedMesh *source, int faces_from_tessfaces) { CDDerivedMesh *cddm = cdDM_create("CDDM_copy cddm"); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index fc0bf9f1291..aef9ad633f7 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -432,7 +432,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[ /* get DerivedMesh */ if (em) { /* target is in editmode, so get a special derived mesh */ - dm = CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE); + dm = CDDM_from_editbmesh(em, FALSE, FALSE); freeDM = 1; } else { diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 360e2c93de3..32879caec71 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -295,7 +295,7 @@ static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from /* switch multires data out of tangent space */ if (CustomData_has_layer(&bm->ldata, CD_MDISPS)) { BMEditMesh *em = BMEdit_Create(bm, FALSE); - DerivedMesh *dm = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE); + DerivedMesh *dm = CDDM_from_editbmesh(em, TRUE, FALSE); MDisps *mdisps; BMFace *f; BMIter iter; diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index 98f270abd16..a632a4446ed 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -1096,10 +1096,9 @@ static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int option return bm; } -BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_index, float angle, - BME_TransData_Head **rtd, int do_tessface) +BMesh *BME_bevel(BMesh *bm, float value, int res, int options, int defgrp_index, float angle, + BME_TransData_Head **rtd) { - BMesh *bm = em->bm; BMVert *v; BMIter iter; @@ -1126,12 +1125,6 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i BMO_pop(bm); } - /* possibly needed when running as a tool (which is no longer functional) - * but keep as an option for now */ - if (do_tessface) { - BMEdit_RecalcTessellation(em); - } - /* interactive preview? */ if (rtd) { *rtd = td; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 926b6cfe59e..74d007e92c0 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -408,7 +408,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *e smd.levels = scene->toolsettings->uv_subsurf_level; smd.subdivType = ME_CC_SUBSURF; - initialDerived = CDDM_from_BMEditMesh(em, NULL, 0, 0); + initialDerived = CDDM_from_editbmesh(em, FALSE, FALSE); derivedMesh = subsurf_make_derived_from_derived(initialDerived, &smd, NULL, SUBSURF_IN_EDIT_MODE); diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index e6d86de45b4..7219038b087 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -135,13 +135,13 @@ static void deformVerts(ModifierData *md, Object *ob, } static void deformVertsEM( - ModifierData *md, Object *ob, struct BMEditMesh *editData, + ModifierData *md, Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { ArmatureModifierData *amd = (ArmatureModifierData *) md; DerivedMesh *dm = derivedData; - if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); + if (!derivedData) dm = CDDM_from_editbmesh(em, FALSE, FALSE); modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */ @@ -158,14 +158,14 @@ static void deformVertsEM( } static void deformMatricesEM( - ModifierData *md, Object *ob, struct BMEditMesh *editData, + ModifierData *md, Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], float (*defMats)[3][3], int numVerts) { ArmatureModifierData *amd = (ArmatureModifierData *) md; DerivedMesh *dm = derivedData; - if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); + if (!derivedData) dm = CDDM_from_editbmesh(em, FALSE, FALSE); armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts, amd->deformflag, NULL, amd->defgrp_name); diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 26682e30841..7b699e5633c 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -53,7 +53,8 @@ #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_object.h" -#include "BKE_tessmesh.h" + +#include "bmesh.h" #include "depsgraph_private.h" @@ -310,7 +311,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, int UNUSED(initFlags)) { DerivedMesh *result; - BMEditMesh *em = DM_to_editbmesh(dm, NULL, FALSE); + BMesh *bm = DM_to_bmesh(dm); BMOperator first_dupe_op, dupe_op, old_dupe_op, weld_op; BMVert **first_geom = NULL; int i, j, indexLen; @@ -406,14 +407,14 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, * cleaner way to do this. One possibility: a "mirror" BMOp would * certainly help by compressing it all into one top-level BMOp that * executes a lot of second-level BMOps. */ - BMO_push(em->bm, NULL); - bmesh_edit_begin(em->bm, 0); + BMO_push(bm, NULL); + bmesh_edit_begin(bm, 0); if (amd->flags & MOD_ARR_MERGE) - BMO_op_init(em->bm, &weld_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE), + BMO_op_init(bm, &weld_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE), "weld_verts"); - BMO_op_initf(em->bm, &dupe_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE), + BMO_op_initf(bm, &dupe_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE), "duplicate geom=%avef"); first_dupe_op = dupe_op; @@ -424,11 +425,11 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, BMOIter oiter; if (j != 0) { - BMO_op_initf(em->bm, &dupe_op, + BMO_op_initf(bm, &dupe_op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE), "duplicate geom=%s", &old_dupe_op, "newout"); } - BMO_op_exec(em->bm, &dupe_op); + BMO_op_exec(bm, &dupe_op); geom_slot = BMO_slot_get(&dupe_op, "geom"); newout_slot = BMO_slot_get(&dupe_op, "newout"); @@ -443,14 +444,14 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, } /* apply transformation matrix */ - BMO_ITER (v, &oiter, em->bm, &dupe_op, "newout", BM_VERT) { + BMO_ITER (v, &oiter, bm, &dupe_op, "newout", BM_VERT) { mul_m4_v3(offset, v->co); } if (amd->flags & MOD_ARR_MERGE) { /*calculate merge mapping*/ if (j == 0) { - indexMap = find_doubles_index_map(em->bm, &dupe_op, + indexMap = find_doubles_index_map(bm, &dupe_op, amd, &indexLen); } @@ -465,11 +466,11 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, /* check in case the target vertex (v2) is already marked * for merging */ - while ((v3 = BMO_slot_map_ptr_get(em->bm, &weld_op, "targetmap", v2))) { + while ((v3 = BMO_slot_map_ptr_get(bm, &weld_op, "targetmap", v2))) { v2 = v3; } - BMO_slot_map_ptr_insert(em->bm, &weld_op, "targetmap", v, v2); + BMO_slot_map_ptr_insert(bm, &weld_op, "targetmap", v, v2); } #undef _E @@ -481,7 +482,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, first_dupe_op = dupe_op; if (j >= 2) - BMO_op_finish(em->bm, &old_dupe_op); + BMO_op_finish(bm, &old_dupe_op); old_dupe_op = dupe_op; } @@ -494,45 +495,44 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, * loop) the offset between first and last is different from * dupe X to dupe X+1. */ - merge_first_last(em->bm, amd, &first_dupe_op, &dupe_op, &weld_op); + merge_first_last(bm, amd, &first_dupe_op, &dupe_op, &weld_op); } /* start capping */ if (start_cap || end_cap) { - BM_mesh_elem_hflag_enable_all(em->bm, BM_VERT, BM_ELEM_TAG, FALSE); + BM_mesh_elem_hflag_enable_all(bm, BM_VERT, BM_ELEM_TAG, FALSE); if (start_cap) { float startoffset[4][4]; invert_m4_m4(startoffset, offset); - bm_merge_dm_transform(em->bm, start_cap, startoffset, amd, + bm_merge_dm_transform(bm, start_cap, startoffset, amd, &first_dupe_op, "geom", &weld_op); } if (end_cap) { float endoffset[4][4]; mult_m4_m4m4(endoffset, offset, final_offset); - bm_merge_dm_transform(em->bm, end_cap, endoffset, amd, + bm_merge_dm_transform(bm, end_cap, endoffset, amd, &dupe_op, count == 1 ? "geom" : "newout", &weld_op); } } /* done capping */ /* free remaining dupe operators */ - BMO_op_finish(em->bm, &first_dupe_op); + BMO_op_finish(bm, &first_dupe_op); if (count > 2) - BMO_op_finish(em->bm, &dupe_op); + BMO_op_finish(bm, &dupe_op); /* run merge operator */ if (amd->flags & MOD_ARR_MERGE) { - BMO_op_exec(em->bm, &weld_op); - BMO_op_finish(em->bm, &weld_op); + BMO_op_exec(bm, &weld_op); + BMO_op_finish(bm, &weld_op); } /* Bump the stack level back down to match the adjustment up above */ - BMO_pop(em->bm); + BMO_pop(bm); - BLI_assert(em->looptris == NULL); - result = CDDM_from_BMEditMesh(em, NULL, FALSE, FALSE); + result = CDDM_from_bmesh(bm, FALSE); if ((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) { /* Update normals in case offset object has rotation. */ @@ -543,8 +543,8 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, CDDM_calc_normals(result); } - BMEdit_Free(em); - MEM_freeN(em); + BM_mesh_free(bm); + if (indexMap) MEM_freeN(indexMap); if (first_geom) diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index c3cae63971b..3e3bcb73491 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -38,11 +38,11 @@ #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" -#include "BKE_tessmesh.h" #include "BKE_mesh.h" - #include "BKE_bmesh.h" /* only for defines */ +#include "bmesh.h" + #include "DNA_object_types.h" #include "MEM_guardedalloc.h" @@ -88,6 +88,8 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) return dataMask; } +// #define USE_BM_BEVEL_OP_AS_MOD + #ifdef USE_BM_BEVEL_OP_AS_MOD #define EDGE_MARK 1 @@ -111,14 +113,12 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob), { DerivedMesh *result; BMesh *bm; - BMEditMesh *em; BMIter iter; BMEdge *e; BevelModifierData *bmd = (BevelModifierData *) md; - float threshold = cos((bmd->bevel_angle + 0.00001) * M_PI / 180.0); + float threshold = cos((bmd->bevel_angle + 0.00001f) * M_PI / 180.0f); - em = DM_to_editbmesh(dm, NULL, FALSE); - bm = em->bm; + bm = DM_to_bmesh(dm); BM_mesh_normals_update(bm, FALSE); BMO_push(bm, NULL); @@ -148,10 +148,8 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob), EDGE_MARK, bmd->value, (bmd->flags & BME_BEVEL_EVEN) != 0, (bmd->flags & BME_BEVEL_DIST) != 0); BMO_pop(bm); - BLI_assert(em->looptris == NULL); - result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE); - BMEdit_Free(em); - MEM_freeN(em); + result = CDDM_from_bmesh(bm, TRUE); + BM_mesh_free(bm); return result; } @@ -164,7 +162,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), ModifierApplyFlag UNUSED(flag)) { DerivedMesh *result; - BMEditMesh *em; + BMesh *bm; /*bDeformGroup *def;*/ int /*i,*/ options, defgrp_index = -1; @@ -181,12 +179,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), } #endif - em = DM_to_editbmesh(derivedData, NULL, FALSE); - BME_bevel(em, bmd->value, bmd->res, options, defgrp_index, DEG2RADF(bmd->bevel_angle), NULL, FALSE); - BLI_assert(em->looptris == NULL); - result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE); - BMEdit_Free(em); - MEM_freeN(em); + bm = DM_to_bmesh(derivedData); + BME_bevel(bm, bmd->value, bmd->res, options, defgrp_index, DEG2RADF(bmd->bevel_angle), NULL); + result = CDDM_from_bmesh(bm, TRUE); + BM_mesh_free(bm); /* until we allow for dirty normal flag, always calc, * note: calculating on the CDDM is faster then the BMesh equivalent */ diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c index 0ce4d74aebb..3ef6b9bfcb8 100644 --- a/source/blender/modifiers/intern/MOD_curve.c +++ b/source/blender/modifiers/intern/MOD_curve.c @@ -125,12 +125,12 @@ static void deformVerts(ModifierData *md, Object *ob, } static void deformVertsEM( - ModifierData *md, Object *ob, struct BMEditMesh *editData, + ModifierData *md, Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = derivedData; - if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); + if (!derivedData) dm = CDDM_from_editbmesh(em, FALSE, FALSE); deformVerts(md, ob, dm, vertexCos, numVerts, 0); diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c index b7b9384b4e8..a8033876037 100644 --- a/source/blender/modifiers/intern/MOD_decimate.c +++ b/source/blender/modifiers/intern/MOD_decimate.c @@ -48,7 +48,6 @@ #include "BKE_particle.h" #include "BKE_cdderivedmesh.h" -#include "BKE_tessmesh.h" #include "bmesh.h" // #define USE_TIMEIT @@ -97,7 +96,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, { DecimateModifierData *dmd = (DecimateModifierData *) md; DerivedMesh *dm = derivedData, *result = NULL; - BMEditMesh *em; BMesh *bm; float *vweights = NULL; @@ -159,8 +157,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } } - em = DM_to_editbmesh(dm, NULL, FALSE); - bm = em->bm; + bm = DM_to_bmesh(dm); switch (dmd->mode) { case MOD_DECIM_MODE_COLLAPSE: @@ -188,18 +185,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* update for display only */ dmd->face_count = bm->totface; - - BLI_assert(em->looptris == NULL); - result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE); - BMEdit_Free(em); - MEM_freeN(em); + result = CDDM_from_bmesh(bm, FALSE); + BM_mesh_free(bm); #ifdef USE_TIMEIT - TIMEIT_END(decim); + TIMEIT_END(decim); #endif - CDDM_calc_normals(result); - return result; } diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index b1c3459bf51..be24f73502e 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -43,9 +43,10 @@ #include "BKE_cdderivedmesh.h" #include "BKE_modifier.h" -#include "BKE_tessmesh.h" #include "BKE_mesh.h" +#include "bmesh.h" + #include "DNA_object_types.h" /* EdgeSplit */ @@ -61,13 +62,11 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj { DerivedMesh *result; BMesh *bm; - BMEditMesh *em; BMIter iter; BMEdge *e; float threshold = cosf((emd->split_angle + 0.00001f) * (float)M_PI / 180.0f); - em = DM_to_editbmesh(dm, NULL, FALSE); - bm = em->bm; + bm = DM_to_bmesh(dm); BM_mesh_normals_update(bm, FALSE); BMO_push(bm, NULL); @@ -110,10 +109,8 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj /* BM_mesh_validate(bm); */ /* for troubleshooting */ - BLI_assert(em->looptris == NULL); - result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE); - BMEdit_Free(em); - MEM_freeN(em); + result = CDDM_from_bmesh(bm, TRUE); + BM_mesh_free(bm); return result; } diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c index d64ccf750b2..a5c52c6c76a 100644 --- a/source/blender/modifiers/intern/MOD_lattice.c +++ b/source/blender/modifiers/intern/MOD_lattice.c @@ -122,12 +122,12 @@ static void deformVerts(ModifierData *md, Object *ob, } static void deformVertsEM( - ModifierData *md, Object *ob, struct BMEditMesh *editData, + ModifierData *md, Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = derivedData; - if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); + if (!derivedData) dm = CDDM_from_editbmesh(em, FALSE, FALSE); deformVerts(md, ob, dm, vertexCos, numVerts, 0); diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index febc4190fdf..83c678db7b3 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -43,7 +43,8 @@ #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_deform.h" -#include "BKE_tessmesh.h" + +#include "bmesh.h" #include "MEM_guardedalloc.h" #include "depsgraph_private.h" diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index af5de2e8738..ee0922d388b 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -77,7 +77,8 @@ #include "BKE_DerivedMesh.h" #include "BKE_mesh.h" #include "BKE_modifier.h" -#include "BKE_tessmesh.h" + +#include "bmesh.h" #include "MOD_util.h" @@ -1770,7 +1771,6 @@ static void skin_set_orig_indices(DerivedMesh *dm) static DerivedMesh *base_skin(DerivedMesh *origdm, SkinModifierData *smd) { - BMEditMesh fake_em; DerivedMesh *result; MVertSkin *nodes; BMesh *bm; @@ -1807,8 +1807,7 @@ static DerivedMesh *base_skin(DerivedMesh *origdm, if (!bm) return NULL; - fake_em.bm = bm; - result = CDDM_from_BMEditMesh(&fake_em, NULL, FALSE, FALSE); + result = CDDM_from_bmesh(bm, FALSE); BM_mesh_free(bm); CDDM_calc_edges(result); @@ -1861,7 +1860,7 @@ static void copyData(ModifierData *md, ModifierData *target) static DerivedMesh *applyModifierEM(ModifierData *md, Object *UNUSED(ob), - BMEditMesh *UNUSED(em), + struct BMEditMesh *UNUSED(em), DerivedMesh *dm) { DerivedMesh *result; diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 3702db567ab..6443a88a222 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -199,7 +199,7 @@ DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (* return dm; if (ob->type == OB_MESH) { - if (em) dm = CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE); + if (em) dm = CDDM_from_editbmesh(em, FALSE, FALSE); else dm = CDDM_from_mesh((struct Mesh *)(ob->data), ob); if (vertexCos) { diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index e8cd4f25789..c2a62231529 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -337,7 +337,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, } } -static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editData, +static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *em, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { DerivedMesh *dm = derivedData; @@ -345,7 +345,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD if (use_dm) { if (!derivedData) - dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE); + dm = CDDM_from_editbmesh(em, FALSE, FALSE); } deformVerts(md, ob, dm, vertexCos, numVerts, 0); diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 1094cebba75..e936e571a5b 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -460,7 +460,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der else if (obr->type == OB_MESH) { Mesh *me = (Mesh *)obr->data; if (me->edit_btmesh) - target_dm = CDDM_from_BMEditMesh(me->edit_btmesh, me, FALSE, FALSE); + target_dm = CDDM_from_editbmesh(me->edit_btmesh, FALSE, FALSE); else target_dm = CDDM_from_mesh(me, obr); } |