bmesh: being back bevel modifier from 2.62 stable.

this is no big improvement but at least its not a regression.

using the new operator for the bevel modifier can be enabled again be uncommenting a define.
This commit is contained in:
Campbell Barton 2012-03-15 23:56:46 +00:00
parent bed5ae5366
commit eab24df950
6 changed files with 29 additions and 17 deletions

@ -124,9 +124,11 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
split.prop(md, "use_only_vertices")
# -- new modifier only, this may be reverted in favor of 2.62 mod.
'''
split = layout.split()
split.prop(md, "use_even_offset")
split.prop(md, "use_distance_offset")
'''
# -- end
layout.label(text="Limit Method:")

@ -37,6 +37,9 @@
/*NOTE: this is the bmesh 1.0 code. it's completely outdated.*/
/* uncomment to use the new bevel operator as a modifier */
// #define USE_BM_BEVEL_OP_AS_MOD
/* bevel tool defines */
/* element flags */
#define BME_BEVEL_ORIG 1
@ -84,6 +87,7 @@ typedef struct BME_TransData_Head {
int len;
} BME_TransData_Head;
/* this is no longer used */
typedef struct BME_Glob { /* stored in Global G for Transform() purposes */
struct BMesh *bm;
BME_TransData_Head *td;
@ -95,6 +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);
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);
#endif

@ -998,7 +998,8 @@ 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)
BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_index, float angle,
BME_TransData_Head **rtd, int do_tessface)
{
BMesh *bm = em->bm;
BMVert *v;
@ -1027,7 +1028,11 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i
BMO_pop(bm);
}
BMEdit_RecalcTessellation(em);
/* possibly needed when running as a tool (which is no longer functional)
* but keep as an optioin for now */
if (do_tessface) {
BMEdit_RecalcTessellation(em);
}
/* interactive preview? */
if (rtd) {

@ -2137,17 +2137,17 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
/* BMESH_BRANCH ONLY */
#ifdef USE_BM_BEVEL_OP_AS_MOD
prop = RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE); /* name matches solidify */
RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_EVEN);
RNA_def_property_ui_text(prop, "Even", "Use even bevel distance correction");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
/* BMESH_BRANCH ONLY */
prop = RNA_def_property(srna, "use_distance_offset", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_DIST);
RNA_def_property_ui_text(prop, "Distance", "Use the width as a distance in rather then a factor of the face size");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
/* END BMESH_BRANCH ONLY */
#endif
}

@ -90,12 +90,12 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
#define EDGE_MARK 1
#ifdef USE_BM_BEVEL_OP_AS_MOD
/* BMESH_TODO
*
* this bevel calls the operator which is missing many of the options
* which the bevel modifier in trunk has.
* - width is interpreted as percent (not distance)
* - no vertex bevel
* - no weight bevel
*
@ -157,7 +157,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
}
#if 0 /* from trunk, see note above */
#else /* from trunk, see note above */
static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
DerivedMesh *derivedData,
@ -165,13 +165,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
int UNUSED(isFinalCalc))
{
DerivedMesh *result;
BME_Mesh *bm;
BMEditMesh *em;
/*bDeformGroup *def;*/
int /*i,*/ options, defgrp_index = -1;
BevelModifierData *bmd = (BevelModifierData*) md;
options = bmd->flags|bmd->val_flags|bmd->lim_flags|bmd->e_flags;
options = bmd->flags | bmd->val_flags | bmd->lim_flags | bmd->e_flags;
#if 0
if ((options & BME_BEVEL_VWEIGHT) && bmd->defgrp_name[0]) {
@ -182,12 +182,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
}
#endif
bm = BME_derivedmesh_to_bmesh(derivedData);
BME_bevel(bm,bmd->value,bmd->res,options,defgrp_index,bmd->bevel_angle,NULL);
result = BME_bmesh_to_derivedmesh(bm,derivedData);
BME_free_mesh(bm);
CDDM_calc_normals(result);
em = DM_to_editbmesh(derivedData, NULL, FALSE);
BME_bevel(em, bmd->value, bmd->res, options, defgrp_index, bmd->bevel_angle, NULL, FALSE);
BLI_assert(em->looptris == NULL);
result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE);
BMEdit_Free(em);
MEM_freeN(em);
return result;
}

@ -799,8 +799,8 @@ endif()
bf_python_mathutils
bf_python_bmesh
bf_ikplugin
bf_bmesh
bf_modifiers
bf_bmesh
bf_blenkernel
bf_nodes
bf_gpu