From eb46f6bf0d1da5943ddc2b7fdf1cfb04a3f3f906 Mon Sep 17 00:00:00 2001 From: Andrew Wiggin Date: Tue, 29 Nov 2011 13:01:51 +0000 Subject: [PATCH] More DM func renames, this one includes renames of the function pointer members of the DerivedMesh struct --- source/blender/blenkernel/BKE_DerivedMesh.h | 4 ++-- .../blender/blenkernel/intern/DerivedMesh.c | 8 ++++---- source/blender/blenkernel/intern/anim.c | 2 +- .../blender/blenkernel/intern/cdderivedmesh.c | 20 +++++++++++++------ .../blender/blenkernel/intern/dynamicpaint.c | 4 ++-- .../blenkernel/intern/editderivedbmesh.c | 16 +++++++-------- .../blenkernel/intern/modifiers_bmesh.c | 2 +- .../blender/blenkernel/intern/subsurf_ccg.c | 9 +++++---- source/blender/editors/mesh/editface.c | 2 +- source/blender/editors/object/object_bake.c | 6 +++--- .../blender/editors/space_info/info_stats.c | 2 +- .../blender/editors/space_view3d/drawobject.c | 4 ++-- source/blender/modifiers/intern/MOD_boolean.c | 4 ++-- source/blender/modifiers/intern/MOD_build.c | 4 ++-- .../blender/modifiers/intern/MOD_solidify.c | 4 ++-- 15 files changed, 50 insertions(+), 41 deletions(-) diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index e546f96fb91..7a6f43b7846 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -141,7 +141,7 @@ struct DerivedMesh { int (*getNumVerts)(DerivedMesh *dm); int (*getNumEdges)(DerivedMesh *dm); int (*getNumTessFaces)(DerivedMesh *dm); - int (*getNumFaces) (DerivedMesh *dm); + int (*getNumPolys)(DerivedMesh *dm); /* copy a single vert/edge/tesselated face from the derived mesh into * *{vert/edge/face}_r. note that the current implementation @@ -203,7 +203,7 @@ struct DerivedMesh { CustomData *(*getEdgeDataLayout)(DerivedMesh *dm); CustomData *(*getTessFaceDataLayout)(DerivedMesh *dm); CustomData *(*getLoopDataLayout)(DerivedMesh *dm); - CustomData *(*getFaceDataLayout)(DerivedMesh *dm); + CustomData *(*getPolyDataLayout)(DerivedMesh *dm); /*copies all customdata for an element source into dst at index dest*/ void (*copyFromVertCData)(DerivedMesh *dm, int source, CustomData *dst, int dest); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index c9c199d9c39..c701e0a52f3 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -149,7 +149,7 @@ static MPoly *dm_getPolyArray(DerivedMesh *dm) if (!mpoly) { mpoly = CustomData_add_layer(&dm->polyData, CD_MPOLY, CD_CALLOC, NULL, - dm->getNumFaces(dm)); + dm->getNumPolys(dm)); CustomData_set_layer_flag(&dm->polyData, CD_MPOLY, CD_FLAG_TEMPORARY); dm->copyPolyArray(dm, mpoly); } @@ -250,7 +250,7 @@ void DM_init_funcs(DerivedMesh *dm) dm->getEdgeDataLayout = dm_getEdgeCData; dm->getTessFaceDataLayout = dm_getFaceCData; dm->getLoopDataLayout = dm_getLoopCData; - dm->getFaceDataLayout = dm_getPolyCData; + dm->getPolyDataLayout = dm_getPolyCData; dm->getVertData = DM_get_vert_data; dm->getEdgeData = DM_get_edge_data; @@ -365,7 +365,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob) totvert = tmp.totvert = dm->getNumVerts(dm); totedge = tmp.totedge = dm->getNumEdges(dm); - totpoly = tmp.totpoly = dm->getNumFaces(dm); + totpoly = tmp.totpoly = dm->getNumPolys(dm); totloop = tmp.totloop = dm->numLoopData; CustomData_copy(&dm->vertData, &tmp.vdata, CD_MASK_MESH, CD_DUPLICATE, totvert); @@ -2410,7 +2410,7 @@ static void navmesh_DM_drawFacesSolid(DerivedMesh *dm, static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm) { DerivedMesh *result; - int maxFaces = dm->getNumFaces(dm); + int maxFaces = dm->getNumPolys(dm); int *recastData; int vertsPerPoly=0, nverts=0, ndtris=0, npolys=0; float* verts=NULL; diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index ac104dfe206..67bd1ec18aa 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1037,7 +1037,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa dm = mesh_get_derived_deform(scene, par, CD_MASK_BAREMESH); } - totface= dm->getNumFaces(dm); + totface= dm->getNumPolys(dm); mpoly= dm->getPolyArray(dm); mloop= dm->getLoopArray(dm); mvert= dm->getVertArray(dm); diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index ddc8d536d25..64d44707cff 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -112,7 +112,7 @@ static int cdDM_getNumTessFaces(DerivedMesh *dm) return dm->numFaceData; } -static int cdDM_getNumFaces(DerivedMesh *dm) +static int cdDM_getNumPolys(DerivedMesh *dm) { return dm->numPolyData; } @@ -129,7 +129,7 @@ static void cdDM_getEdge(DerivedMesh *dm, int index, MEdge *edge_r) *edge_r = cddm->medge[index]; } -static void cdDM_getFace(DerivedMesh *dm, int index, MFace *face_r) +static void cdDM_getTessFace(DerivedMesh *dm, int index, MFace *face_r) { CDDerivedMesh *cddm = (CDDerivedMesh *)dm; *face_r = cddm->mface[index]; @@ -147,7 +147,7 @@ static void cdDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r) memcpy(edge_r, cddm->medge, sizeof(*edge_r) * dm->numEdgeData); } -static void cdDM_copyFaceArray(DerivedMesh *dm, MFace *face_r) +static void cdDM_copyTessFaceArray(DerivedMesh *dm, MFace *face_r) { CDDerivedMesh *cddm = (CDDerivedMesh *)dm; memcpy(face_r, cddm->mface, sizeof(*face_r) * dm->numFaceData); @@ -1631,17 +1631,25 @@ static CDDerivedMesh *cdDM_create(const char *desc) dm->getNumVerts = cdDM_getNumVerts; dm->getNumEdges = cdDM_getNumEdges; dm->getNumTessFaces = cdDM_getNumTessFaces; - dm->getNumFaces = cdDM_getNumFaces; + dm->getNumPolys = cdDM_getNumPolys; dm->getVert = cdDM_getVert; dm->getEdge = cdDM_getEdge; - dm->getTessFace = cdDM_getFace; + dm->getTessFace = cdDM_getTessFace; + dm->copyVertArray = cdDM_copyVertArray; dm->copyEdgeArray = cdDM_copyEdgeArray; - dm->copyTessFaceArray = cdDM_copyFaceArray; + dm->copyTessFaceArray = cdDM_copyTessFaceArray; dm->copyLoopArray = cdDM_copyLoopArray; dm->copyPolyArray = cdDM_copyPolyArray; + dm->getVertData = DM_get_vert_data; + dm->getEdgeData = DM_get_edge_data; + dm->getTessFaceData = DM_get_tessface_data; + dm->getVertDataArray = DM_get_vert_data_layer; + dm->getEdgeDataArray = DM_get_edge_data_layer; + dm->getTessFaceDataArray = DM_get_tessface_data_layer; + dm->calcNormals = CDDM_calc_normals; dm->recalcTesselation = CDDM_recalc_tesselation; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index aa8ff43d423..75b6cb10e7e 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1668,7 +1668,7 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData /* Save preview results to weight layer, to be * able to share same drawing methods */ MFace *mface = result->getTessFaceArray(result); - int numOfFaces = result->getNumFaces(result); + int numOfFaces = result->getNumPolys(result); int i; MCol *col = result->getTessFaceDataArray(result, CD_WEIGHT_MCOL); if (!col) col = CustomData_add_layer(&result->faceData, CD_WEIGHT_MCOL, CD_CALLOC, NULL, numOfFaces); @@ -2091,7 +2091,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface) if (!dm) return setError(canvas, "Canvas mesh not updated."); if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) return setError(canvas, "Can't bake non-\"image sequence\" formats."); - numOfFaces = dm->getNumFaces(dm); + numOfFaces = dm->getNumPolys(dm); mface = dm->getTessFaceArray(dm); /* get uv map */ diff --git a/source/blender/blenkernel/intern/editderivedbmesh.c b/source/blender/blenkernel/intern/editderivedbmesh.c index 0bc105ca501..55dd20061d8 100644 --- a/source/blender/blenkernel/intern/editderivedbmesh.c +++ b/source/blender/blenkernel/intern/editderivedbmesh.c @@ -1276,7 +1276,7 @@ static int bmDM_getNumTessFaces(DerivedMesh *dm) return bmdm->tc->tottri; } -static int bmDM_getNumFaces(DerivedMesh *dm) +static int bmDM_getNumPolys(DerivedMesh *dm) { EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm; @@ -1415,7 +1415,7 @@ static void bmDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r) } } -static void bmDM_copyFaceArray(DerivedMesh *dm, MFace *face_r) +static void bmDM_copyTessFaceArray(DerivedMesh *dm, MFace *face_r) { EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm; BMesh *bm = ((EditDerivedBMesh *)dm)->tc->bm; @@ -1482,7 +1482,7 @@ static void bmDM_copyPolyArray(DerivedMesh *dm, MPoly *poly_r) } } -static void *bmDM_getFaceDataArray(DerivedMesh *dm, int type) +static void *bmDM_getTessFaceDataArray(DerivedMesh *dm, int type) { EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm; BMesh *bm= bmdm->tc->bm; @@ -1592,7 +1592,7 @@ static CustomData *bmDm_getLoopDataLayout(DerivedMesh *dm) return &bmdm->tc->bm->ldata; } -static CustomData *bmDm_getFaceDataLayout(DerivedMesh *dm) +static CustomData *bmDm_getPolyDataLayout(DerivedMesh *dm) { EditDerivedBMesh *bmdm = (EditDerivedBMesh*)dm; @@ -1620,23 +1620,23 @@ DerivedMesh *getEditDerivedBMesh(BMEditMesh *em, Object *UNUSED(ob), bmdm->dm.getEdgeDataLayout = bmDm_getEdgeDataLayout; bmdm->dm.getTessFaceDataLayout = bmDm_getTessFaceDataLayout; bmdm->dm.getLoopDataLayout = bmDm_getLoopDataLayout; - bmdm->dm.getFaceDataLayout = bmDm_getFaceDataLayout; + bmdm->dm.getPolyDataLayout = bmDm_getPolyDataLayout; bmdm->dm.getNumVerts = bmDM_getNumVerts; bmdm->dm.getNumEdges = bmDM_getNumEdges; bmdm->dm.getNumTessFaces = bmDM_getNumTessFaces; - bmdm->dm.getNumFaces = bmDM_getNumFaces; + bmdm->dm.getNumPolys = bmDM_getNumPolys; bmdm->dm.getVert = bmDM_getVert; bmdm->dm.getEdge = bmDM_getEdge; bmdm->dm.getTessFace = bmDM_getTessFace; bmdm->dm.copyVertArray = bmDM_copyVertArray; bmdm->dm.copyEdgeArray = bmDM_copyEdgeArray; - bmdm->dm.copyTessFaceArray = bmDM_copyFaceArray; + bmdm->dm.copyTessFaceArray = bmDM_copyTessFaceArray; bmdm->dm.copyLoopArray = bmDM_copyLoopArray; bmdm->dm.copyPolyArray = bmDM_copyPolyArray; - bmdm->dm.getTessFaceDataArray = bmDM_getFaceDataArray; + bmdm->dm.getTessFaceDataArray = bmDM_getTessFaceDataArray; bmdm->dm.calcNormals = bmDM_calcNormals; bmdm->dm.recalcTesselation = bmDM_recalcTesselation; diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c index 45c642fc0f3..2dc994b2159 100644 --- a/source/blender/blenkernel/intern/modifiers_bmesh.c +++ b/source/blender/blenkernel/intern/modifiers_bmesh.c @@ -138,7 +138,7 @@ BMEditMesh *CDDM_To_BMesh(Object *ob, DerivedMesh *dm, BMEditMesh *existing) totvert = dm->getNumVerts(dm); totedge = dm->getNumEdges(dm); - totface = dm->getNumFaces(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"); diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 1d1a10f57e3..c4eb129de26 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -223,7 +223,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, MLoop *mloop = dm->getLoopArray(dm); MVert *mvert = dm->getVertArray(dm); int totvert = dm->getNumVerts(dm); - int totface = dm->getNumFaces(dm); + int totface = dm->getNumPolys(dm); int i, j, seam; UvMapVert *v; UvVertMap *vmap; @@ -2502,7 +2502,7 @@ static void *ccgDM_get_edge_data_layer(DerivedMesh *dm, int type) return DM_get_edge_data_layer(dm, type); } -static void *ccgDM_get_face_data_layer(DerivedMesh *dm, int type) +static void *ccgDM_get_tessface_data_layer(DerivedMesh *dm, int type) { if(type == CD_ORIGINDEX) { /* create origindex on demand to save memory */ @@ -2813,7 +2813,8 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, ccgdm->dm.getNumVerts = cgdm_getNumVerts; ccgdm->dm.getNumEdges = cgdm_getNumEdges; ccgdm->dm.getNumTessFaces = cgdm_getNumTessFaces; - ccgdm->dm.getNumFaces = cgdm_getNumTessFaces; + /* reuse of cgdm_getNumTessFaces is intentional here: subsurf polys are just created from tessfaces */ + ccgdm->dm.getNumPolys = cgdm_getNumTessFaces; ccgdm->dm.getNumGrids = ccgDM_getNumGrids; ccgdm->dm.getPBVH = ccgDM_getPBVH; @@ -2830,7 +2831,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, ccgdm->dm.copyPolyArray = ccgDM_copyFinalPolyArray; ccgdm->dm.getVertDataArray = ccgDM_get_vert_data_layer; ccgdm->dm.getEdgeDataArray = ccgDM_get_edge_data_layer; - ccgdm->dm.getTessFaceDataArray = ccgDM_get_face_data_layer; + ccgdm->dm.getTessFaceDataArray = ccgDM_get_tessface_data_layer; ccgdm->dm.getNumGrids = ccgDM_getNumGrids; ccgdm->dm.getGridSize = ccgDM_getGridSize; ccgdm->dm.getGridData = ccgDM_getGridData; diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 9c39a744db7..b2b151bd34d 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -103,7 +103,7 @@ void paintface_flush_flags(Object *ob) if ((index_array = CustomData_get_layer(&dm->polyData, CD_ORIGINDEX))) { polys = dm->getPolyArray(dm); - totpoly = dm->getNumFaces(dm); + totpoly = dm->getNumPolys(dm); /* loop over final derived polys */ for (i= 0; ilores_dm; ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); const int lvl= bkr->lvl; - const int tot_face= dm->getNumFaces(dm); + const int tot_face= dm->getNumTessFaces(dm); MVert *mvert= dm->getVertArray(dm); MFace *mface= dm->getTessFaceArray(dm); MTFace *mtface= dm->getTessFaceDataArray(dm, CD_MTFACE); @@ -817,7 +817,7 @@ static void count_images(MultiresBakeRender *bkr) bkr->image.first= bkr->image.last= NULL; bkr->tot_image= 0; - totface= dm->getNumFaces(dm); + totface= dm->getNumTessFaces(dm); for(a= 0; aid.flag&= ~LIB_DOIT; @@ -1134,7 +1134,7 @@ static void multiresbake_startjob(void *bkv, short *stop, short *do_update, floa DerivedMesh *dm= data->lores_dm; MTFace *mtface= CustomData_get_layer(&dm->faceData, CD_MTFACE); - clear_images(mtface, dm->getNumFaces(dm)); + clear_images(mtface, dm->getNumTessFaces(dm)); } } diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index d9418509830..38d99c084b3 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -79,7 +79,7 @@ static void stats_object(Object *ob, int sel, int totob, SceneStats *stats) if(dm) { totvert = dm->getNumVerts(dm); totedge = dm->getNumEdges(dm); - totface = dm->getNumFaces(dm); + totface = dm->getNumPolys(dm); stats->totvert += totvert*totob; stats->totedge += totedge*totob; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 4899a317223..877d04baa2c 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3644,7 +3644,7 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B return 1; } - if(dt>OB_WIRE && dm->getNumFaces(dm)) { + if(dt>OB_WIRE && dm->getNumTessFaces(dm)) { int glsl = draw_glsl_material(scene, ob, v3d, dt); GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL); @@ -5981,7 +5981,7 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base) int hasfaces= 0; if (dm) { - hasfaces= dm->getNumFaces(dm); + hasfaces= dm->getNumTessFaces(dm); } else { hasfaces= displist_has_faces(&ob->disp); } diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index b1460844213..9670f661d75 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -94,14 +94,14 @@ static DerivedMesh *get_quick_derivedMesh(DerivedMesh *derivedData, DerivedMesh { DerivedMesh *result = NULL; - if(derivedData->getNumFaces(derivedData) == 0 || dm->getNumFaces(dm) == 0) { + if(derivedData->getNumPolys(derivedData) == 0 || dm->getNumPolys(dm) == 0) { switch(operation) { case eBooleanModifierOp_Intersect: result = CDDM_new(0, 0, 0, 0, 0); break; case eBooleanModifierOp_Union: - if(derivedData->getNumFaces(derivedData)) result = derivedData; + if(derivedData->getNumPolys(derivedData)) result = derivedData; else result = CDDM_copy(dm, FALSE); break; diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index ff80823283c..63c83dcaf54 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -101,7 +101,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), const int maxVerts= dm->getNumVerts(dm); const int maxEdges= dm->getNumEdges(dm); - const int maxFaces= dm->getNumFaces(dm); + const int maxFaces= dm->getNumPolys(dm); if (!CDDM_Check(dm)) { result = CDDM_copy(dm, 0); @@ -118,7 +118,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), frac = (BKE_curframe(md->scene) - bmd->start) / bmd->length; CLAMP(frac, 0.0f, 1.0f); - numFaces = dm->getNumFaces(dm) * frac; + numFaces = dm->getNumPolys(dm) * frac; numEdges = dm->getNumEdges(dm) * frac; /* if there's at least one face, build based on faces */ diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 8c59ecd432b..fe17c39610f 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -71,7 +71,7 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3]) numVerts = dm->getNumVerts(dm); numEdges = dm->getNumEdges(dm); - numFaces = dm->getNumFaces(dm); + numFaces = dm->getNumPolys(dm); mpoly = CDDM_get_polys(dm); mvert = dm->getVertArray(dm); mloop = CDDM_get_loops(dm); @@ -208,7 +208,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, MPoly *mp, *mpoly, *orig_mpoly; const int numVerts = dm->getNumVerts(dm); const int numEdges = dm->getNumEdges(dm); - const int numFaces = dm->getNumFaces(dm); + const int numFaces = dm->getNumPolys(dm); int numLoops=0, newLoops=0, newFaces=0, newEdges=0; int j;