diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_cdderivedmesh.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifiers_bmesh.c | 6 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_array.c | 12 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_bevel.c | 17 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_edgesplit.c | 19 |
6 files changed, 21 insertions, 40 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 9fa64d01a0a..a8bb4d0fa65 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -440,6 +440,9 @@ int DM_release(DerivedMesh *dm); */ void DM_to_mesh(DerivedMesh *dm, struct Mesh *me, struct Object *ob); +struct BMEditMesh *DM_to_editbmesh(struct Object *ob, struct DerivedMesh *dm, + struct BMEditMesh *existing, int do_tesselate); + /* utility function to convert a DerivedMesh to a shape key block */ void DM_to_meshkey(DerivedMesh *dm, struct Mesh *me, struct KeyBlock *kb); diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h index 42e1aa8e083..341025862a2 100644 --- a/source/blender/blenkernel/BKE_cdderivedmesh.h +++ b/source/blender/blenkernel/BKE_cdderivedmesh.h @@ -69,10 +69,6 @@ struct DerivedMesh *CDDM_from_curve(struct Object *ob); /* useful for OrcoDM creation for curves with constructive modifiers */ DerivedMesh *CDDM_from_curve_customDB(struct Object *ob, struct ListBase *dispbase); -struct BMEditMesh *CDDM_To_BMesh(struct Object *ob, struct DerivedMesh *dm, - struct BMEditMesh *existing, int do_tesselate); - - /* Copies the given DerivedMesh with verts, faces & edges stored as * custom element data. */ diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c index 466b493098d..b3e0c298bbe 100644 --- a/source/blender/blenkernel/intern/modifiers_bmesh.c +++ b/source/blender/blenkernel/intern/modifiers_bmesh.c @@ -43,7 +43,7 @@ /* converts a cddm to a BMEditMesh. if existing is non-NULL, the * new geometry will be put in there.*/ -BMEditMesh *CDDM_To_BMesh(Object *ob, DerivedMesh *dm, BMEditMesh *existing, int do_tesselate) +BMEditMesh *DM_to_editbmesh(Object *ob, DerivedMesh *dm, BMEditMesh *existing, int do_tesselate) { int allocsize[4] = {512, 512, 2048, 512}; BMesh *bm, bmold; /*bmold is for storing old customdata layout*/ @@ -75,8 +75,8 @@ BMEditMesh *CDDM_To_BMesh(Object *ob, DerivedMesh *dm, BMEditMesh *existing, int totedge = dm->getNumEdges(dm); totface = dm->getNumPolys(dm); - vtable = MEM_callocN(sizeof(void**)*totvert, "vert table in BMDM_Copy"); - etable = MEM_callocN(sizeof(void**)*totedge, "edge table in BMDM_Copy"); + vtable = MEM_callocN(sizeof(void**) * totvert, "vert table in BMDM_Copy"); + etable = MEM_callocN(sizeof(void**) * totedge, "edge table in BMDM_Copy"); /*do verts*/ mv = mvert = dm->dupVertArray(dm); diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index cbf7d0d125c..a711650676b 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -208,8 +208,8 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, Scene *scene, Object *ob, DerivedMesh *dm, int UNUSED(initFlags)) { - DerivedMesh *cddm = dm; //copying shouldn't be necassary here, as all modifiers return CDDM's - BMEditMesh *em = CDDM_To_BMesh(ob, cddm, NULL, FALSE); + DerivedMesh *result; + BMEditMesh *em = DM_to_editbmesh(ob, dm, NULL, FALSE); BMOperator op, oldop, weldop; int i, j, indexLen; /* offset matrix */ @@ -228,8 +228,8 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, unit_m4(offset); - src_mvert = cddm->getVertArray(dm); - maxVerts = cddm->getNumVerts(dm); + src_mvert = dm->getVertArray(dm); + maxVerts = dm->getNumVerts(dm); if(amd->offset_type & MOD_ARR_OFF_CONST) add_v3_v3v3(offset[3], offset[3], amd->offset); @@ -389,13 +389,13 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, BMO_pop(em->bm); BLI_assert(em->looptris == NULL); - cddm = CDDM_from_BMEditMesh(em, NULL, FALSE, FALSE); + result = CDDM_from_BMEditMesh(em, NULL, FALSE, FALSE); BMEdit_Free(em); MEM_freeN(em); MEM_freeN(indexMap); - return cddm; + return result; } static DerivedMesh *applyModifier(ModifierData *md, Object *ob, diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index c0cd28ae27a..1bc768a73c2 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -110,20 +110,16 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) { + DerivedMesh *result; BMesh *bm; BMEditMesh *em; - DerivedMesh *cddm; BMIter iter; BMEdge *e; BevelModifierData *bmd = (BevelModifierData*) md; /* int allocsize[] = {512, 512, 2048, 512}; */ /* UNUSED */ float threshold = cos((bmd->bevel_angle + 0.00001) * M_PI / 180.0); - if (!CDDM_Check(dm)) { - cddm = CDDM_copy(dm); - } else cddm = dm; - - em = CDDM_To_BMesh(ob, dm, NULL, FALSE); + em = DM_to_editbmesh(ob, dm, NULL, FALSE); bm = em->bm; BM_mesh_normals_update(bm); @@ -153,17 +149,12 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, EDGE_MARK, bmd->value, (bmd->flags & BME_BEVEL_EVEN)!=0, (bmd->flags & BME_BEVEL_DIST)!=0); BMO_pop(bm); - if (cddm != dm) { - cddm->needsFree = 1; - cddm->release(cddm); - } - BLI_assert(em->looptris == NULL); - cddm = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE); + result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE); BMEdit_Free(em); MEM_freeN(em); - return cddm; + return result; } diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index db39be12bca..3137df9d0dc 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -59,19 +59,15 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Object *ob) { + DerivedMesh *result; BMesh *bm; BMEditMesh *em; - DerivedMesh *cddm; BMIter iter; BMEdge *e; /* int allocsize[] = {512, 512, 2048, 512}; */ /* UNUSED */ float threshold = cos((emd->split_angle + 0.00001) * M_PI / 180.0); - - if (!CDDM_Check(dm)) { - cddm = CDDM_copy(dm); - } else cddm = dm; - - em = CDDM_To_BMesh(ob, dm, NULL, FALSE); + + em = DM_to_editbmesh(ob, dm, NULL, FALSE); bm = em->bm; BM_mesh_normals_update(bm); @@ -101,18 +97,13 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj BMO_op_callf(bm, "edgesplit edges=%fe", EDGE_MARK); BMO_pop(bm); - - if (cddm != dm) { - cddm->needsFree = 1; - cddm->release(cddm); - } BLI_assert(em->looptris == NULL); - cddm = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE); + result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE); BMEdit_Free(em); MEM_freeN(em); - return cddm; + return result; } static void initData(ModifierData *md) |