Revision: 46518
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46518
Author:   nicholasbishop
Date:     2012-05-10 20:33:45 +0000 (Thu, 10 May 2012)
Log Message:
-----------
Add paint mask access to the PBVH vertex iterator.

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-05-10 20:33:36 UTC 
(rev 46517)
+++ trunk/blender/source/blender/blenlib/BLI_pbvh.h     2012-05-10 20:33:45 UTC 
(rev 46518)
@@ -191,6 +191,7 @@
        struct MVert *mverts;
        int totvert;
        int *vert_indices;
+       float *vmask;
 
        /* result: these are all computed in the macro, but we assume
         * that compiler optimization's will skip the ones we don't use */
@@ -198,6 +199,7 @@
        float *co;
        short *no;
        float *fno;
+       float *mask;
 } PBVHVertexIter;
 
 #ifdef _MSC_VER
@@ -228,6 +230,7 @@
                                if(vi.grid) { \
                                        vi.co= CCG_elem_co(vi.key, vi.grid); \
                                        vi.fno= CCG_elem_no(vi.key, vi.grid); \
+                                       vi.mask= CCG_elem_mask(vi.key, 
vi.grid); \
                                        vi.grid= CCG_elem_next(vi.key, 
vi.grid); \
                                        if(vi.gh) { \
                                                if(BLI_BITMAP_GET(vi.gh, vi.gy 
* vi.gridsize + vi.gx)) \
@@ -240,6 +243,8 @@
                                                continue; \
                                        vi.co= vi.mvert->co; \
                                        vi.no= vi.mvert->no; \
+                                       if(vi.vmask) \
+                                               vi.mask= 
&vi.vmask[vi.vert_indices[vi.gx]]; \
                                } \
 
 #define BLI_pbvh_vertex_iter_end \

Modified: trunk/blender/source/blender/blenlib/intern/pbvh.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/pbvh.c  2012-05-10 20:33:36 UTC 
(rev 46517)
+++ trunk/blender/source/blender/blenlib/intern/pbvh.c  2012-05-10 20:33:45 UTC 
(rev 46518)
@@ -1885,4 +1885,8 @@
        vi->gh= NULL;
        if (vi->grids && mode == PBVH_ITER_UNIQUE)
                vi->grid_hidden= bvh->grid_hidden;
+
+       vi->mask= NULL;
+       if(!vi->grids)
+               vi->vmask= CustomData_get_layer(bvh->vdata, CD_PAINT_MASK);
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to