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>2012-11-18 12:56:47 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-18 12:56:47 +0400
commit02049cfe6b0b7be7de48648c862b5a7c153874b5 (patch)
tree82a7097572f8f52e52b8f55e7ea10faa44b57143 /source/blender/modifiers
parent4401ac8c9e312a81bf1a750f0a7068e24174a7fd (diff)
commented bevel modifier code now calls bevel direct rather then the bevel operator.
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_bevel.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index 66e188693a6..e01c555d89e 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -92,20 +92,15 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
#ifdef USE_BM_BEVEL_OP_AS_MOD
-#define GEOM_MARK 1
-
/* BMESH_TODO
*
- * this bevel calls the operator which is missing many of the options
- * which the bevel modifier in trunk has.
+ * this bevel calls the new bevel code (added since 2.64)
+ * which is missing many of the options which the bevel modifier from 2.4x has.
* - no vertex bevel
* - no weight bevel
*
* These will need to be added to the bmesh operator.
- * - campbell
- *
- * note: this code is very close to MOD_edgesplit.c.
- * note: if 0'd code from trunk included below.
+ * - campbell
*/
static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
DerivedMesh *dm,
@@ -116,14 +111,11 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
BMIter iter;
BMEdge *e;
BevelModifierData *bmd = (BevelModifierData *) md;
- float threshold = cos((bmd->bevel_angle + 0.00001f) * (float)M_PI / 180.0f);
+ float threshold = cosf((bmd->bevel_angle + 0.00001f) * (float)M_PI / 180.0f);
const int segments = 16; /* XXX */
bm = DM_to_bmesh(dm);
- BM_mesh_normals_update(bm, FALSE);
- BMO_push(bm, NULL);
-
if (bmd->lim_flags & BME_BEVEL_ANGLE) {
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
/* check for 1 edge having 2 face users */
@@ -132,9 +124,9 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
(l2 = e->l->radial_next) != l1)
{
if (dot_v3v3(l1->f->no, l2->f->no) < threshold) {
- BMO_elem_flag_enable(bm, e, GEOM_MARK);
- BMO_elem_flag_enable(bm, e->v1, GEOM_MARK);
- BMO_elem_flag_enable(bm, e->v2, GEOM_MARK);
+ BM_elem_flag_enable(e, BM_ELEM_TAG);
+ BM_elem_flag_enable(e->v1, BM_ELEM_TAG);
+ BM_elem_flag_enable(e->v2, BM_ELEM_TAG);
}
}
}
@@ -142,20 +134,19 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
else {
/* crummy, is there a way just to operator on all? - campbell */
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
- BMO_elem_flag_enable(bm, e, GEOM_MARK);
- BMO_elem_flag_enable(bm, e->v1, GEOM_MARK);
- BMO_elem_flag_enable(bm, e->v2, GEOM_MARK);
+ BM_elem_flag_enable(e, BM_ELEM_TAG);
+ BM_elem_flag_enable(e->v1, BM_ELEM_TAG);
+ BM_elem_flag_enable(e->v2, BM_ELEM_TAG);
}
}
- BMO_op_callf(bm, BMO_FLAG_DEFAULTS,
- "bevel geom=%fve offset=%f segments=%i",
- GEOM_MARK, bmd->value, segments);
- BMO_pop(bm);
+ BM_mesh_bevel(bm, bmd->value, segments);
result = CDDM_from_bmesh(bm, TRUE);
BM_mesh_free(bm);
+ CDDM_calc_normals(result);
+
return result;
}