diff options
41 files changed, 467 insertions, 386 deletions
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index e47cc68805d..06d58714423 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -195,55 +195,6 @@ #define SET_INT_IN_POINTER(i) ((void*)(intptr_t)(i)) #define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i)) -/*little array macro library. example of usage: - -int *arr = NULL; -V_DECLARE(arr); -int i; - -for (i=0; i<10; i++) { - V_GROW(arr); - arr[i] = something; -} -V_FREE(arr); - -arrays are buffered, using double-buffering (so on each reallocation, -the array size is doubled). supposedly this should give good Big Oh -behaviour, though it may not be the best in practice. -*/ - -#define V_DECLARE(vec) int _##vec##_count=0; void *_##vec##_tmp - -/*in the future, I plan on having V_DECLARE allocate stack memory it'll - use at first, and switch over to heap when it needs more. that'll mess - up cases where you'd want to use this API to build a dynamic list for - non-local use, so all such cases should use this macro.*/ -#define V_DYNDECLARE(vec) V_DECLARE(vec) - -/*this returns the entire size of the array, including any buffering.*/ -#define V_SIZE(vec) ((signed int)((vec)==NULL ? 0 : MEM_allocN_len(vec) / sizeof(*vec))) - -/*this returns the logical size of the array, not including buffering.*/ -#define V_COUNT(vec) _##vec##_count - -/*grow the array by one. zeroes the new elements.*/ -#define V_GROW(vec) \ - V_SIZE(vec) > _##vec##_count ? _##vec##_count++ : \ - ((_##vec##_tmp = MEM_callocN(sizeof(*vec)*(_##vec##_count*2+2), #vec " " __FILE__ " ")),\ - (vec && memcpy(_##vec##_tmp, vec, sizeof(*vec) * _##vec##_count)),\ - (vec && (MEM_freeN(vec),1)),\ - (vec = _##vec##_tmp),\ - _##vec##_count++) - -#define V_FREE(vec) if (vec) MEM_freeN(vec); - -/*resets the logical size of an array to zero, but doesn't - free the memory.*/ -#define V_RESET(vec) _##vec##_count=0 - -/*set the count of the array*/ -#define V_SETCOUNT(vec, count) _##vec##_count = (count) - /*little macro so inline keyword works*/ #if defined(_MSC_VER) #define BM_INLINE static __forceinline diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 57af8ce9ae2..b679e892606 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -58,6 +58,7 @@ #include "BLI_editVert.h" #include "BLI_linklist.h" #include "BLI_memarena.h" +#include "BLI_array.h" #include "BKE_cdderivedmesh.h" #include "BKE_customdata.h" @@ -1782,7 +1783,7 @@ static void add_weight_mcol_dm(Object *ob, DerivedMesh *dm) ColorBand *coba= stored_cb; /* warning, not a local var */ unsigned char *wtcol; unsigned char(*wlcol)[4] = NULL; - V_DECLARE(wlcol); + BLI_array_declare(wlcol); int i, totface=dm->getNumTessFaces(dm), totpoly=dm->getNumFaces, totloop; int *origIndex = dm->getVertDataArray(dm, CD_ORIGINDEX); @@ -1806,7 +1807,7 @@ static void add_weight_mcol_dm(Object *ob, DerivedMesh *dm) for (; !dfiter->done; dfiter->step(dfiter)) { dliter = dfiter->getLoopsIter(dfiter); for (; !dliter->done; dliter->step(dliter), totloop++) { - V_GROW(wlcol); + BLI_array_growone(wlcol); calc_weightpaint_vert_color(ob, coba, dliter->vindex, &wlcol[totloop]); } } diff --git a/source/blender/blenkernel/intern/editderivedbmesh.c b/source/blender/blenkernel/intern/editderivedbmesh.c index b9f81911518..6aca8d51bc2 100644 --- a/source/blender/blenkernel/intern/editderivedbmesh.c +++ b/source/blender/blenkernel/intern/editderivedbmesh.c @@ -60,6 +60,7 @@ #include "BLI_memarena.h" #include "BLI_scanfill.h" #include "BLI_ghash.h" +#include "BLI_array.h" #include "BKE_cdderivedmesh.h" #include "BKE_customdata.h" @@ -124,7 +125,7 @@ static void BMEdit_RecalcTesselation_intern(BMEditMesh *tm) { BMesh *bm = tm->bm; BMLoop **looptris = NULL; - V_DYNDECLARE(looptris); + BLI_array_declare(looptris); BMIter iter, liter; BMFace *f; BMLoop *l; @@ -144,9 +145,9 @@ static void BMEdit_RecalcTesselation_intern(BMEditMesh *tm) /*don't consider two-edged faces*/ if (f->len < 3) continue; - //V_GROW(looptris); - //V_GROW(looptris); - //V_GROW(looptris); + //BLI_array_growone(looptris); + //BLI_array_growone(looptris); + //BLI_array_growone(looptris); looptris[i*3] = f->loopbase; looptris[i*3+1] = f->loopbase->head.next; @@ -154,9 +155,9 @@ static void BMEdit_RecalcTesselation_intern(BMEditMesh *tm) i++; if (f->len > 3) { - //V_GROW(looptris); - //V_GROW(looptris); - //V_GROW(looptris); + //BLI_array_growone(looptris); + //BLI_array_growone(looptris); + //BLI_array_growone(looptris); looptris[i*3] = f->loopbase; looptris[i*3+1] = f->loopbase->head.next->next; @@ -205,9 +206,9 @@ static void BMEdit_RecalcTesselation_intern(BMEditMesh *tm) for (efa = fillfacebase.first; efa; efa=efa->next) { BMLoop *l1, *l2, *l3; - V_GROW(looptris); - V_GROW(looptris); - V_GROW(looptris); + BLI_array_growone(looptris); + BLI_array_growone(looptris); + BLI_array_growone(looptris); looptris[i*3] = l1 = efa->v1->tmp.p; looptris[i*3+1] = l2 = efa->v2->tmp.p; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 18a88cdb36a..5f7fb2f71f0 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -72,6 +72,7 @@ #include "BLI_editVert.h" #include "BLI_arithb.h" #include "BLI_cellalloc.h" +#include "BLI_array.h" #include "bmesh.h" @@ -1476,10 +1477,10 @@ int mesh_recalcTesselation(CustomData *fdata, MPoly *mp, *mpoly; MLoop *ml, *mloop; MFace *mf = NULL, *mface; - V_DECLARE(mf); + BLI_array_declare(mf); EditVert *v, *lastv, *firstv; EditFace *f; - V_DECLARE(origIndex); + BLI_array_declare(origIndex); int i, j, k, lindex[3], *origIndex = NULL, *polyorigIndex; int numTex, numCol; @@ -1516,8 +1517,8 @@ int mesh_recalcTesselation(CustomData *fdata, BLI_edgefill(0, 0); for (f=fillfacebase.first; f; f=f->next) { - V_GROW(mf); - V_GROW(origIndex); + BLI_array_growone(mf); + BLI_array_growone(origIndex); /*these are loop indices, they'll be transformed into vert indices later.*/ diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index a4813eb0247..66f345b7e44 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -52,6 +52,7 @@ #include "BLI_memarena.h" #include "BLI_cellalloc.h" #include "BLI_mempool.h" +#include "BLI_array.h" #include "MEM_guardedalloc.h" @@ -2276,13 +2277,13 @@ DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd) { DerivedMesh *cddm = CDDM_copy(dm, 0); MEdge *medge; - V_DECLARE(medge); + BLI_array_declare(medge); MLoop *mloop, *ml, *prevl; MPoly *mpoly, *mp; MVert *mvert; - V_DECLARE(mvert); + BLI_array_declare(mvert); EdgeData *etags, *e, *enext; - V_DECLARE(etags); + BLI_array_declare(etags); VertUser *vu, *vu2; MemBase *membase; CustomData edata, vdata; @@ -2296,12 +2297,12 @@ DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd) membase = new_membase(); etags = MEM_callocN(sizeof(EdgeData)*cddm->numEdgeData, "edgedata tag thingies"); - V_SETCOUNT(etags, cddm->numEdgeData); + BLI_array_set_length(etags, cddm->numEdgeData); mvert = cddm->getVertArray(cddm); - V_SETCOUNT(mvert, cddm->numVertData); + BLI_array_set_length(mvert, cddm->numVertData); medge = cddm->getEdgeArray(cddm); - V_SETCOUNT(medge, cddm->numEdgeData); + BLI_array_set_length(medge, cddm->numEdgeData); mloop = CustomData_get_layer(&cddm->loopData, CD_MLOOP); mpoly = CustomData_get_layer(&cddm->polyData, CD_MPOLY); @@ -2411,7 +2412,7 @@ DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd) e = etags + ml->e; if (e->v1user && !e->v1user->done) { e->v1user->done = 1; - V_GROW(mvert); + BLI_array_growone(mvert); mvert[curv] = mvert[e->v1user->ov]; e->v1user->v = curv; @@ -2421,7 +2422,7 @@ DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd) if (e->v2user && !e->v2user->done) { e->v2user->done = 1; - V_GROW(mvert); + BLI_array_growone(mvert); mvert[curv] = mvert[e->v2user->ov]; e->v2user->v = curv; @@ -2438,8 +2439,8 @@ DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd) /*ok, now we have to deal with edges. . .*/ if (etags[ml->e].tag) { if (etags[ml->e].used) { - V_GROW(medge); - V_GROW(etags); + BLI_array_growone(medge); + BLI_array_growone(etags); medge[cure] = medge[ml->e]; ml->e = cure; diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c index b502c21188f..84bbb1fb5d7 100644 --- a/source/blender/blenkernel/intern/modifiers_bmesh.c +++ b/source/blender/blenkernel/intern/modifiers_bmesh.c @@ -66,6 +66,7 @@ #include "DNA_texture_types.h" #include "BLI_editVert.h" +#include "BLI_array.h" #include "BKE_main.h" #include "BKE_anim.h" @@ -119,8 +120,8 @@ BMEditMesh *CDDM_To_BMesh(DerivedMesh *dm, BMEditMesh *existing) BMEdge *e, **etable, **edges=NULL; BMFace *f; BMIter liter; - V_DECLARE(verts); - V_DECLARE(edges); + BLI_array_declare(verts); + BLI_array_declare(edges); int numTex, numCol; int i, j, k, totvert, totedge, totface; @@ -180,13 +181,13 @@ BMEditMesh *CDDM_To_BMesh(DerivedMesh *dm, BMEditMesh *existing) for (; !dfiter->done; dfiter->step(dfiter)) { BMLoop *l; - V_RESET(verts); - V_RESET(edges); + BLI_array_empty(verts); + BLI_array_empty(edges); dliter = dfiter->getLoopsIter(dfiter); for (j=0; !dliter->done; dliter->step(dliter), j++) { - V_GROW(verts); - V_GROW(edges); + BLI_array_growone(verts); + BLI_array_growone(edges); verts[j] = vtable[dliter->vindex]; edges[j] = etable[dliter->eindex]; @@ -218,8 +219,8 @@ BMEditMesh *CDDM_To_BMesh(DerivedMesh *dm, BMEditMesh *existing) MEM_freeN(vtable); MEM_freeN(etable); - V_FREE(verts); - V_FREE(edges); + BLI_array_free(verts); + BLI_array_free(edges); if (!em) em = BMEdit_Create(bm); else BMEdit_RecalcTesselation(em); diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 64e892458a5..782da0f5c10 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -60,6 +60,7 @@ #include "BLI_memarena.h" #include "BLI_edgehash.h" #include "PIL_time.h" +#include "BLI_array.h" #include "BIF_gl.h" #include "BIF_glutil.h" @@ -583,7 +584,7 @@ static DerivedMesh *ss_to_cdderivedmesh(CSubSurf *ss, int ssFromEditmesh, int edgeBase, faceBase; int i, j, k, S, x, y, index; int *vertIdx = NULL; - V_DECLARE(vertIdx); + BLI_array_declare(vertIdx); CCVertIterator *vi; CCEdgeIterator *ei; CCFaceIterator *fi; @@ -595,7 +596,7 @@ static DerivedMesh *ss_to_cdderivedmesh(CSubSurf *ss, int ssFromEditmesh, MEdge *med; float *w = NULL; WeightTable wtable; - V_DECLARE(w); + BLI_array_declare(w); MFace *mf; int *origIndex; @@ -658,11 +659,11 @@ static DerivedMesh *ss_to_cdderivedmesh(CSubSurf *ss, int ssFromEditmesh, int x, y, S, numVerts = CCS_getFaceNumVerts(f); FaceVertWeight *weight = 0;//get_ss_weights(&wtable, gridFaces-1, numVerts); - V_RESET(vertIdx); + BLI_array_empty(vertIdx); for(S = 0; S < numVerts; S++) { CCVert *v = CCS_getFaceVert(ss, f, S); - V_GROW(vertIdx); + BLI_array_growone(vertIdx); vertIdx[S] = GET_INT_FROM_POINTER(CCS_getVertVertHandle(v)); } @@ -676,9 +677,9 @@ static DerivedMesh *ss_to_cdderivedmesh(CSubSurf *ss, int ssFromEditmesh, ++origIndex; i++; - V_RESET(w); + BLI_array_empty(w); for (x=0; x<numVerts; x++) { - V_GROW(w); + BLI_array_growone(w); } for(S = 0; S < numVerts; S++) { @@ -705,9 +706,9 @@ static DerivedMesh *ss_to_cdderivedmesh(CSubSurf *ss, int ssFromEditmesh, } } - V_RESET(w); + BLI_array_empty(w); for (x=0; x<numVerts; x++) { - V_GROW(w); + BLI_array_growone(w); } for(S = 0; S < numVerts; S++) { @@ -934,7 +935,7 @@ static DerivedMesh *ss_to_cdderivedmesh(CSubSurf *ss, int ssFromEditmesh, free_ss_weights(&wtable); - V_FREE(vertIdx); + BLI_array_free(vertIdx); if(useSubsurfUv) { CustomData *fdata = &result->faceData; @@ -949,7 +950,7 @@ static DerivedMesh *ss_to_cdderivedmesh(CSubSurf *ss, int ssFromEditmesh, CDDM_calc_normals(result); CDDM_tessfaces_to_faces(result); - V_FREE(w); + BLI_array_free(w); return result; #endif } @@ -959,7 +960,7 @@ static void ss_sync_from_derivedmesh(CSubSurf *ss, DerivedMesh *dm, { float creaseFactor = (float) CCS_getSubdivisionLevels(ss); CCVertHDL *fVerts = NULL; - V_DECLARE(fVerts); + BLI_array_declare(fVerts); int totvert = dm->getNumVerts(dm); int totedge = dm->getNumEdges(dm); int totface = dm->getNumTessFaces(dm); @@ -1009,14 +1010,14 @@ static void ss_sync_from_derivedmesh(CSubSurf *ss, DerivedMesh *dm, fiter = dm->newFaceIter(dm); for (i=0; !fiter->done; fiter->step(fiter), i++) { CCFace *f; - V_RESET(fVerts); + BLI_array_empty(fVerts); index = (int*) fiter->getCDData(fiter, CD_ORIGINDEX, -1); liter = fiter->getLoopsIter(fiter); for (; !liter->done; liter->step(liter)) { - V_GROW(fVerts); - fVerts[V_COUNT(fVerts)-1] = SET_INT_IN_POINTER(liter->vindex); + BLI_array_growone(fVerts); + fVerts[BLI_array_count(fVerts)-1] = SET_INT_IN_POINTER(liter->vindex); } /* this is very bad, means mesh is internally inconsistent. @@ -1043,7 +1044,7 @@ static void ss_sync_from_derivedmesh(CSubSurf *ss, DerivedMesh *dm, CCS_processSync(ss); - V_FREE(fVerts); + BLI_array_free(fVerts); } /***/ @@ -2629,8 +2630,8 @@ static CCGDerivedMesh *getCCGDerivedMesh(CSubSurf *ss, int *edgeFlags; char *faceFlags, *polyFlags; int *loopidx = NULL, *vertidx = NULL; - V_DECLARE(loopidx); - V_DECLARE(vertidx); + BLI_array_declare(loopidx); + BLI_array_declare(vertidx); int loopindex, loopindex2; int edgeSize; int gridSize; @@ -2800,17 +2801,17 @@ static CCGDerivedMesh *getCCGDerivedMesh(CSubSurf *ss, /* set the face base vert */ *((int*)CCS_getFaceUserData(ss, f)) = vertNum; - V_RESET(loopidx); + BLI_array_empty(loopidx); for (s=0; s<numVerts; s++) { - V_GROW(loopidx); + BLI_array_growone(loopidx); loopidx[s] = loopindex++; } - V_RESET(vertidx); + BLI_array_empty(vertidx); for(s = 0; s < numVerts; s++) { CCVert *v = CCS_getFaceVert(ss, f, s); - V_GROW(vertidx); + BLI_array_growone(vertidx); vertidx[s] = GET_INT_FROM_POINTER(CCS_getVertVertHandle(v)); } @@ -2978,8 +2979,8 @@ static CCGDerivedMesh *getCCGDerivedMesh(CSubSurf *ss, cgdm->dm.numLoopData = loopindex2; cgdm->dm.numPolyData = faceNum; - V_FREE(vertidx); - V_FREE(loopidx); + BLI_array_free(vertidx); + BLI_array_free(loopidx); free_ss_weights(&wtable); cgdm->ehash = BLI_edgehash_new(); @@ -3005,7 +3006,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CSubSurf *ss, *((int*)CCS_getFaceUserData(ss, f)) = vertNum; for(S = 0; S < numVerts; S++) { CCVert *v = CCS_getFaceVert(ss, f, S); - V_GROW(vertIdx); + BLI_array_growone(vertIdx); vertIdx[S] = GET_INT_FROM_POINTER(CCS_getVertVertHandle(v)); } @@ -3177,7 +3178,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CSubSurf *ss, MEM_freeN(qweight); MEM_freeN(tweight); - V_FREE(vertIdx); + BLI_array_free(vertIdx); #endif return cgdm; } diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h new file mode 100644 index 00000000000..3f4660f0597 --- /dev/null +++ b/source/blender/blenlib/BLI_array.h @@ -0,0 +1,78 @@ +/** + * Array library + * + * + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2008 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Geoffrey Bantle. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/* +this library needs to be changed to not use macros quite so heavily, +and to be more of a complete vector array API. The way arrays are +exposed to client code as normal C arrays is very useful though, imho. +it does require some use of macros, however. + +little array macro library. example of usage: + +int *arr = NULL; +BLI_array_declare(arr); +int i; + +for (i=0; i<10; i++) { + BLI_array_growone(arr); + arr[i] = something; +} +BLI_array_free(arr); + +arrays are buffered, using double-buffering (so on each reallocation, +the array size is doubled). supposedly this should give good Big Oh +behaviour, though it may not be the best in practice. +*/ + +#define BLI_array_declare(vec) int _##vec##_count=0; void *_##vec##_tmp + +/*this returns the entire size of the array, including any buffering.*/ +#define BLI_array_totalsize(vec) ((signed int)((vec)==NULL ? 0 : MEM_allocN_len(vec) / sizeof(*vec))) + +/*this returns the logical size of the array, not including buffering.*/ +#define BLI_array_count(vec) _##vec##_count + +/*grow the array by one. zeroes the new elements.*/ +#define BLI_array_growone(vec) \ + BLI_array_totalsize(vec) > _##vec##_count ? _##vec##_count++ : \ + ((_##vec##_tmp = MEM_callocN(sizeof(*vec)*(_##vec##_count*2+2), #vec " " __FILE__ " ")),\ + (vec && memcpy(_##vec##_tmp, vec, sizeof(*vec) * _##vec##_count)),\ + (vec && (MEM_freeN(vec),1)),\ + (vec = _##vec##_tmp),\ + _##vec##_count++) + +#define BLI_array_free(vec) if (vec) MEM_freeN(vec); + +/*resets the logical size of an array to zero, but doesn't + free the memory.*/ +#define BLI_array_empty(vec) _##vec##_count=0 + +/*set the count of the array*/ +#define BLI_array_set_length(vec, count) _##vec##_count = (count) diff --git a/source/blender/blenlib/BLI_cellalloc.h b/source/blender/blenlib/BLI_cellalloc.h index 0e6310ef0b4..cd10e9febe8 100644 --- a/source/blender/blenlib/BLI_cellalloc.h +++ b/source/blender/blenlib/BLI_cellalloc.h @@ -27,14 +27,20 @@ */ /* - Simple, fast memory allocator that uses many BLI_mempools for allocation. - use for allocations < 1024 bytes that simply cannot be rewritten to use - mempools directly or memarenas. + I wrote this as a hack so vgroups won't be quite so slow. I really + should replace it with something else, but I need to spend some time + thinking as to what the proper solution would be (other then totally + rewriting vgroups, of course). - Should really become part of guardedalloc, but I'm not sure how to - get it linking with blenlib on all build systems. - joeedh + this is just a simple allocator that spawns mempools for unique size + requests. hardly ideal, I know. *something* like this may be + unavoidable, but it should certainly be possible to make it + non-global and internal to the vgroup code. + + -joeedh sep. 17 2009 */ +//BMESH_TODO: kill this library before merging with trunk void *BLI_cellalloc_malloc(long size, char *tag); void *BLI_cellalloc_calloc(long size, char *tag); void BLI_cellalloc_free(void *mem); diff --git a/source/blender/bmesh/bmesh_operator_api.h b/source/blender/bmesh/bmesh_operator_api.h index 67daa323129..820f43a3094 100644 --- a/source/blender/bmesh/bmesh_operator_api.h +++ b/source/blender/bmesh/bmesh_operator_api.h @@ -333,6 +333,8 @@ typedef struct BMOIter { int restrict; } BMOIter; +void *BMO_FirstElem(BMOperator *op, char *slotname); + /*restrictmask restricts the iteration to certain element types (e.g. combination of BM_VERT, BM_EDGE, BM_FACE), if iterating over an element buffer (not a mapping).*/ diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index 1928e85fa22..c444927824a 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -31,9 +31,12 @@ */ #include "MEM_guardedalloc.h" + #include "BKE_customdata.h" #include "BKE_utildefines.h" +#include "BLI_array.h" + #include "DNA_meshdata_types.h" #include "DNA_mesh_types.h" @@ -418,14 +421,14 @@ BMesh *BM_Copy_Mesh(BMesh *bmold) { BMesh *bm; BMVert *v, *v2, **vtable = NULL; - V_DECLARE(vtable); + BLI_array_declare(vtable); BMEdge *e, *e2, **edges = NULL, **etable = NULL; - V_DECLARE(edges); - V_DECLARE(etable); + BLI_array_declare(edges); + BLI_array_declare(etable); BMLoop *l, *l2, **loops = NULL; - V_DECLARE(loops); + BLI_array_declare(loops); BMFace *f, *f2, **ftable = NULL; - V_DECLARE(ftable); + BLI_array_declare(ftable); BMEditSelection *ese; BMIter iter, liter; int allocsize[4] = {512,512,2048,512}, numTex, numCol; @@ -452,10 +455,10 @@ BMesh *BM_Copy_Mesh(BMesh *bmold) for (i=0; v; v=BMIter_Step(&iter), i++) { v2 = BM_Make_Vert(bm, v->co, NULL); BM_Copy_Attributes(bmold, bm, v, v2); - V_GROW(vtable); + BLI_array_growone(vtable); VECCOPY(v2->no, v->no); - vtable[V_COUNT(vtable)-1] = v2; + vtable[BLI_array_count(vtable)-1] = v2; BMINDEX_SET(v, i); BMINDEX_SET(v2, i); @@ -467,8 +470,8 @@ BMesh *BM_Copy_Mesh(BMesh *bmold) vtable[BMINDEX_GET(e->v2)], e, 0); BM_Copy_Attributes(bmold, bm, e, e2); - V_GROW(etable); - etable[V_COUNT(etable)-1] = e2; + BLI_array_growone(etable); + etable[BLI_array_count(etable)-1] = e2; BMINDEX_SET(e, i); BMINDEX_SET(e2, i); @@ -476,12 +479,12 @@ BMesh *BM_Copy_Mesh(BMesh *bmold) f = BMIter_New(&iter, bmold, BM_FACES_OF_MESH, NULL); for (i=0; f; f=BMIter_Step(&iter), i++) { - V_RESET(loops); - V_RESET(edges); + BLI_array_empty(loops); + BLI_array_empty(edges); l = BMIter_New(&liter, bmold, BM_LOOPS_OF_FACE, f); for (j=0; j<f->len; j++, l = BMIter_Step(&liter)) { - V_GROW(loops); - V_GROW(edges); + BLI_array_growone(loops); + BLI_array_growone(edges); loops[j] = l; edges[j] = etable[BMINDEX_GET(l->e)]; } @@ -490,14 +493,14 @@ BMesh *BM_Copy_Mesh(BMesh *bmold) v2 = vtable[BMINDEX_GET(loops[1]->v)]; if (!bmesh_verts_in_edge(v, v2, edges[0])) { - v = vtable[BMINDEX_GET(loops[V_COUNT(loops)-1]->v)]; + v = vtable[BMINDEX_GET(loops[BLI_array_count(loops)-1]->v)]; v2 = vtable[BMINDEX_GET(loops[0]->v)]; } f2 = BM_Make_Ngon(bm, v, v2, edges, f->len, 0); BMINDEX_SET(f, i); - V_GROW(ftable); + BLI_array_growone(ftable); ftable[i] = f2; BM_Copy_Attributes(bmold, bm, f, f2); @@ -526,12 +529,12 @@ BMesh *BM_Copy_Mesh(BMesh *bmold) BM_store_selection(bm, ele); } - V_FREE(etable); - V_FREE(vtable); - V_FREE(ftable); + BLI_array_free(etable); + BLI_array_free(vtable); + BLI_array_free(ftable); - V_FREE(loops); - V_FREE(edges); + BLI_array_free(loops); + BLI_array_free(edges); return bm; } diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index a2ae2ea26d8..76d0947c23d 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -38,6 +38,8 @@ #include "BKE_customdata.h" #include "BKE_utildefines.h" +#include "BLI_array.h" + #include "bmesh.h" #include "bmesh_private.h" diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 8159414c3b9..20557451a03 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -4,6 +4,7 @@ #include "BLI_arithb.h" #include "BLI_blenlib.h" +#include "BLI_array.h" #include "bmesh.h" #include "bmesh_private.h" diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index de63764db43..33b131f5f1d 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -7,6 +7,7 @@ #include "BLI_linklist.h" #include "BLI_ghash.h" #include "BLI_arithb.h" +#include "BLI_array.h" #include "bmesh.h" #include "bmesh_private.h" @@ -375,7 +376,7 @@ BMVert *BM_Split_Edge_Multi(BMesh *bm, BMEdge *e, int numcuts) int BM_Validate_Face(BMesh *bm, BMFace *face, FILE *err) { BMIter iter; - V_DECLARE(verts); + BLI_array_declare(verts); BMVert **verts = NULL; BMLoop *l; int ret = 1, i, j; @@ -386,8 +387,8 @@ int BM_Validate_Face(BMesh *bm, BMFace *face, FILE *err) } for (l=BMIter_New(&iter, bm, BM_LOOPS_OF_FACE, face);l;l=BMIter_Step(&iter)) { - V_GROW(verts); - verts[V_COUNT(verts)-1] = l->v; + BLI_array_growone(verts); + verts[BLI_array_count(verts)-1] = l->v; if (l->e->v1 == l->e->v2) { fprintf(err, "Found bmesh edge with identical verts!\n"); @@ -397,8 +398,8 @@ int BM_Validate_Face(BMesh *bm, BMFace *face, FILE *err) } } - for (i=0; i<V_COUNT(verts); i++) { - for (j=0; j<V_COUNT(verts); j++) { + for (i=0; i<BLI_array_count(verts); i++) { + for (j=0; j<BLI_array_count(verts); j++) { if (j == i) continue; if (verts[i] == verts[j]) { fprintf(err, "Found duplicate verts in bmesh face!\n"); @@ -409,7 +410,7 @@ int BM_Validate_Face(BMesh *bm, BMFace *face, FILE *err) } } - V_FREE(verts); + BLI_array_free(verts); return ret; } diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 37b9ce389ec..da2f98f6db8 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -4,6 +4,7 @@ #include "BLI_memarena.h" #include "BLI_mempool.h" #include "BLI_blenlib.h" +#include "BLI_array.h" #include "BKE_utildefines.h" @@ -854,6 +855,16 @@ static void clear_flag_layer(BMesh *bm) } } +void *BMO_FirstElem(BMOperator *op, char *slotname) +{ + BMOpSlot *slot = BMO_GetSlot(op, slotname); + + if (slot->slottype != BMOP_OPSLOT_ELEMENT_BUF) + return NULL; + + return slot->data.buf ? *(void**)slot->data.buf : NULL; +} + void *BMO_IterNew(BMOIter *iter, BMesh *bm, BMOperator *op, char *slotname, int restrict) { diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index bce372f5083..072f0a4bbb4 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -6,6 +6,7 @@ #include "BLI_arithb.h" #include "BLI_blenlib.h" +#include "BLI_array.h" #include "MEM_guardedalloc.h" diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index 5be3c9374f5..ace369cc2a1 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -4,6 +4,7 @@ #include "bmesh_private.h" #include "BLI_arithb.h" +#include "BLI_array.h" #include "BKE_utildefines.h" diff --git a/source/blender/bmesh/intern/bmesh_to_editmesh.c b/source/blender/bmesh/intern/bmesh_to_editmesh.c index 5a95025d95a..1bad95ab0b1 100644 --- a/source/blender/bmesh/intern/bmesh_to_editmesh.c +++ b/source/blender/bmesh/intern/bmesh_to_editmesh.c @@ -17,6 +17,8 @@ #include "BLI_blenlib.h" #include "BLI_edgehash.h" +#include "BLI_array.h" +#include "BLI_array.h" #include "bmesh.h" diff --git a/source/blender/bmesh/intern/bmesh_walkers.c b/source/blender/bmesh/intern/bmesh_walkers.c index 7c5398606dd..9d5953f03fe 100644 --- a/source/blender/bmesh/intern/bmesh_walkers.c +++ b/source/blender/bmesh/intern/bmesh_walkers.c @@ -8,6 +8,7 @@ #include "DNA_mesh_types.h" #include "BLI_mempool.h" +#include "BLI_array.h" #include "bmesh_private.h" #include "bmesh_walkers.h" diff --git a/source/blender/bmesh/intern/editmesh_to_bmesh.c b/source/blender/bmesh/intern/editmesh_to_bmesh.c index 81e3572dec6..cf30f4ae5aa 100644 --- a/source/blender/bmesh/intern/editmesh_to_bmesh.c +++ b/source/blender/bmesh/intern/editmesh_to_bmesh.c @@ -18,6 +18,7 @@ #include "BLI_blenlib.h" #include "BLI_edgehash.h" +#include "BLI_array.h" #include "bmesh.h" diff --git a/source/blender/bmesh/operators/bmesh_dupeops.c b/source/blender/bmesh/operators/bmesh_dupeops.c index f02bc7553d9..c2a0a984c91 100644 --- a/source/blender/bmesh/operators/bmesh_dupeops.c +++ b/source/blender/bmesh/operators/bmesh_dupeops.c @@ -5,6 +5,7 @@ #include "BLI_ghash.h" #include "BLI_memarena.h" #include "BLI_blenlib.h" +#include "BLI_array.h" #include "BLI_arithb.h" #include "bmesh.h" diff --git a/source/blender/bmesh/operators/connectops.c b/source/blender/bmesh/operators/connectops.c index d766760bcab..a1d51468d57 100644 --- a/source/blender/bmesh/operators/connectops.c +++ b/source/blender/bmesh/operators/connectops.c @@ -6,6 +6,7 @@ #include "mesh_intern.h" #include "bmesh_private.h" #include "BLI_arithb.h" +#include "BLI_array.h" #include <stdio.h> #include <string.h> @@ -19,17 +20,17 @@ void connectverts_exec(BMesh *bm, BMOperator *op) BMIter iter, liter; BMFace *f, *nf; BMLoop **loops = NULL, *lastl = NULL; - V_DECLARE(loops); + BLI_array_declare(loops); BMLoop *l, *nl; BMVert *v1, *v2, **verts = NULL; - V_DECLARE(verts); + BLI_array_declare(verts); int i; BMO_Flag_Buffer(bm, op, "verts", VERT_INPUT, BM_VERT); for (f=BMIter_New(&iter, bm, BM_FACES_OF_MESH, NULL); f; f=BMIter_Step(&iter)){ - V_RESET(loops); - V_RESET(verts); + BLI_array_empty(loops); + BLI_array_empty(verts); if (BMO_TestFlag(bm, f, FACE_NEW)) continue; @@ -46,40 +47,40 @@ void connectverts_exec(BMesh *bm, BMOperator *op) if (lastl != l->head.prev && lastl != l->head.next) { - V_GROW(loops); - loops[V_COUNT(loops)-1] = lastl; + BLI_array_growone(loops); + loops[BLI_array_count(loops)-1] = lastl; - V_GROW(loops); - loops[V_COUNT(loops)-1] = l; + BLI_array_growone(loops); + loops[BLI_array_count(loops)-1] = l; } lastl = l; } } - if (V_COUNT(loops) == 0) continue; + if (BLI_array_count(loops) == 0) continue; - if (V_COUNT(loops) > 2) { - V_GROW(loops); - loops[V_COUNT(loops)-1] = loops[V_COUNT(loops)-2]; + if (BLI_array_count(loops) > 2) { + BLI_array_growone(loops); + loops[BLI_array_count(loops)-1] = loops[BLI_array_count(loops)-2]; - V_GROW(loops); - loops[V_COUNT(loops)-1] = loops[0]; + BLI_array_growone(loops); + loops[BLI_array_count(loops)-1] = loops[0]; } - BM_LegalSplits(bm, f, loops, V_COUNT(loops)/2); + BM_LegalSplits(bm, f, loops, BLI_array_count(loops)/2); - for (i=0; i<V_COUNT(loops)/2; i++) { + for (i=0; i<BLI_array_count(loops)/2; i++) { if (loops[i*2]==NULL) continue; - V_GROW(verts); - verts[V_COUNT(verts)-1] = loops[i*2]->v; + BLI_array_growone(verts); + verts[BLI_array_count(verts)-1] = loops[i*2]->v; - V_GROW(verts); - verts[V_COUNT(verts)-1] = loops[i*2+1]->v; + BLI_array_growone(verts); + verts[BLI_array_count(verts)-1] = loops[i*2+1]->v; } - for (i=0; i<V_COUNT(verts)/2; i++) { + for (i=0; i<BLI_array_count(verts)/2; i++) { nf = BM_Split_Face(bm, f, verts[i*2], verts[i*2+1], &nl, NULL); f = nf; @@ -87,7 +88,7 @@ void connectverts_exec(BMesh *bm, BMOperator *op) if (!nl || !nf) { BMO_RaiseError(bm, op, BMERR_CONNECTVERT_FAILED, NULL); - V_FREE(loops); + BLI_array_free(loops); return;;; } BMO_SetFlag(bm, nf, FACE_NEW); @@ -97,8 +98,8 @@ void connectverts_exec(BMesh *bm, BMOperator *op) BMO_Flag_To_Slot(bm, op, "edgeout", EDGE_OUT, BM_EDGE); - V_FREE(loops); - V_FREE(verts); + BLI_array_free(loops); + BLI_array_free(verts); } int BM_ConnectVerts(EditMesh *em, int flag) diff --git a/source/blender/bmesh/operators/createops.c b/source/blender/bmesh/operators/createops.c index 56382d18b00..9ae96436caa 100644 --- a/source/blender/bmesh/operators/createops.c +++ b/source/blender/bmesh/operators/createops.c @@ -8,6 +8,7 @@ #include "BLI_ghash.h" #include "BLI_blenlib.h" #include "BLI_arithb.h" +#include "BLI_array.h" #include "bmesh.h" #include "bmesh_operators_private.h" @@ -132,7 +133,7 @@ EPath *edge_find_shortest_path(BMesh *bm, BMEdge *edge, EdgeData *edata, PathBas GHash *gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp); BMVert *v1, *v2; BMVert **verts = NULL; - V_DECLARE(verts); + BLI_array_declare(verts); Heap *heap = BLI_heap_new(); EPath *path = NULL, *path2; EPathNode *node; @@ -151,9 +152,9 @@ EPath *edge_find_shortest_path(BMesh *bm, BMEdge *edge, EdgeData *edata, PathBas if (v1 == edge->v2) { /*make sure this path loop doesn't already exist*/ i = 0; - V_RESET(verts); + BLI_array_empty(verts); for (i=0, node = path->nodes.first; node; node=node->next, i++) { - V_GROW(verts); + BLI_array_growone(verts); verts[i] = node->v; } @@ -184,7 +185,7 @@ EPath *edge_find_shortest_path(BMesh *bm, BMEdge *edge, EdgeData *edata, PathBas path = NULL; } - V_FREE(verts); + BLI_array_free(verts); BLI_heap_free(heap, NULL); BLI_ghash_free(gh, NULL, NULL); @@ -202,7 +203,7 @@ void bmesh_edgenet_fill_exec(BMesh *bm, BMOperator *op) EdgeData *edata; BMEdge **edges = NULL; PathBase *pathbase = edge_pathbase_new(); - V_DECLARE(edges); + BLI_array_declare(edges); int i; if (!bm->totvert || !bm->totedge) @@ -241,7 +242,7 @@ void bmesh_edgenet_fill_exec(BMesh *bm, BMOperator *op) if (!path) continue; - V_RESET(edges); + BLI_array_empty(edges); i = 0; for (node=path->nodes.first; node; node=node->next) { if (!node->next) @@ -254,11 +255,11 @@ void bmesh_edgenet_fill_exec(BMesh *bm, BMOperator *op) break; edata[BMINDEX_GET(e)].ftag++; - V_GROW(edges); + BLI_array_growone(edges); edges[i++] = e; } - V_GROW(edges); + BLI_array_growone(edges); edges[i++] = edge; f = BM_Make_Ngon(bm, edge->v1, edge->v2, edges, i, 1); @@ -270,7 +271,7 @@ void bmesh_edgenet_fill_exec(BMesh *bm, BMOperator *op) BMO_Flag_To_Slot(bm, op, "faceout", FACE_NEW, BM_FACE); - V_FREE(edges); + BLI_array_free(edges); edge_pathbase_free(pathbase); MEM_freeN(edata); } @@ -336,9 +337,9 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op) BMIter iter; BMEdge *e, *e2; BMEdge **edges1 = NULL, **edges2 = NULL, **edges; - V_DECLARE(edges1); - V_DECLARE(edges2); - V_DECLARE(edges); + BLI_array_declare(edges1); + BLI_array_declare(edges2); + BLI_array_declare(edges); int ok = 1; int i, count; @@ -386,7 +387,7 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op) i = 0; while (e) { BMO_SetFlag(bm, e, EDGE_VIS); - V_GROW(edges); + BLI_array_growone(edges); edges[i] = e; e = edge_next(bm, e); @@ -395,22 +396,22 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op) if (!count) { edges1 = edges; - V_SETCOUNT(edges1, V_COUNT(edges)); + BLI_array_set_length(edges1, BLI_array_count(edges)); } else { edges2 = edges; - V_SETCOUNT(edges2, V_COUNT(edges)); + BLI_array_set_length(edges2, BLI_array_count(edges)); } - V_RESET(edges); + BLI_array_empty(edges); count++; } #define EDGECON(e1, e2) (e1->v1 == e2->v1 || e1->v2 == e2->v2 || e1->v1 == e2->v2) - if (edges1 && V_COUNT(edges1) > 2 && EDGECON(edges1[0], edges1[V_COUNT(edges1)-1])) { - if (edges2 && V_COUNT(edges2) > 2 && EDGECON(edges2[0], edges2[V_COUNT(edges2)-1])) { - V_FREE(edges1); - V_FREE(edges2); + if (edges1 && BLI_array_count(edges1) > 2 && EDGECON(edges1[0], edges1[BLI_array_count(edges1)-1])) { + if (edges2 && BLI_array_count(edges2) > 2 && EDGECON(edges2[0], edges2[BLI_array_count(edges2)-1])) { + BLI_array_free(edges1); + BLI_array_free(edges2); return; } else { edges1 = edges2; @@ -418,7 +419,7 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op) } } - if (edges2 && V_COUNT(edges2) > 2 && EDGECON(edges2[0], edges2[V_COUNT(edges2)-1])) { + if (edges2 && BLI_array_count(edges2) > 2 && EDGECON(edges2[0], edges2[BLI_array_count(edges2)-1])) { edges2 = NULL; } @@ -426,7 +427,7 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op) if (edges1 && edges2) { BMVert *v1, *v2, *v3, *v4; - if (V_COUNT(edges1)==1) { + if (BLI_array_count(edges1)==1) { v1 = edges1[0]->v1; v2 = edges1[0]->v2; } else { @@ -434,13 +435,13 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op) v1 = edges1[0]->v2; else v1 = edges1[0]->v1; - i = V_COUNT(edges1)-1; + i = BLI_array_count(edges1)-1; if (BM_Vert_In_Edge(edges1[i-1], edges1[i]->v1)) v2 = edges1[i]->v2; else v2 = edges1[i]->v1; } - if (V_COUNT(edges2)==1) { + if (BLI_array_count(edges2)==1) { v3 = edges2[0]->v1; v4 = edges2[0]->v2; } else { @@ -448,7 +449,7 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op) v3 = edges2[0]->v2; else v3 = edges2[0]->v1; - i = V_COUNT(edges2)-1; + i = BLI_array_count(edges2)-1; if (BM_Vert_In_Edge(edges2[i-1], edges2[i]->v1)) v4 = edges2[i]->v2; else v4 = edges2[i]->v1; @@ -468,12 +469,12 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op) } else if (edges1) { BMVert *v1, *v2; - if (V_COUNT(edges1) > 1) { + if (BLI_array_count(edges1) > 1) { if (BM_Vert_In_Edge(edges1[1], edges1[0]->v1)) v1 = edges1[0]->v2; else v1 = edges1[0]->v1; - i = V_COUNT(edges1)-1; + i = BLI_array_count(edges1)-1; if (BM_Vert_In_Edge(edges1[i-1], edges1[i]->v1)) v2 = edges1[i]->v2; else v2 = edges1[i]->v1; @@ -485,8 +486,8 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op) BMO_Flag_To_Slot(bm, op, "edgeout", ELE_NEW, BM_EDGE); - V_FREE(edges1); - V_FREE(edges2); + BLI_array_free(edges1); + BLI_array_free(edges2); #undef EDGECON } diff --git a/source/blender/bmesh/operators/dissolveops.c b/source/blender/bmesh/operators/dissolveops.c index e1d9aa05c0a..c04f6a3e638 100644 --- a/source/blender/bmesh/operators/dissolveops.c +++ b/source/blender/bmesh/operators/dissolveops.c @@ -6,6 +6,7 @@ #include "mesh_intern.h" #include "bmesh_private.h" #include "BLI_arithb.h" +#include "BLI_array.h" #include <stdio.h> #include <stdlib.h> @@ -52,8 +53,8 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op) BMIter liter, liter2, liter3; BMLoop *l, *l2, *l3; BMFace *f, *f2, *nf = NULL; - V_DECLARE(region); - V_DECLARE(regions); + BLI_array_declare(region); + BLI_array_declare(regions); BMLoop ***regions = NULL; BMLoop **region = NULL; BMWalker regwalker; @@ -66,7 +67,7 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op) for (; f; f=BMO_IterStep(&oiter)) { if (!BMO_TestFlag(bm, f, FACE_MARK)) continue; - V_RESET(region); + BLI_array_empty(region); region = NULL; /*forces different allocation*/ /*yay, walk!*/ @@ -78,14 +79,14 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op) l3 = BMIter_New(&liter3, bm, BM_LOOPS_OF_LOOP, l2); for (; l3; l3=BMIter_Step(&liter3)) { if (!BMO_TestFlag(bm, l3->f, FACE_MARK)) { - V_GROW(region); - region[V_COUNT(region)-1] = l2; + BLI_array_growone(region); + region[BLI_array_count(region)-1] = l2; break; } } if (bmesh_radial_nextloop(l2) == l2) { - V_GROW(region); - region[V_COUNT(region)-1] = l2; + BLI_array_growone(region); + region[BLI_array_count(region)-1] = l2; } } } @@ -106,20 +107,20 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op) goto cleanup; } - V_GROW(region); - V_GROW(regions); - regions[V_COUNT(regions)-1] = region; - region[V_COUNT(region)-1] = NULL; + BLI_array_growone(region); + BLI_array_growone(regions); + regions[BLI_array_count(regions)-1] = region; + region[BLI_array_count(region)-1] = NULL; } - for (i=0; i<V_COUNT(regions); i++) { + for (i=0; i<BLI_array_count(regions); i++) { BMEdge **edges = NULL; - V_DECLARE(edges); + BLI_array_declare(edges); region = regions[i]; for (j=0; region[j]; j++) { - V_GROW(edges); - edges[V_COUNT(edges)-1] = region[j]->e; + BLI_array_growone(edges); + edges[BLI_array_count(edges)-1] = region[j]->e; } if (!region[0]) { @@ -133,7 +134,7 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op) else f= BM_Make_Ngon(bm, region[0]->e->v2, region[0]->e->v1, edges, j, 1); - V_FREE(edges); + BLI_array_free(edges); if (!f) { BMO_RaiseError(bm, op, BMERR_DISSOLVEFACES_FAILED, @@ -181,11 +182,11 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op) cleanup: /*free/cleanup*/ - for (i=0; i<V_COUNT(regions); i++) { - if (regions[i]) V_FREE(regions[i]); + for (i=0; i<BLI_array_count(regions); i++) { + if (regions[i]) BLI_array_free(regions[i]); } - V_FREE(regions); + BLI_array_free(regions); } /*almost identical to dissolve edge, except it cleans up vertices*/ @@ -195,7 +196,7 @@ void dissolve_edgeloop_exec(BMesh *bm, BMOperator *op) BMOIter oiter; BMIter iter; BMVert *v, **verts = NULL; - V_DECLARE(verts); + BLI_array_declare(verts); BMEdge *e; BMFace *f; int i; @@ -215,17 +216,17 @@ void dissolve_edgeloop_exec(BMesh *bm, BMOperator *op) if (BMO_TestFlag(bm, v, VERT_MARK) && BM_Vert_EdgeCount(v) == 2) { - V_GROW(verts); - verts[V_COUNT(verts)-1] = v; + BLI_array_growone(verts); + verts[BLI_array_count(verts)-1] = v; } } /*clean up extreneous 2-valence vertices*/ - for (i=0; i<V_COUNT(verts); i++) { + for (i=0; i<BLI_array_count(verts); i++) { BM_Collapse_Vert(bm, verts[i]->edge, verts[i], 1.0); } - V_FREE(verts); + BLI_array_free(verts); //BMO_InitOpf(bm, &fop, "dissolvefaces faces=%ff", FACE_MARK); //BMO_Exec_Op(bm, &fop); diff --git a/source/blender/bmesh/operators/extrudeops.c b/source/blender/bmesh/operators/extrudeops.c index 1043ff1020c..fb9c13f54c2 100644 --- a/source/blender/bmesh/operators/extrudeops.c +++ b/source/blender/bmesh/operators/extrudeops.c @@ -6,6 +6,7 @@ #include "BLI_memarena.h" #include "BLI_blenlib.h" #include "BLI_arithb.h" +#include "BLI_array.h" #include "bmesh.h" #include "bmesh_operators_private.h" @@ -27,15 +28,15 @@ void bmesh_extrude_face_indiv_exec(BMesh *bm, BMOperator *op) BMLoop *l, *l2, *l3, *l4; BMEdge **edges = NULL, *e, *laste; BMVert *v, *lastv, *firstv; - V_DECLARE(edges); + BLI_array_declare(edges); int i; BMO_ITER(f, &siter, bm, op, "faces", BM_FACE) { - V_RESET(edges); + BLI_array_empty(edges); i = 0; firstv = lastv = NULL; BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) { - V_GROW(edges); + BLI_array_growone(edges); v = BM_Make_Vert(bm, l->v->co, NULL); BM_Copy_Attributes(bm, bm, l->v, v); @@ -50,7 +51,7 @@ void bmesh_extrude_face_indiv_exec(BMesh *bm, BMOperator *op) if (!firstv) firstv = v; } - V_GROW(edges); + BLI_array_growone(edges); e = BM_Make_Edge(bm, v, firstv, laste, 0); edges[i++] = e; diff --git a/source/blender/bmesh/operators/mesh_conv.c b/source/blender/bmesh/operators/mesh_conv.c index 4ca426ba7cf..15bc1f25bba 100644 --- a/source/blender/bmesh/operators/mesh_conv.c +++ b/source/blender/bmesh/operators/mesh_conv.c @@ -20,6 +20,7 @@ #include "BLI_edgehash.h" #include "BLI_editVert.h" #include "BLI_scanfill.h" +#include "BLI_array.h" #include "ED_mesh.h" @@ -43,7 +44,7 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) { MPoly *mpoly; BMVert *v, **vt=NULL; BMEdge *e, **fedges=NULL, **et = NULL; - V_DECLARE(fedges); + BLI_array_declare(fedges); BMFace *f; int i, j, li, allocsize[4] = {512, 512, 2048, 512}; @@ -119,13 +120,13 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) { BMIter iter; BMLoop *l; - V_RESET(fedges); + BLI_array_empty(fedges); for (j=0; j<mpoly->totloop; j++) { ml = &me->mloop[mpoly->loopstart+j]; v = vt[ml->v]; e = et[ml->e]; - V_GROW(fedges); + BLI_array_growone(fedges); fedges[j] = e; } @@ -166,7 +167,7 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) { CustomData_to_bmesh_block(&me->pdata, &bm->pdata, i, &f->head.data); } - V_FREE(fedges); + BLI_array_free(fedges); MEM_freeN(vt); MEM_freeN(et); diff --git a/source/blender/bmesh/operators/mirror.c b/source/blender/bmesh/operators/mirror.c index 1cde079e61b..c928ff89daa 100644 --- a/source/blender/bmesh/operators/mirror.c +++ b/source/blender/bmesh/operators/mirror.c @@ -20,6 +20,7 @@ #include "BLI_arithb.h" #include "BLI_blenlib.h" #include "BLI_edgehash.h" +#include "BLI_array.h" #include "bmesh.h" @@ -37,9 +38,9 @@ void bmesh_mirror_exec(BMesh *bm, BMOperator *op) { BMOIter siter; BMIter iter; BMVert *v, *v2, **vmap = NULL; - V_DECLARE(vmap); + BLI_array_declare(vmap); BMEdge *e, **emap = NULL; - V_DECLARE(emap); + BLI_array_declare(emap); float mtx[4][4]; float imtx[4][4]; float scale[3] = {1.0f, 1.0f, 1.0f}; @@ -63,7 +64,7 @@ void bmesh_mirror_exec(BMesh *bm, BMOperator *op) { i = 0; v2 = BMIter_New(&iter, bm, BM_VERTS_OF_MESH, NULL); BMO_ITER(v, &siter, bm, &dupeop, "newout", BM_VERT) { - V_GROW(vmap); + BLI_array_growone(vmap); vmap[i] = v; BMINDEX_SET(v2, i); @@ -116,7 +117,7 @@ void bmesh_mirror_exec(BMesh *bm, BMOperator *op) { BMO_Flag_To_Slot(bm, op, "newout", ELE_NEW, BM_ALL); - V_FREE(vmap); - V_FREE(emap); + BLI_array_free(vmap); + BLI_array_free(emap); } diff --git a/source/blender/bmesh/operators/removedoubles.c b/source/blender/bmesh/operators/removedoubles.c index c8d3b883f5d..e4444b0f065 100644 --- a/source/blender/bmesh/operators/removedoubles.c +++ b/source/blender/bmesh/operators/removedoubles.c @@ -10,6 +10,7 @@ #include "BLI_arithb.h" #include "BLI_ghash.h" #include "BLI_blenlib.h" +#include "BLI_array.h" #include "bmesh.h" #include "mesh_intern.h" @@ -85,9 +86,9 @@ void bmesh_weldverts_exec(BMesh *bm, BMOperator *op) BMIter iter, liter; BMVert *v, *v2; BMEdge *e, *e2, **edges = NULL; - V_DECLARE(edges); + BLI_array_declare(edges); BMLoop *l, *l2, **loops = NULL; - V_DECLARE(loops); + BLI_array_declare(loops); BMFace *f, *f2; int a, b; @@ -136,8 +137,8 @@ void bmesh_weldverts_exec(BMesh *bm, BMOperator *op) continue; } - V_RESET(edges); - V_RESET(loops); + BLI_array_empty(edges); + BLI_array_empty(loops); a = 0; BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) { v = l->v; @@ -156,8 +157,8 @@ void bmesh_weldverts_exec(BMesh *bm, BMOperator *op) if (b != a) continue; - V_GROW(edges); - V_GROW(loops); + BLI_array_growone(edges); + BLI_array_growone(loops); edges[a] = e2; loops[a] = l; @@ -166,7 +167,7 @@ void bmesh_weldverts_exec(BMesh *bm, BMOperator *op) } } - if (V_COUNT(loops) < 3) + if (BLI_array_count(loops) < 3) continue; v = loops[0]->v; @@ -193,8 +194,8 @@ void bmesh_weldverts_exec(BMesh *bm, BMOperator *op) BMO_CallOpf(bm, "del geom=%fvef context=%i", ELE_DEL, DEL_ONLYTAGGED); - V_FREE(edges); - V_FREE(loops); + BLI_array_free(edges); + BLI_array_free(loops); } static int vergaverco(const void *e1, const void *e2) @@ -331,7 +332,7 @@ void bmesh_collapse_exec(BMesh *bm, BMOperator *op) BMWalker walker; BMIter iter; BMEdge *e, **edges = NULL; - V_DECLARE(edges); + BLI_array_declare(edges); float min[3], max[3]; int i, tot; @@ -346,11 +347,11 @@ void bmesh_collapse_exec(BMesh *bm, BMOperator *op) continue; e = BMW_Begin(&walker, e->v1); - V_RESET(edges); + BLI_array_empty(edges); INIT_MINMAX(min, max); for (tot=0; e; tot++, e=BMW_Step(&walker)) { - V_GROW(edges); + BLI_array_growone(edges); edges[tot] = e; DO_MINMAX(e->v1->co, min, max); @@ -376,7 +377,7 @@ void bmesh_collapse_exec(BMesh *bm, BMOperator *op) BMO_Finish_Op(bm, &weldop); BMW_End(&walker); - V_FREE(edges); + BLI_array_free(edges); } /*uv collapse function*/ @@ -387,7 +388,7 @@ void bmesh_collapsecon_do_layer(BMesh *bm, BMOperator *op, int layer) BMLoop *l, *l2; BMWalker walker; void **blocks = NULL; - V_DECLARE(blocks); + BLI_array_declare(blocks); CDBlockBytes min, max; int i, tot, type = bm->ldata.layers[layer].type; @@ -400,13 +401,13 @@ void bmesh_collapsecon_do_layer(BMesh *bm, BMOperator *op, int layer) BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) { if (BMO_TestFlag(bm, l->e, EDGE_MARK)) { /*walk*/ - V_RESET(blocks); + BLI_array_empty(blocks); tot = 0; l2 = BMW_Begin(&walker, l); CustomData_data_initminmax(type, &min, &max); for (tot=0; l2; tot++, l2=BMW_Step(&walker)) { - V_GROW(blocks); + BLI_array_growone(blocks); blocks[tot] = CustomData_bmesh_get_layer_n(&bm->ldata, l2->head.data, layer); CustomData_data_dominmax(type, blocks[tot], &min, &max); } @@ -426,7 +427,7 @@ void bmesh_collapsecon_do_layer(BMesh *bm, BMOperator *op, int layer) } BMW_End(&walker); - V_FREE(blocks); + BLI_array_free(blocks); } void bmesh_collapsecon_exec(BMesh *bm, BMOperator *op) @@ -445,7 +446,7 @@ void bmesh_removedoubles_exec(BMesh *bm, BMOperator *op) BMOIter oiter; BMVert *v, *v2; BMVert **verts=NULL; - V_DECLARE(verts); + BLI_array_declare(verts); float dist, distsqr; int i, j, len; @@ -456,14 +457,14 @@ void bmesh_removedoubles_exec(BMesh *bm, BMOperator *op) i = 0; BMO_ITER(v, &oiter, bm, op, "verts", BM_VERT) { - V_GROW(verts); + BLI_array_growone(verts); verts[i++] = v; } /*sort by vertex coordinates added together*/ - qsort(verts, V_COUNT(verts), sizeof(void*), vergaverco); + qsort(verts, BLI_array_count(verts), sizeof(void*), vergaverco); - len = V_COUNT(verts); + len = BLI_array_count(verts); for (i=0; i<len; i++) { v = verts[i]; if (BMO_TestFlag(bm, v, VERT_TESTED)) continue; @@ -490,7 +491,7 @@ void bmesh_removedoubles_exec(BMesh *bm, BMOperator *op) } } - V_FREE(verts); + BLI_array_free(verts); BMO_Exec_Op(bm, &weldop); BMO_Finish_Op(bm, &weldop); @@ -502,7 +503,7 @@ void bmesh_finddoubles_exec(BMesh *bm, BMOperator *op) BMOIter oiter; BMVert *v, *v2; BMVert **verts=NULL; - V_DECLARE(verts); + BLI_array_declare(verts); float dist, distsqr; int i, j, len, keepvert; @@ -511,18 +512,18 @@ void bmesh_finddoubles_exec(BMesh *bm, BMOperator *op) i = 0; BMO_ITER(v, &oiter, bm, op, "verts", BM_VERT) { - V_GROW(verts); + BLI_array_growone(verts); verts[i++] = v; } keepvert = BMO_IterNew(&oiter, bm, op, "keepverts", BM_VERT) != NULL; /*sort by vertex coordinates added together*/ - qsort(verts, V_COUNT(verts), sizeof(void*), vergaverco); + qsort(verts, BLI_array_count(verts), sizeof(void*), vergaverco); BMO_Flag_Buffer(bm, op, "keepverts", VERT_KEEP, BM_VERT); - len = V_COUNT(verts); + len = BLI_array_count(verts); for (i=0; i<len; i++) { v = verts[i]; if (BMO_TestFlag(bm, v, VERT_DOUBLE)) continue; @@ -546,5 +547,5 @@ void bmesh_finddoubles_exec(BMesh *bm, BMOperator *op) } } - V_FREE(verts); + BLI_array_free(verts); } diff --git a/source/blender/bmesh/operators/subdivideop.c b/source/blender/bmesh/operators/subdivideop.c index 388ced2fbb6..bbb972134d3 100644 --- a/source/blender/bmesh/operators/subdivideop.c +++ b/source/blender/bmesh/operators/subdivideop.c @@ -5,6 +5,7 @@ #include "BLI_arithb.h" #include "BLI_rand.h" #include "BLI_ghash.h" +#include "BLI_array.h" #include "DNA_object_types.h" @@ -236,7 +237,7 @@ v3---------v2 v4---v0---v1 */ -static void q_1edge_split(BMesh *bm, BMFace *face, +static void quad_1edge_split(BMesh *bm, BMFace *face, BMVert **verts, subdparams *params) { BMFace *nf; int i, add, numcuts = params->numcuts; @@ -265,9 +266,9 @@ static void q_1edge_split(BMesh *bm, BMFace *face, } } -subdpattern q_1edge = { +subdpattern quad_1edge = { {1, 0, 0, 0}, - q_1edge_split, + quad_1edge_split, 4, }; @@ -281,7 +282,7 @@ v6--------v5 v7-v0--v1-v2 */ -static void q_2edge_split_tess(BMesh *bm, BMFace *face, BMVert **verts, +static void quad_2edge_split_path(BMesh *bm, BMFace *face, BMVert **verts, subdparams *params) { BMFace *nf; @@ -294,9 +295,9 @@ static void q_2edge_split_tess(BMesh *bm, BMFace *face, BMVert **verts, connect_smallest_face(bm, verts[numcuts*2+3], verts[numcuts*2+1], &nf); } -subdpattern q_2edge_path = { +subdpattern quad_2edge_path = { {1, 1, 0, 0}, - q_2edge_split_tess, + quad_2edge_split_path, 4, }; @@ -309,7 +310,7 @@ v6--------v5 v7-v0--v1-v2 */ -static void q_2edge_split_innervert(BMesh *bm, BMFace *face, BMVert **verts, +static void quad_2edge_split_innervert(BMesh *bm, BMFace *face, BMVert **verts, subdparams *params) { BMFace *nf; @@ -331,9 +332,9 @@ static void q_2edge_split_innervert(BMesh *bm, BMFace *face, BMVert **verts, connect_smallest_face(bm, lastv, verts[numcuts*2+2], &nf); } -subdpattern q_2edge_innervert = { +subdpattern quad_2edge_innervert = { {1, 1, 0, 0}, - q_2edge_split_innervert, + quad_2edge_split_innervert, 4, }; @@ -346,7 +347,7 @@ v6--------v5 v7-v0--v1-v2 */ -static void q_2edge_split_fan(BMesh *bm, BMFace *face, BMVert **verts, +static void quad_2edge_split_fan(BMesh *bm, BMFace *face, BMVert **verts, subdparams *params) { BMFace *nf; @@ -363,9 +364,9 @@ static void q_2edge_split_fan(BMesh *bm, BMFace *face, BMVert **verts, } } -subdpattern q_2edge_fan = { +subdpattern quad_2edge_fan = { {1, 1, 0, 0}, - q_2edge_split_fan, + quad_2edge_split_fan, 4, }; @@ -379,7 +380,7 @@ v8--v7--v6-v5 v9-v0--v1-v2 */ -static void q_3edge_split(BMesh *bm, BMFace *face, BMVert **verts, +static void quad_3edge_split(BMesh *bm, BMFace *face, BMVert **verts, subdparams *params) { BMFace *nf; @@ -403,9 +404,9 @@ static void q_3edge_split(BMesh *bm, BMFace *face, BMVert **verts, } } -subdpattern q_3edge = { +subdpattern quad_3edge = { {1, 1, 1, 0}, - q_3edge_split, + quad_3edge_split, 4, }; @@ -420,7 +421,7 @@ first line | | last line it goes from bottom up */ -static void q_4edge_split(BMesh *bm, BMFace *face, BMVert **verts, +static void quad_4edge_subdivide(BMesh *bm, BMFace *face, BMVert **verts, subdparams *params) { BMFace *nf; @@ -494,7 +495,7 @@ static void q_4edge_split(BMesh *bm, BMFace *face, BMVert **verts, v4--v0--v1--v2 s s */ -static void t_1edge_split(BMesh *bm, BMFace *face, BMVert **verts, +static void tri_1edge_split(BMesh *bm, BMFace *face, BMVert **verts, subdparams *params) { BMFace *nf; @@ -505,9 +506,9 @@ static void t_1edge_split(BMesh *bm, BMFace *face, BMVert **verts, } } -subdpattern t_1edge = { +subdpattern tri_1edge = { {1, 0, 0}, - t_1edge_split, + tri_1edge_split, 3, }; @@ -520,7 +521,7 @@ sv7/---v---\ v3 s v8--v0--v1--v2 s s */ -static void t_3edge_split(BMesh *bm, BMFace *face, BMVert **verts, +static void tri_3edge_subdivide(BMesh *bm, BMFace *face, BMVert **verts, subdparams *params) { BMFace *nf; @@ -601,16 +602,16 @@ cleanup: MEM_freeN(lines); } -subdpattern t_3edge = { +subdpattern tri_3edge = { {1, 1, 1}, - t_3edge_split, + tri_3edge_subdivide, 3, }; -subdpattern q_4edge = { +subdpattern quad_4edge = { {1, 1, 1, 1}, - q_4edge_split, + quad_4edge_subdivide, 4, }; @@ -619,7 +620,7 @@ subdpattern *patterns[] = { NULL, //quad corner vert pattern is inserted here NULL, //tri single edge pattern is inserted here NULL, - &q_3edge, + &quad_3edge, NULL, }; @@ -634,19 +635,19 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) { BMOpSlot *einput; BMEdge *edge, **edges = NULL; - V_DECLARE(edges); + BLI_array_declare(edges); BMFace *face; BMLoop *nl; BMVert **verts = NULL; - V_DECLARE(verts); + BLI_array_declare(verts); BMIter fiter, liter; subdpattern *pat; subdparams params; subd_facedata *facedata = NULL; - V_DECLARE(facedata); + BLI_array_declare(facedata); BMLoop *l, **splits = NULL, **loops = NULL; - V_DECLARE(splits); - V_DECLARE(loops); + BLI_array_declare(splits); + BLI_array_declare(loops); float smooth, fractal; int beauty, cornertype, singleedge, gridfill; int i, j, matched, a, b, numcuts, totesel; @@ -665,27 +666,27 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) //straight cut is patterns[1] == NULL switch (cornertype) { case SUBD_PATH: - patterns[1] = &q_2edge_path; + patterns[1] = &quad_2edge_path; break; case SUBD_INNERVERT: - patterns[1] = &q_2edge_innervert; + patterns[1] = &quad_2edge_innervert; break; case SUBD_FAN: - patterns[1] = &q_2edge_fan; + patterns[1] = &quad_2edge_fan; break; } if (singleedge) { - patterns[0] = &q_1edge; - patterns[2] = &t_1edge; + patterns[0] = &quad_1edge; + patterns[2] = &tri_1edge; } else { patterns[0] = NULL; patterns[2] = NULL; } if (gridfill) { - patterns[3] = &q_4edge; - patterns[5] = &t_3edge; + patterns[3] = &quad_4edge; + patterns[5] = &tri_3edge; } else { patterns[3] = NULL; patterns[5] = NULL; @@ -714,16 +715,16 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) /*figure out which pattern to use*/ - V_RESET(edges); - V_RESET(verts); + BLI_array_empty(edges); + BLI_array_empty(verts); matched = 0; i = 0; totesel = 0; for (nl=BMIter_New(&liter, bmesh, BM_LOOPS_OF_FACE, face); nl; nl=BMIter_Step(&liter)) { - V_GROW(edges); - V_GROW(verts); + BLI_array_growone(edges); + BLI_array_growone(verts); edges[i] = nl->e; verts[i] = nl->v; @@ -767,8 +768,8 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) } } if (matched) { - V_GROW(facedata); - b = V_COUNT(facedata)-1; + BLI_array_growone(facedata); + b = BLI_array_count(facedata)-1; facedata[b].pat = pat; facedata[b].start = verts[i]; BMO_SetFlag(bmesh, face, SUBD_SPLIT); @@ -777,7 +778,7 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) } if (!matched) { /*if no match, append null element to array.*/ - V_GROW(facedata); + BLI_array_growone(facedata); } /*obvously don't test for other patterns matching*/ @@ -802,8 +803,8 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) if (matched) break; } if (matched) { - V_GROW(facedata); - j = V_COUNT(facedata) - 1; + BLI_array_growone(facedata); + j = BLI_array_count(facedata) - 1; BMO_SetFlag(bmesh, face, SUBD_SPLIT); @@ -816,8 +817,8 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) } if (!matched && totesel) { - V_GROW(facedata); - j = V_COUNT(facedata) - 1; + BLI_array_growone(facedata); + j = BLI_array_count(facedata) - 1; BMO_SetFlag(bmesh, face, SUBD_SPLIT); facedata[j].totedgesel = totesel; @@ -833,14 +834,14 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) //BM_Split_Edge_Multi(bmesh, edge, numcuts); } - //if (facedata) V_FREE(facedata); + //if (facedata) BLI_array_free(facedata); //return; i = 0; for (face=BMIter_New(&fiter, bmesh, BM_FACES_OF_MESH, NULL); face; face=BMIter_Step(&fiter)) { /*figure out which pattern to use*/ - V_RESET(verts); + BLI_array_empty(verts); if (BMO_TestFlag(bmesh, face, SUBD_SPLIT) == 0) continue; @@ -849,16 +850,16 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) BMFace *nf; int vlen; - V_RESET(loops); - V_RESET(splits); + BLI_array_empty(loops); + BLI_array_empty(splits); /*for case of two edges, connecting them shouldn't be too hard*/ BM_ITER(l, &liter, bmesh, BM_LOOPS_OF_FACE, face) { - V_GROW(loops); - loops[V_COUNT(loops)-1] = l; + BLI_array_growone(loops); + loops[BLI_array_count(loops)-1] = l; } - vlen = V_COUNT(loops); + vlen = BLI_array_count(loops); /*find the boundary of one of the split edges*/ for (a=1; a<vlen; a++) { @@ -882,19 +883,19 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) b += numcuts - 1; for (j=0; j<numcuts; j++) { - V_GROW(splits); - splits[V_COUNT(splits)-1] = loops[a]; + BLI_array_growone(splits); + splits[BLI_array_count(splits)-1] = loops[a]; - V_GROW(splits); - splits[V_COUNT(splits)-1] = loops[b]; + BLI_array_growone(splits); + splits[BLI_array_count(splits)-1] = loops[b]; b = (b-1) % vlen; a = (a+1) % vlen; } - //BM_LegalSplits(bmesh, face, splits, V_COUNT(splits)/2); + //BM_LegalSplits(bmesh, face, splits, BLI_array_count(splits)/2); - for (j=0; j<V_COUNT(splits)/2; j++) { + for (j=0; j<BLI_array_count(splits)/2; j++) { if (splits[j*2]) { BMFace *nf; @@ -920,7 +921,7 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) } for (j=0; j<face->len; j++) { - V_GROW(verts); + BLI_array_growone(verts); } j = 0; @@ -935,11 +936,11 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op) i++; } - if (facedata) V_FREE(facedata); - if (edges) V_FREE(edges); - if (verts) V_FREE(verts); - V_FREE(splits); - V_FREE(loops); + if (facedata) BLI_array_free(facedata); + if (edges) BLI_array_free(edges); + if (verts) BLI_array_free(verts); + BLI_array_free(splits); + BLI_array_free(loops); BMO_Flag_To_Slot(bmesh, op, "outinner", ELE_INNER, BM_ALL); diff --git a/source/blender/bmesh/operators/triangulateop.c b/source/blender/bmesh/operators/triangulateop.c index 732a3a85860..1951e9dffa0 100644 --- a/source/blender/bmesh/operators/triangulateop.c +++ b/source/blender/bmesh/operators/triangulateop.c @@ -5,6 +5,7 @@ #include "bmesh.h" #include "bmesh_private.h" #include "BLI_arithb.h" +#include "BLI_array.h" #include <stdio.h> #include <stdlib.h> @@ -17,21 +18,21 @@ void triangulate_exec(BMesh *bm, BMOperator *op) { BMOIter siter; BMFace *face, **newfaces = NULL; - V_DECLARE(newfaces); + BLI_array_declare(newfaces); float (*projectverts)[3] = NULL; - V_DECLARE(projectverts); + BLI_array_declare(projectverts); int i, lastlen=0, count = 0; face = BMO_IterNew(&siter, bm, op, "faces", BM_FACE); for (; face; face=BMO_IterStep(&siter)) { if (lastlen < face->len) { - V_RESET(projectverts); - V_RESET(newfaces); + BLI_array_empty(projectverts); + BLI_array_empty(newfaces); for (lastlen=0; lastlen<face->len; lastlen++) { - V_GROW(projectverts); - V_GROW(projectverts); - V_GROW(projectverts); - V_GROW(newfaces); + BLI_array_growone(projectverts); + BLI_array_growone(projectverts); + BLI_array_growone(projectverts); + BLI_array_growone(newfaces); } } @@ -50,6 +51,6 @@ void triangulate_exec(BMesh *bm, BMOperator *op) BMO_Flag_To_Slot(bm, op, "edgeout", EDGE_NEW, BM_EDGE); BMO_Flag_To_Slot(bm, op, "faceout", FACE_NEW, BM_FACE); - V_FREE(projectverts); - V_FREE(newfaces); + BLI_array_free(projectverts); + BLI_array_free(newfaces); }
\ No newline at end of file diff --git a/source/blender/bmesh/operators/utils.c b/source/blender/bmesh/operators/utils.c index c57d013506b..ad09af42226 100644 --- a/source/blender/bmesh/operators/utils.c +++ b/source/blender/bmesh/operators/utils.c @@ -18,6 +18,7 @@ #include "ED_mesh.h" #include "BLI_arithb.h" +#include "BLI_array.h" #include "BLI_blenlib.h" #include "BLI_edgehash.h" @@ -251,7 +252,7 @@ void bmesh_righthandfaces_exec(BMesh *bm, BMOperator *op) BMIter liter, liter2; BMOIter siter; BMFace *f, *startf, **fstack = NULL; - V_DECLARE(fstack); + BLI_array_declare(fstack); BMLoop *l, *l2; float maxx, cent[3]; int i, maxi; @@ -290,7 +291,7 @@ void bmesh_righthandfaces_exec(BMesh *bm, BMOperator *op) stack (if we use simple function recursion, we'd end up overloading the stack on large meshes).*/ - V_GROW(fstack); + BLI_array_growone(fstack); fstack[0] = startf; BMO_SetFlag(bm, startf, FACE_VIS); @@ -313,7 +314,7 @@ void bmesh_righthandfaces_exec(BMesh *bm, BMOperator *op) BM_flip_normal(bm, l2->f); if (i == maxi) { - V_GROW(fstack); + BLI_array_growone(fstack); maxi++; } @@ -323,7 +324,7 @@ void bmesh_righthandfaces_exec(BMesh *bm, BMOperator *op) } } - V_FREE(fstack); + BLI_array_free(fstack); /*check if we have faces yet to do. if so, recurse.*/ BMO_ITER(f, &siter, bm, op, "faces", BM_FACE) { @@ -340,7 +341,7 @@ void bmesh_vertexsmooth_exec(BMesh *bm, BMOperator *op) BMIter iter; BMVert *v; BMEdge *e; - V_DECLARE(cos); + BLI_array_declare(cos); float (*cos)[3] = NULL; float *co, *co2, clipdist = BMO_Get_Float(op, "clipdist"); int i, j, clipx, clipy, clipz; @@ -351,7 +352,7 @@ void bmesh_vertexsmooth_exec(BMesh *bm, BMOperator *op) i = 0; BMO_ITER(v, &siter, bm, op, "verts", BM_VERT) { - V_GROW(cos); + BLI_array_growone(cos); co = cos[i]; j = 0; @@ -391,7 +392,7 @@ void bmesh_vertexsmooth_exec(BMesh *bm, BMOperator *op) i++; } - V_FREE(cos); + BLI_array_free(cos); } /* @@ -1044,7 +1045,7 @@ void bmesh_reverseuvs_exec(BMesh *bm, BMOperator *op) BMOIter fs_iter; /* selected faces iterator */ BMFace *fs; /* current face */ BMIter l_iter; /* iteration loop */ - V_DECLARE(uvs); + BLI_array_declare(uvs); float (*uvs)[2] = NULL; int max_vert_count = 0; @@ -1055,12 +1056,12 @@ void bmesh_reverseuvs_exec(BMesh *bm, BMOperator *op) int num_verts = fs->len; int i = 0; - V_RESET(uvs); + BLI_array_empty(uvs); BM_ITER(lf, &l_iter, bm, BM_LOOPS_OF_FACE, fs) { MLoopUV *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV); /* current loop uv is the previous loop uv */ - V_GROW(uvs); + BLI_array_growone(uvs); uvs[i][0] = luv->uv[0]; uvs[i][1] = luv->uv[1]; i++; @@ -1078,5 +1079,5 @@ void bmesh_reverseuvs_exec(BMesh *bm, BMOperator *op) } } - V_FREE(uvs); + BLI_array_free(uvs); } diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c index cc88d537eeb..af48457a2ff 100644 --- a/source/blender/editors/mesh/bmesh_select.c +++ b/source/blender/editors/mesh/bmesh_select.c @@ -53,6 +53,7 @@ BMEditMesh_mods.c, UI level access, no geometry changes #include "BLI_blenlib.h" #include "BLI_arithb.h" #include "BLI_rand.h" +#include "BLI_array.h" #include "BKE_context.h" #include "BKE_displist.h" @@ -1644,7 +1645,7 @@ static int select_linked_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh; - V_DECLARE(verts); + BLI_array_declare(verts); BMVert **verts = NULL; BMIter iter; BMVert *v; @@ -1655,7 +1656,7 @@ static int select_linked_exec(bContext *C, wmOperator *op) tot = 0; BM_ITER_SELECT(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) if (BM_TestHFlag(v, BM_SELECT)) { - V_GROW(verts); + BLI_array_growone(verts); verts[tot++] = v; } } @@ -1671,7 +1672,7 @@ static int select_linked_exec(bContext *C, wmOperator *op) BMW_End(&walker); EDBM_select_flush(em, SCE_SELECT_VERTEX); - V_FREE(verts); + BLI_array_free(verts); WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit); return OPERATOR_FINISHED; diff --git a/source/blender/editors/mesh/bmesh_selecthistory.c b/source/blender/editors/mesh/bmesh_selecthistory.c index 88276069ec2..25c037170fa 100644 --- a/source/blender/editors/mesh/bmesh_selecthistory.c +++ b/source/blender/editors/mesh/bmesh_selecthistory.c @@ -49,6 +49,7 @@ #include "BLI_blenlib.h" #include "BLI_arithb.h" #include "BLI_rand.h" +#include "BLI_array.h" #include "BKE_context.h" #include "BKE_displist.h" diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index 9b26450cd1e..65d710d9e9a 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -58,6 +58,7 @@ #include "BLI_ghash.h" #include "BLI_linklist.h" #include "BLI_heap.h" +#include "BLI_array.h" #include "BKE_context.h" #include "BKE_customdata.h" diff --git a/source/blender/editors/mesh/bmeshutils.c b/source/blender/editors/mesh/bmeshutils.c index 22e85d6de2e..bf7889ef3c0 100644 --- a/source/blender/editors/mesh/bmeshutils.c +++ b/source/blender/editors/mesh/bmeshutils.c @@ -58,6 +58,7 @@ #include "BLI_ghash.h" #include "BLI_linklist.h" #include "BLI_heap.h" +#include "BLI_array.h" #include "BKE_context.h" #include "BKE_customdata.h" diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index 9109d72b6dc..03f29edc3fd 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -792,12 +792,12 @@ static int knife_cut_exec(bContext *C, wmOperator *op) ARegion *ar= CTX_wm_region(C); BMVert *bv; BMIter iter; - BMEdge **edges = NULL, *be; + BMEdge *be; BMOperator bmop; CutCurve curve[MAX_CUTS]; struct GHash *gh; float isect=0.0; - float *scr, co[4], *percents = NULL; + float *scr, co[4]; int len=0, isected, flag, i; short numcuts=1, mode= RNA_int_get(op->ptr, "type"); @@ -865,9 +865,6 @@ static int knife_cut_exec(bContext *C, wmOperator *op) BMO_Exec_Op(bm, &bmop); BMO_Finish_Op(bm, &bmop); - V_FREE(edges); - V_FREE(percents); - BLI_ghash_free(gh, NULL, (GHashValFreeFP)WMEM_freeN); DAG_id_flush_update(obedit->data, OB_RECALC_DATA); diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 95a14f9423f..686f0fd9348 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -47,6 +47,7 @@ #include "BLI_blenlib.h" #include "BLI_dynstr.h" /*for WM_operator_pystring */ #include "BLI_editVert.h" +#include "BLI_array.h" #include "BKE_blender.h" #include "BKE_context.h" @@ -129,7 +130,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select) BMVert *v[2][2]; BMWalker walker; float (*edges)[2][3] = NULL; - V_DYNDECLARE(edges); + BLI_array_declare(edges); float co[2][3]; int looking=1, i, j=0, tot=0; @@ -210,7 +211,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select) co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1])*(i/((float)previewlines+1))+v[1][0]->co[1]; co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2])*(i/((float)previewlines+1))+v[1][0]->co[2]; - V_GROW(edges); + BLI_array_growone(edges); VECCOPY(edges[tot][0], co[0]); VECCOPY(edges[tot][1], co[1]); tot++; @@ -219,9 +220,6 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select) lasteed = eed; } - BM_Select(em->bm, startedge, 1); - BM_Select(em->bm, lasteed, 1); - if (BM_Edge_Share_Faces(lasteed, startedge)) { v[0][0] = startedge->v1; v[0][1] = startedge->v2; @@ -236,7 +234,7 @@ static void edgering_sel(tringselOpData *lcd, int previewlines, int select) co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1])*(i/((float)previewlines+1))+v[1][0]->co[1]; co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2])*(i/((float)previewlines+1))+v[1][0]->co[2]; - V_GROW(edges); + BLI_array_growone(edges); VECCOPY(edges[tot][0], co[0]); VECCOPY(edges[tot][1], co[1]); tot++; diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 2783bf7ac99..4267bd39d5e 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -140,6 +140,7 @@ #include "BLI_arithb.h" #include "BLI_blenlib.h" #include "BLI_editVert.h" +#include "BLI_array.h" //#include "editmesh.h" // @@ -2174,7 +2175,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) float *vectors = NULL, *mappedcos = NULL, *quats= NULL; float mtx[3][3], smtx[3][3], (*defmats)[3][3] = NULL, (*defcos)[3] = NULL; int count=0, countsel=0, a, totleft, *selstate = NULL; - V_DECLARE(selstate); + BLI_array_declare(selstate); int propmode = t->flag & T_PROP_EDIT; int mirror = 0; @@ -2228,7 +2229,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) verts*/ eve = BMIter_New(&iter, bm, BM_VERTS_OF_MESH, NULL); for(a=0; eve; eve=BMIter_Step(&iter), a++) { - V_GROW(selstate); + BLI_array_growone(selstate); if(!BM_TestHFlag(eve, BM_HIDDEN)) { if(BMINDEX_GET(eve)) { @@ -2384,7 +2385,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t) if(defmats) MEM_freeN(defmats); - V_FREE(selstate); + BLI_array_free(selstate); } /* *** NODE EDITOR *** */ diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 8ec87976064..c011e6e63de 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -48,6 +48,7 @@ #include "BLI_arithb.h" #include "BLI_editVert.h" +#include "BLI_array.h" #include "BIF_gl.h" #include "BIF_glutil.h" @@ -166,8 +167,8 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe MTexPoly *tf; MLoopUV *luv; Image *ima= sima->image; - V_DECLARE(tf_uv); - V_DECLARE(tf_uvorig); + BLI_array_declare(tf_uv); + BLI_array_declare(tf_uvorig); float aspx, aspy, col[4], (*tf_uv)[2] = NULL, (*tf_uvorig)[2] = NULL; int i; @@ -181,14 +182,14 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) { tf= CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); - V_RESET(tf_uv); - V_RESET(tf_uvorig); + BLI_array_empty(tf_uv); + BLI_array_empty(tf_uvorig); i = 0; BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) { luv= CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - V_GROW(tf_uv); - V_GROW(tf_uvorig); + BLI_array_growone(tf_uv); + BLI_array_growone(tf_uvorig); tf_uvorig[i][0] = luv->uv[0]; tf_uvorig[i][1] = luv->uv[1]; @@ -232,14 +233,14 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe if(BMINDEX_GET(efa)) { area = BM_face_area(efa) / totarea; - V_RESET(tf_uv); - V_RESET(tf_uvorig); + BLI_array_empty(tf_uv); + BLI_array_empty(tf_uvorig); i = 0; BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) { luv= CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - V_GROW(tf_uv); - V_GROW(tf_uvorig); + BLI_array_growone(tf_uv); + BLI_array_growone(tf_uvorig); tf_uvorig[i][0] = luv->uv[0]; tf_uvorig[i][1] = luv->uv[1]; diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 51d85c0e171..108cfdb7ee1 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -46,6 +46,7 @@ #include "BLI_arithb.h" #include "BLI_blenlib.h" #include "BLI_editVert.h" +#include "BLI_array.h" #include "BKE_context.h" #include "BKE_customdata.h" @@ -1638,10 +1639,10 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop) MLoopUV *luv; NearestHit hit; int a, i, select = 1, selectmode, sticky, sync, *hitv=NULL, nvert; - V_DECLARE(hitv); + BLI_array_declare(hitv); int flush = 0, hitlen=0; /* 0 == dont flush, 1 == sel, -1 == desel; only use when selection sync is enabled */ float limit[2], **hituv = NULL; - V_DECLARE(hituv); + BLI_array_declare(hituv); float penalty[2]; uvedit_pixel_to_float(sima, limit, 0.05f); @@ -1685,8 +1686,8 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop) /* mark 1 vertex as being hit */ for(i=0; i<hit.efa->len; i++) { - V_GROW(hitv); - V_GROW(hituv); + BLI_array_growone(hitv); + BLI_array_growone(hituv); hitv[i]= 0xFFFFFFFF; } @@ -1704,8 +1705,8 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop) /* mark 2 edge vertices as being hit */ for(i=0; i<hit.efa->len; i++) { - V_GROW(hitv); - V_GROW(hituv); + BLI_array_growone(hitv); + BLI_array_growone(hituv); hitv[i]= 0xFFFFFFFF; } @@ -1733,8 +1734,8 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop) BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, hit.efa) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - V_GROW(hitv); - V_GROW(hituv); + BLI_array_growone(hitv); + BLI_array_growone(hituv); hituv[i]= luv->uv; hitv[i] = BMINDEX_GET(l->v); i++; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index eeb21f5cb02..e2005c73ace 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -53,6 +53,7 @@ #include "BLI_edgehash.h" #include "BLI_editVert.h" #include "BLI_scanfill.h" +#include "BLI_array.h" #include "PIL_time.h" @@ -1040,7 +1041,7 @@ static int reset_exec(bContext *C, wmOperator *op) BMIter iter, liter; MTexPoly *tf; MLoopUV *luv; - V_DECLARE(uvs); + BLI_array_declare(uvs); float **uvs = NULL; int i; @@ -1053,11 +1054,11 @@ static int reset_exec(bContext *C, wmOperator *op) if (!BM_TestHFlag(efa, BM_SELECT)) continue; - V_RESET(uvs); + BLI_array_empty(uvs); i = 0; BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - V_GROW(uvs); + BLI_array_growone(uvs); uvs[i++] = luv->uv; } @@ -1101,7 +1102,7 @@ static int reset_exec(bContext *C, wmOperator *op) DAG_id_flush_update(obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - V_FREE(uvs); + BLI_array_free(uvs); return OPERATOR_FINISHED; } @@ -1139,7 +1140,7 @@ static void uv_map_mirror(BMEditMesh *em, BMFace *efa, MTexPoly *tf) BMLoop *l; BMIter liter; MLoopUV *luv; - V_DECLARE(uvs); + BLI_array_declare(uvs); float **uvs = NULL; float dx; int i, mi; @@ -1147,7 +1148,7 @@ static void uv_map_mirror(BMEditMesh *em, BMFace *efa, MTexPoly *tf) i = 0; BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - V_GROW(uvs); + BLI_array_growone(uvs); uvs[i] = luv->uv; i++; @@ -1165,7 +1166,7 @@ static void uv_map_mirror(BMEditMesh *em, BMFace *efa, MTexPoly *tf) } } - V_FREE(uvs); + BLI_array_free(uvs); } static int sphere_project_exec(bContext *C, wmOperator *op) |