diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-24 11:24:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-24 11:24:11 +0400 |
commit | 2de2acc6819f7024f06a9dcdc4cc2346a1dd57f7 (patch) | |
tree | 3cf708af945985531baacb0268d86d268d81093a /source/blender/modifiers/intern/MOD_bevel.c | |
parent | 879d92062a703b9d7bd718432a37dc8e7dd4a9bc (diff) |
add CDDM_from_bmesh(), avoids using BMEditMesh in modifiers.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_bevel.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_bevel.c | 30 |
1 files changed, 13 insertions, 17 deletions
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 */ |