diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-07-10 21:39:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-07-10 21:39:27 +0300 |
commit | f3d5af41725989506474fec32d093d8ecf06403a (patch) | |
tree | 0a03bc1030d0898427bb2c1fbad21a32804904d1 /source/blender/blenkernel/intern/mesh.c | |
parent | 0875cb07cce53610bdfce3ed486ac5b2ced5bc5c (diff) |
Cleanup: use const for mesh functions
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 37a98eae58b..f7bedc3c9f9 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -1175,9 +1175,10 @@ static void make_edges_mdata_extend(MEdge **r_alledge, int *r_totedge, /* Initialize mverts, medges and, faces for converting nurbs to mesh and derived mesh */ /* return non-zero on error */ -int BKE_mesh_nurbs_to_mdata(Object *ob, MVert **allvert, int *totvert, - MEdge **alledge, int *totedge, MLoop **allloop, MPoly **allpoly, - int *totloop, int *totpoly) +int BKE_mesh_nurbs_to_mdata( + Object *ob, MVert **r_allvert, int *r_totvert, + MEdge **r_alledge, int *r_totedge, MLoop **r_allloop, MPoly **r_allpoly, + int *r_totloop, int *r_totpoly) { ListBase disp = {NULL, NULL}; @@ -1185,11 +1186,12 @@ int BKE_mesh_nurbs_to_mdata(Object *ob, MVert **allvert, int *totvert, disp = ob->curve_cache->disp; } - return BKE_mesh_nurbs_displist_to_mdata(ob, &disp, - allvert, totvert, - alledge, totedge, - allloop, allpoly, NULL, - totloop, totpoly); + return BKE_mesh_nurbs_displist_to_mdata( + ob, &disp, + r_allvert, r_totvert, + r_alledge, r_totedge, + r_allloop, r_allpoly, NULL, + r_totloop, r_totpoly); } /* BMESH: this doesn't calculate all edges from polygons, @@ -1197,12 +1199,13 @@ int BKE_mesh_nurbs_to_mdata(Object *ob, MVert **allvert, int *totvert, /* Initialize mverts, medges and, faces for converting nurbs to mesh and derived mesh */ /* use specified dispbase */ -int BKE_mesh_nurbs_displist_to_mdata(Object *ob, ListBase *dispbase, - MVert **allvert, int *_totvert, - MEdge **alledge, int *_totedge, - MLoop **allloop, MPoly **allpoly, - MLoopUV **alluv, - int *_totloop, int *_totpoly) +int BKE_mesh_nurbs_displist_to_mdata( + Object *ob, const ListBase *dispbase, + MVert **r_allvert, int *r_totvert, + MEdge **r_alledge, int *r_totedge, + MLoop **r_allloop, MPoly **r_allpoly, + MLoopUV **r_alluv, + int *r_totloop, int *r_totpoly) { Curve *cu = ob->data; DispList *dl; @@ -1253,13 +1256,13 @@ int BKE_mesh_nurbs_displist_to_mdata(Object *ob, ListBase *dispbase, return -1; } - *allvert = mvert = MEM_callocN(sizeof(MVert) * totvert, "nurbs_init mvert"); - *alledge = medge = MEM_callocN(sizeof(MEdge) * totedge, "nurbs_init medge"); - *allloop = mloop = MEM_callocN(sizeof(MLoop) * totvlak * 4, "nurbs_init mloop"); // totloop - *allpoly = mpoly = MEM_callocN(sizeof(MPoly) * totvlak, "nurbs_init mloop"); + *r_allvert = mvert = MEM_callocN(sizeof(MVert) * totvert, "nurbs_init mvert"); + *r_alledge = medge = MEM_callocN(sizeof(MEdge) * totedge, "nurbs_init medge"); + *r_allloop = mloop = MEM_callocN(sizeof(MLoop) * totvlak * 4, "nurbs_init mloop"); // totloop + *r_allpoly = mpoly = MEM_callocN(sizeof(MPoly) * totvlak, "nurbs_init mloop"); - if (alluv) - *alluv = mloopuv = MEM_callocN(sizeof(MLoopUV) * totvlak * 4, "nurbs_init mloopuv"); + if (r_alluv) + *r_alluv = mloopuv = MEM_callocN(sizeof(MLoopUV) * totvlak * 4, "nurbs_init mloopuv"); /* verts and faces */ vertcount = 0; @@ -1332,7 +1335,7 @@ int BKE_mesh_nurbs_displist_to_mdata(Object *ob, ListBase *dispbase, mloop[0].v = startvert + index[0]; mloop[1].v = startvert + index[2]; mloop[2].v = startvert + index[1]; - mpoly->loopstart = (int)(mloop - (*allloop)); + mpoly->loopstart = (int)(mloop - (*r_allloop)); mpoly->totloop = 3; mpoly->mat_nr = dl->col; @@ -1390,7 +1393,7 @@ int BKE_mesh_nurbs_displist_to_mdata(Object *ob, ListBase *dispbase, mloop[1].v = p3; mloop[2].v = p4; mloop[3].v = p2; - mpoly->loopstart = (int)(mloop - (*allloop)); + mpoly->loopstart = (int)(mloop - (*r_allloop)); mpoly->totloop = 4; mpoly->mat_nr = dl->col; @@ -1440,14 +1443,14 @@ int BKE_mesh_nurbs_displist_to_mdata(Object *ob, ListBase *dispbase, } if (totvlak) { - make_edges_mdata_extend(alledge, &totedge, - *allpoly, *allloop, totvlak); + make_edges_mdata_extend(r_alledge, &totedge, + *r_allpoly, *r_allloop, totvlak); } - *_totpoly = totvlak; - *_totloop = totloop; - *_totedge = totedge; - *_totvert = totvert; + *r_totpoly = totvlak; + *r_totloop = totloop; + *r_totedge = totedge; + *r_totvert = totvert; return 0; } @@ -1871,8 +1874,9 @@ int poly_find_loop_from_vert( * vertex is not in \a poly */ int poly_get_adj_loops_from_vert( - unsigned r_adj[2], const MPoly *poly, - const MLoop *mloop, unsigned vert) + const MPoly *poly, + const MLoop *mloop, unsigned int vert, + unsigned int r_adj[2]) { int corner = poly_find_loop_from_vert(poly, &mloop[poly->loopstart], @@ -1906,7 +1910,7 @@ int BKE_mesh_edge_other_vert(const MEdge *e, int v) } /* basic vertex data functions */ -bool BKE_mesh_minmax(Mesh *me, float r_min[3], float r_max[3]) +bool BKE_mesh_minmax(const Mesh *me, float r_min[3], float r_max[3]) { int i = me->totvert; MVert *mvert; |