diff options
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_armature.c | 8 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_array.c | 52 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_bevel.c | 30 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_curve.c | 4 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_decimate.c | 16 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_edgesplit.c | 13 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_lattice.c | 4 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_mirror.c | 3 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_skin.c | 9 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_util.c | 2 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_warp.c | 4 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgproximity.c | 2 |
12 files changed, 66 insertions, 81 deletions
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); } |