diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-16 03:56:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-16 03:56:46 +0400 |
commit | eab24df9503bbb173a302f88a920e076d2d0368d (patch) | |
tree | 2b59b4723523b35ce00c2930f7575716620f5cba /source | |
parent | bed5ae53660f742546db3467b31f8f390c59942b (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_bmesh.h | 7 | ||||
-rw-r--r-- | source/blender/bmesh/tools/BME_bevel.c | 9 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 6 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_bevel.c | 20 | ||||
-rw-r--r-- | source/creator/CMakeLists.txt | 2 |
5 files changed, 27 insertions, 17 deletions
diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h index 677614e26e3..bcb50a9c903 100644 --- a/source/blender/blenkernel/BKE_bmesh.h +++ b/source/blender/blenkernel/BKE_bmesh.h @@ -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 diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index 1422b6516d6..5386ed549c6 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -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) { diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 6185d1dee79..a6ab9051528 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -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 } diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 112b9398d23..8b29ef952af 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -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; } diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 35174834a47..a4aec7d7ba3 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -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 |