diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-12 14:51:45 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-12 14:51:45 +0400 |
commit | b6dcdb065d9ca6244f2de9e621439f75cf2c386e (patch) | |
tree | db7e8287d27bd6e68085dab6cacb997f5eb473a9 /source/blender/modifiers | |
parent | 8b43813b69b36af55635028e18e9b179df217317 (diff) |
code refactor, function renaming for bmesh.
These changes are to make the bmesh api more consistent and easier to learn, grouping similar functions which is convenient for autocomplete.
This uses similar convention to RNA.
* use face/loop/edge/vert as a prefix for functions.
* use 'elem' as a prefix too for functions that can take any type with a BMHeader.
* changed from camel case to underscore separated (like RNA).
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_array.c | 38 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_bevel.c | 8 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_edgesplit.c | 10 |
3 files changed, 28 insertions, 28 deletions
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 5c020f69cd5..cbf7d0d125c 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -299,21 +299,21 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, BMO_push(em->bm, NULL); bmesh_begin_edit(em->bm, 0); - BMO_Init_Op(em->bm, &weldop, "weldverts"); - BMO_InitOpf(em->bm, &op, "dupe geom=%avef"); + BMO_op_init(em->bm, &weldop, "weldverts"); + BMO_op_initf(em->bm, &op, "dupe geom=%avef"); oldop = op; for (j=0; j < count - 1; j++) { BMVert *v, *v2; BMOpSlot *s1; BMOpSlot *s2; - BMO_InitOpf(em->bm, &op, "dupe geom=%s", &oldop, j==0 ? "geom" : "newout"); - BMO_Exec_Op(em->bm, &op); + BMO_op_initf(em->bm, &op, "dupe geom=%s", &oldop, j==0 ? "geom" : "newout"); + BMO_op_exec(em->bm, &op); - s1 = BMO_GetSlot(&op, "geom"); - s2 = BMO_GetSlot(&op, "newout"); + s1 = BMO_slot_get(&op, "geom"); + s2 = BMO_slot_get(&op, "newout"); - BMO_CallOpf(em->bm, "transform mat=%m4 verts=%s", offset, &op, "newout"); + BMO_op_callf(em->bm, "transform mat=%m4 verts=%s", offset, &op, "newout"); #define _E(s, i) ((BMVert**)(s)->data.buf)[i] @@ -324,18 +324,18 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, BMVert *v, *v2; BMHeader *h; - BMO_InitOpf(em->bm, &findop, + BMO_op_initf(em->bm, &findop, "finddoubles verts=%av dist=%f keepverts=%s", amd->merge_dist, &op, "geom"); i = 0; BMO_ITER(h, &oiter, em->bm, &op, "geom", BM_ALL) { - BM_SetIndex(h, i); /* set_dirty */ + BM_elem_index_set(h, i); /* set_dirty */ i++; } BMO_ITER(h, &oiter, em->bm, &op, "newout", BM_ALL) { - BM_SetIndex(h, i); /* set_dirty */ + BM_elem_index_set(h, i); /* set_dirty */ i++; } /* above loops over all, so set all to dirty, if this is somehow @@ -343,19 +343,19 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, em->bm->elem_index_dirty |= BM_VERT | BM_EDGE | BM_FACE; - BMO_Exec_Op(em->bm, &findop); + BMO_op_exec(em->bm, &findop); indexLen = i; indexMap = MEM_callocN(sizeof(int)*indexLen, "indexMap"); /*element type argument doesn't do anything here*/ BMO_ITER(v, &oiter, em->bm, &findop, "targetmapout", 0) { - v2 = BMO_IterMapValp(&oiter); + v2 = BMO_iter_map_value_p(&oiter); - indexMap[BM_GetIndex(v)] = BM_GetIndex(v2)+1; + indexMap[BM_elem_index_get(v)] = BM_elem_index_get(v2)+1; } - BMO_Finish_Op(em->bm, &findop); + BMO_op_finish(em->bm, &findop); } /*generate merge mappping using index map. we do this by using the @@ -368,22 +368,22 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, v = E(i); v2 = E(indexMap[i]-1); - BMO_Insert_MapPointer(em->bm, &weldop, "targetmap", v, v2); + BMO_slot_map_ptr_insert(em->bm, &weldop, "targetmap", v, v2); } #undef E #undef _E - BMO_Finish_Op(em->bm, &oldop); + BMO_op_finish(em->bm, &oldop); oldop = op; } - if (j > 0) BMO_Finish_Op(em->bm, &op); + if (j > 0) BMO_op_finish(em->bm, &op); if (amd->flags & MOD_ARR_MERGE) - BMO_Exec_Op(em->bm, &weldop); + BMO_op_exec(em->bm, &weldop); - BMO_Finish_Op(em->bm, &weldop); + BMO_op_finish(em->bm, &weldop); /* Bump the stack level back down to match the adjustment up above */ BMO_pop(em->bm); diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 363f0f4079d..c0cd28ae27a 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -126,7 +126,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, em = CDDM_To_BMesh(ob, dm, NULL, FALSE); bm = em->bm; - BM_Compute_Normals(bm); + BM_mesh_normals_update(bm); BMO_push(bm, NULL); if (bmd->lim_flags & BME_BEVEL_ANGLE) { @@ -137,7 +137,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, (l2= e->l->radial_next) != l1) { if (dot_v3v3(l1->f->no, l2->f->no) < threshold) { - BMO_SetFlag(bm, e, EDGE_MARK); + BMO_elem_flag_set(bm, e, EDGE_MARK); } } } @@ -145,11 +145,11 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, else { /* crummy, is there a way just to operator on all? - campbell */ BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { - BMO_SetFlag(bm, e, EDGE_MARK); + BMO_elem_flag_set(bm, e, EDGE_MARK); } } - BMO_CallOpf(bm, "bevel geom=%fe percent=%f use_even=%i use_dist=%i", + BMO_op_callf(bm, "bevel geom=%fe percent=%f use_even=%i use_dist=%i", EDGE_MARK, bmd->value, (bmd->flags & BME_BEVEL_EVEN)!=0, (bmd->flags & BME_BEVEL_DIST)!=0); BMO_pop(bm); diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index e3f4e50e243..db39be12bca 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -74,7 +74,7 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj em = CDDM_To_BMesh(ob, dm, NULL, FALSE); bm = em->bm; - BM_Compute_Normals(bm); + BM_mesh_normals_update(bm); BMO_push(bm, NULL); if (emd->flags & MOD_EDGESPLIT_FROMANGLE) { @@ -85,7 +85,7 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj (l2= e->l->radial_next) != l1) { if (dot_v3v3(l1->f->no, l2->f->no) < threshold) { - BMO_SetFlag(bm, e, EDGE_MARK); + BMO_elem_flag_set(bm, e, EDGE_MARK); } } } @@ -93,12 +93,12 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj if (emd->flags & MOD_EDGESPLIT_FROMFLAG) { BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { - if (BM_TestHFlag(e, BM_ELEM_SHARP)) - BMO_SetFlag(bm, e, EDGE_MARK); + if (BM_elem_flag_test(e, BM_ELEM_SHARP)) + BMO_elem_flag_set(bm, e, EDGE_MARK); } } - BMO_CallOpf(bm, "edgesplit edges=%fe", EDGE_MARK); + BMO_op_callf(bm, "edgesplit edges=%fe", EDGE_MARK); BMO_pop(bm); |