[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44341] trunk/blender/source/blender/ blenlib: Code cleanup: move the PBVH iterator' s initialization into a function.
Nicholas Bishop
nicholasbishop at gmail.com
Wed Feb 22 23:37:11 CET 2012
Revision: 44341
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44341
Author: nicholasbishop
Date: 2012-02-22 22:37:01 +0000 (Wed, 22 Feb 2012)
Log Message:
-----------
Code cleanup: move the PBVH iterator's initialization into a function.
Should be no functional changes, just shortens the amount of code
living in the macro.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_pbvh.h
trunk/blender/source/blender/blenlib/intern/pbvh.c
Modified: trunk/blender/source/blender/blenlib/BLI_pbvh.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_pbvh.h 2012-02-22 20:31:19 UTC (rev 44340)
+++ trunk/blender/source/blender/blenlib/BLI_pbvh.h 2012-02-22 22:37:01 UTC (rev 44341)
@@ -171,34 +171,11 @@
#pragma warning (disable:4127) // conditional expression is constant
#endif
+void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
+ PBVHVertexIter *vi, int mode);
+
#define BLI_pbvh_vertex_iter_begin(bvh, node, vi, mode) \
- { \
- struct DMGridData **grids; \
- struct MVert *verts; \
- int *grid_indices, totgrid, gridsize, *vert_indices, uniq_verts, totvert; \
- \
- vi.grid= 0; \
- vi.no= 0; \
- vi.fno= 0; \
- vi.mvert= 0; \
- vi.skip= 0; \
- \
- BLI_pbvh_node_get_grids(bvh, node, &grid_indices, &totgrid, NULL, &gridsize, &grids, NULL); \
- BLI_pbvh_node_num_verts(bvh, node, &uniq_verts, &totvert); \
- BLI_pbvh_node_get_verts(bvh, node, &vert_indices, &verts); \
- \
- vi.grids= grids; \
- vi.grid_indices= grid_indices; \
- vi.totgrid= (grids)? totgrid: 1; \
- vi.gridsize= gridsize; \
- \
- if(mode == PBVH_ITER_ALL) \
- vi.totvert = totvert; \
- else \
- vi.totvert= uniq_verts; \
- vi.vert_indices= vert_indices; \
- vi.mverts= verts; \
- }\
+ pbvh_vertex_iter_init(bvh, node, &vi, mode); \
\
for(vi.i=0, vi.g=0; vi.g<vi.totgrid; vi.g++) { \
if(vi.grids) { \
Modified: trunk/blender/source/blender/blenlib/intern/pbvh.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/pbvh.c 2012-02-22 20:31:19 UTC (rev 44340)
+++ trunk/blender/source/blender/blenlib/intern/pbvh.c 2012-02-22 22:37:01 UTC (rev 44341)
@@ -1683,3 +1683,34 @@
*r_array= array;
*r_tot= tot;
}
+
+void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
+ PBVHVertexIter *vi, int mode)
+{
+ struct DMGridData **grids;
+ struct MVert *verts;
+ int *grid_indices, *vert_indices;
+ int totgrid, gridsize, uniq_verts, totvert;
+
+ vi->grid= 0;
+ vi->no= 0;
+ vi->fno= 0;
+ vi->mvert= 0;
+ vi->skip= 0;
+
+ BLI_pbvh_node_get_grids(bvh, node, &grid_indices, &totgrid, NULL, &gridsize, &grids, NULL);
+ BLI_pbvh_node_num_verts(bvh, node, &uniq_verts, &totvert);
+ BLI_pbvh_node_get_verts(bvh, node, &vert_indices, &verts);
+
+ vi->grids= grids;
+ vi->grid_indices= grid_indices;
+ vi->totgrid= (grids)? totgrid: 1;
+ vi->gridsize= gridsize;
+
+ if(mode == PBVH_ITER_ALL)
+ vi->totvert = totvert;
+ else
+ vi->totvert= uniq_verts;
+ vi->vert_indices= vert_indices;
+ vi->mverts= verts;
+}
More information about the Bf-blender-cvs
mailing list