Revision: 39130
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39130
Author:   jwilkins
Date:     2011-08-07 11:49:58 +0000 (Sun, 07 Aug 2011)
Log Message:
-----------
Revision: 30847
Author: nicholasbishop
Date: 12:26:56 PM, Wednesday, July 28, 2010
Message:
== PBVH ==

* Some interface cleanups, should be no functional changes

----
Modified : /branches/soc-2010-nicolasbishop/source/blender/blenlib/BLI_pbvh.h
Modified : /branches/soc-2010-nicolasbishop/source/blender/blenlib/intern/pbvh.c
Modified : 
/branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_mask.c
Modified : 
/branches/soc-2010-nicolasbishop/source/blender/editors/sculpt_paint/paint_vertex.c
Modified : 
/branches/soc-2010-nicolasbishop/source/blender/gpu/intern/gpu_buffers.c

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h
    branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c
    branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c

Modified: branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h
===================================================================
--- branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h   2011-08-07 
11:13:56 UTC (rev 39129)
+++ branches/soc-2011-onion/source/blender/blenlib/BLI_pbvh.h   2011-08-07 
11:49:58 UTC (rev 39130)
@@ -154,7 +154,7 @@
 void BLI_pbvh_get_customdata(PBVH *pbvh, struct CustomData **vdata, struct 
CustomData **fdata);
 
 void BLI_pbvh_node_get_faces(PBVH *bvh, PBVHNode *node,
-                            struct MFace **faces, struct CustomData **fdata,
+                            struct MFace **faces,
                             int **face_indices, int **face_vert_indices,
                             int *totface);
 void BLI_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node,
@@ -163,7 +163,7 @@
 void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node,
        int *uniquevert, int *totvert);
 void BLI_pbvh_node_get_verts(PBVH *bvh, PBVHNode *node,
-                            int **vert_indices, struct MVert **verts, struct 
CustomData **vdata);
+                            int **vert_indices, struct MVert **verts);
 
 void BLI_pbvh_node_get_BB(PBVHNode *node, float bb_min[3], float bb_max[3]);
 void BLI_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float 
bb_max[3]);
@@ -246,7 +246,8 @@
                \
                BLI_pbvh_node_get_grids(bvh, node, &grid_indices, &totgrid, 
NULL, &gridsize, &grids, NULL, &gridkey); \
                BLI_pbvh_node_num_verts(bvh, node, &uniq_verts, &totvert); \
-               BLI_pbvh_node_get_verts(bvh, node, &vert_indices, &verts, 
&vi.vdata); \
+               BLI_pbvh_node_get_verts(bvh, node, &vert_indices, &verts); \
+               BLI_pbvh_get_customdata(bvh, &vi.vdata, NULL); \
                \
                vi.grids= grids; \
                vi.grid_indices= grid_indices; \

Modified: branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c
===================================================================
--- branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c        
2011-08-07 11:13:56 UTC (rev 39129)
+++ branches/soc-2011-onion/source/blender/blenlib/intern/pbvh.c        
2011-08-07 11:49:58 UTC (rev 39130)
@@ -1356,11 +1356,10 @@
        node->flag |= GET_INT_FROM_POINTER(data);
 }
 
-void BLI_pbvh_node_get_verts(PBVH *bvh, PBVHNode *node, int **vert_indices, 
MVert **verts, CustomData **vdata)
+void BLI_pbvh_node_get_verts(PBVH *bvh, PBVHNode *node, int **vert_indices, 
MVert **verts)
 {
        if(vert_indices) *vert_indices= node->vert_indices;
        if(verts) *verts= bvh->verts;
-       if(vdata) *vdata= bvh->vdata;
 }
 
 void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node, int *uniquevert, int 
*totvert)
@@ -1377,20 +1376,18 @@
 }
 
 void BLI_pbvh_node_get_faces(PBVH *bvh, PBVHNode *node,
-                            struct MFace **mface, struct CustomData **fdata,
+                            MFace **mface,
                             int **face_indices, int **face_vert_indices,
                             int *totnode)
 {
        if(bvh->grids) {
                if(mface) *mface= NULL;
-               if(fdata) *fdata= bvh->fdata;
                if(face_indices) *face_indices= NULL;
                if(face_vert_indices) *face_vert_indices= NULL;
                if(totnode) *totnode= 0;
        }
        else {
                if(mface) *mface= bvh->faces;
-               if(fdata) *fdata= bvh->fdata;
                if(face_indices) *face_indices= node->prim_indices;
                if(face_vert_indices) *face_vert_indices= 
node->face_vert_indices;
                if(totnode) *totnode= node->totprim;

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c    
2011-08-07 11:13:56 UTC (rev 39129)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_mask.c    
2011-08-07 11:49:58 UTC (rev 39130)
@@ -360,7 +360,7 @@
                        if(ob->mode & OB_MODE_SCULPT) // TODO
                                sculpt_undo_push_node(ob, nodes[n]);
 
-                       BLI_pbvh_node_get_faces(pbvh, nodes[n], &mface, NULL,
+                       BLI_pbvh_node_get_faces(pbvh, nodes[n], &mface,
                                &face_indices, NULL, &totface);
 
                        for(i = 0; i < totface; ++i) {

Modified: 
branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c  
2011-08-07 11:13:56 UTC (rev 39129)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_vertex.c  
2011-08-07 11:49:58 UTC (rev 39130)
@@ -2009,44 +2009,30 @@
        int n;
 
        for(n = 0; n < totnode; ++n) {
-               DerivedMesh *dm;
-               ListBase *fmap;
-
-               MVert *mvert;
-               MFace *mface;
                CustomData *vdata = NULL;
                CustomData *fdata = NULL;
-               int *face_indices, totface;
 
-               DMGridData **grids;
-               GridKey *gridkey;
-               int *grid_indices, totgrid, gridsize;
+               BLI_pbvh_get_customdata(pbvh, &vdata, &fdata);
 
-               BLI_pbvh_node_get_verts(pbvh, nodes[n], NULL, &mvert, &vdata);
+               if (BLI_pbvh_uses_grids(pbvh)) {
+                       DMGridData **grids;
+                       GridKey *gridkey;
+                       int *grid_indices, totgrid, gridsize;
+                       int active;
 
-               BLI_pbvh_node_get_faces(
-                       pbvh,
-                       nodes[n],
-                       &mface,
-                       &fdata,
-                       &face_indices,
-                       NULL,
-                       &totface);
+                       BLI_pbvh_node_get_grids(
+                               pbvh,
+                               nodes[n],
+                               &grid_indices,
+                               &totgrid,
+                               NULL,
+                               &gridsize,
+                               &grids,
+                               NULL,
+                               &gridkey);
 
-               BLI_pbvh_node_get_grids(
-                       pbvh,
-                       nodes[n],
-                       &grid_indices,
-                       &totgrid,
-                       NULL,
-                       &gridsize,
-                       &grids,
-                       NULL,
-                       &gridkey);
+                       active= vpaint_find_gridkey_active_layer(fdata, 
gridkey);
 
-               if (grids) {
-                       int active= vpaint_find_gridkey_active_layer(fdata, 
gridkey);
-
                        if(active != -1) {
                                if(blur) {
                                        vpaint_nodes_grids_smooth(
@@ -2084,37 +2070,47 @@
                                }
                        }
                }
-               else if (blur) {
-                       dm= mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
-                       fmap= dm->getFaceMap ? dm->getFaceMap(ob, dm) : NULL;
+               else {
+                       MVert *mvert;
+                       MFace *mface;
+                       int *face_indices, totface;
 
-                       vpaint_nodes_faces_smooth(
-                               brush,
-                               bspace,
-                               stroke,
-                               pbvh,
-                               nodes[n],
-                               mface,
-                               fdata,
-                               fmap,
-                               center,
-                               radius,
-                               radius*radius);
+                       BLI_pbvh_node_get_verts(pbvh, nodes[n], NULL, &mvert);
+                       BLI_pbvh_node_get_faces(pbvh, nodes[n], &mface,
+                                               &face_indices, NULL, &totface);
+
+                       if(blur) {
+                               DerivedMesh *dm= mesh_get_derived_final(scene, 
ob, CD_MASK_BAREMESH);
+                               ListBase *fmap= dm->getFaceMap ? 
dm->getFaceMap(ob, dm) : NULL;
+
+                               vpaint_nodes_faces_smooth(
+                                       brush,
+                                       bspace,
+                                       stroke,
+                                       pbvh,
+                                       nodes[n],
+                                       mface,
+                                       fdata,
+                                       fmap,
+                                       center,
+                                       radius,
+                                       radius*radius);
+                       }
+                       else {
+                               vpaint_nodes_faces(
+                                       brush,
+                                       bspace,
+                                       stroke,
+                                       mface,
+                                       mvert,
+                                       vdata,
+                                       fdata,
+                                       face_indices,
+                                       totface,
+                                       center,
+                                       radius);
+                       }
                }
-               else {
-                       vpaint_nodes_faces(
-                               brush,
-                               bspace,
-                               stroke,
-                               mface,
-                               mvert,
-                               vdata,
-                               fdata,
-                               face_indices,
-                               totface,
-                               center,
-                               radius);
-               }
 
                BLI_pbvh_node_set_flags(
                        nodes[n],
@@ -2217,24 +2213,30 @@
                        mouse,
                        0))
        {
-               DMGridData **grids;
-               GridKey *gridkey;
-               MFace *mface;
+               PBVH *pbvh = vc->obact->paint->pbvh;
                CustomData *fdata;
-               int *face_indices, *grid_indices, gridsize;
 
-               BLI_pbvh_node_get_faces(vc->obact->paint->pbvh, 
custom_data.node,
-                                       &mface, &fdata, &face_indices,
-                                       NULL, NULL);
-               BLI_pbvh_node_get_grids(vc->obact->paint->pbvh, 
custom_data.node,
-                                       &grid_indices,
-                                       NULL, NULL, &gridsize, &grids,
-                                       NULL, &gridkey);
+               BLI_pbvh_get_customdata(pbvh, NULL, &fdata);
 
-               if(grids) {
-                       int active = vpaint_find_gridkey_active_layer(fdata,
-                                                                     gridkey);
+               if(BLI_pbvh_uses_grids(pbvh)) {
+                       DMGridData **grids;
+                       GridKey *gridkey;
+                       int *grid_indices, gridsize;
+                       int active;
 
+                       BLI_pbvh_node_get_grids(
+                               pbvh,
+                               custom_data.node,
+                               &grid_indices,
+                               NULL,
+                               NULL,
+                               &gridsize,
+                               &grids,
+                               NULL,
+                               &gridkey);
+
+                       active= vpaint_find_gridkey_active_layer(fdata, 
gridkey);
+
                        if(active != -1) {
                                vpaint_color_single_gridelem(
                                        brush,
@@ -2248,14 +2250,29 @@
                        }
                }
                else {
-                       vpaint_color_single_face(brush, stroke, mface, fdata,
-                                face_indices,
-                                custom_data.hit_index);
+                       MFace *mface;
+                       int *face_indices;
+
+                       BLI_pbvh_node_get_faces(
+                               pbvh,
+                               custom_data.node,
+                               &mface,
+                               &face_indices,
+                               NULL,
+                               NULL);
+
+                       vpaint_color_single_face(
+                               brush,
+                               stroke,
+                               mface,
+                               fdata,
+                               face_indices,
+                               custom_data.hit_index);
                }
 
-               BLI_pbvh_node_set_flags(custom_data.node,
-                       SET_INT_IN_POINTER(PBVH_UpdateColorBuffers|
-                                          PBVH_UpdateRedraw));
+               BLI_pbvh_node_set_flags(
+                       custom_data.node,
+                       
SET_INT_IN_POINTER(PBVH_UpdateColorBuffers|PBVH_UpdateRedraw));
        }
 }
 

Modified: branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c
===================================================================
--- branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c     
2011-08-07 11:13:56 UTC (rev 39129)
+++ branches/soc-2011-onion/source/blender/gpu/intern/gpu_buffers.c     
2011-08-07 11:49:58 UTC (rev 39130)
@@ -1374,9 +1374,10 @@
        if(!buffers->vert_buf)
                return;
 
+       BLI_pbvh_get_customdata(bvh, &vdata, &fdata);
        BLI_pbvh_node_num_verts(bvh, node, NULL, &totvert);
-       BLI_pbvh_node_get_verts(bvh, node, &vert_indices, NULL, &vdata);
-       BLI_pbvh_node_get_faces(bvh, node, &mface, &fdata, &face_indices,
+       BLI_pbvh_node_get_verts(bvh, node, &vert_indices, NULL);
+       BLI_pbvh_node_get_faces(bvh, node, &mface, &face_indices,
                                &face_vert_indices, &totface);
 
        mcol_totlayer = CustomData_number_of_layers(fdata, CD_MCOL);
@@ -1848,8 +1849,8 @@
                int totface, *face_indices;
                int j, mcol_totlayer, pmask_totlayer;
 
-               BLI_pbvh_node_get_verts(pbvh, node, NULL, &mvert, NULL);
-               BLI_pbvh_node_get_faces(pbvh, node, &mface, NULL, 
&face_indices, NULL, &totface);
+               BLI_pbvh_node_get_verts(pbvh, node, NULL, &mvert);
+               BLI_pbvh_node_get_faces(pbvh, node, &mface, &face_indices, 
NULL, &totface);
 
                if(mcol_first_layer)
                        mcol_totlayer = CustomData_number_of_layers(fdata, 
CD_MCOL);

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

Reply via email to