[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34999] trunk/blender/source/blender: Fix for crash when sculpting on multires object during playback
Sergey Sharybin
g.ulairi at gmail.com
Sun Feb 20 16:35:03 CET 2011
Revision: 34999
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34999
Author: nazgul
Date: 2011-02-20 15:35:01 +0000 (Sun, 20 Feb 2011)
Log Message:
-----------
Fix for crash when sculpting on multires object during playback
- Restored BLI_pbvh_grids_update stuff;
- Marc all nodes as changes in ED_sculpt_modifiers_changed, so
draw_buffers would be keept correct.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c
trunk/blender/source/blender/blenlib/BLI_pbvh.h
trunk/blender/source/blender/blenlib/intern/pbvh.c
trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
Modified: trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c 2011-02-19 23:51:55 UTC (rev 34998)
+++ trunk/blender/source/blender/blenkernel/intern/subsurf_ccg.c 2011-02-20 15:35:01 UTC (rev 34999)
@@ -2251,8 +2251,16 @@
if(!ob->sculpt)
return NULL;
- if(ob->sculpt->pbvh)
+ if(ob->sculpt->pbvh) {
+ /* pbvh's grids, gridadj and gridfaces points to data inside ccgdm
+ but this can be freed on ccgdm release, this updates the pointers
+ when the ccgdm gets remade, the assumption is that the topology
+ does not change. */
+ ccgdm_create_grids(dm);
+ BLI_pbvh_grids_update(ob->sculpt->pbvh, ccgdm->gridData, ccgdm->gridAdjacency, (void**)ccgdm->gridFaces);
+
ccgdm->pbvh = ob->sculpt->pbvh;
+ }
if(ccgdm->pbvh)
return ccgdm->pbvh;
Modified: trunk/blender/source/blender/blenlib/BLI_pbvh.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_pbvh.h 2011-02-19 23:51:55 UTC (rev 34998)
+++ trunk/blender/source/blender/blenlib/BLI_pbvh.h 2011-02-20 15:35:01 UTC (rev 34999)
@@ -121,6 +121,8 @@
void BLI_pbvh_update(PBVH *bvh, int flags, float (*face_nors)[3]);
void BLI_pbvh_redraw_BB(PBVH *bvh, float bb_min[3], float bb_max[3]);
void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *totface);
+void BLI_pbvh_grids_update(PBVH *bvh, struct DMGridData **grids,
+ struct DMGridAdjacency *gridadj, void **gridfaces);;
/* vertex deformer */
float (*BLI_pbvh_get_vertCos(struct PBVH *pbvh))[3];
Modified: trunk/blender/source/blender/blenlib/intern/pbvh.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/pbvh.c 2011-02-19 23:51:55 UTC (rev 34998)
+++ trunk/blender/source/blender/blenlib/intern/pbvh.c 2011-02-20 15:35:01 UTC (rev 34999)
@@ -1475,6 +1475,13 @@
}
}
+void BLI_pbvh_grids_update(PBVH *bvh, DMGridData **grids, DMGridAdjacency *gridadj, void **gridfaces)
+{
+ bvh->grids= grids;
+ bvh->gridadj= gridadj;
+ bvh->gridfaces= gridfaces;
+}
+
float (*BLI_pbvh_get_vertCos(PBVH *pbvh))[3]
{
int a;
Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2011-02-19 23:51:55 UTC (rev 34998)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c 2011-02-20 15:35:01 UTC (rev 34999)
@@ -109,6 +109,16 @@
}
sculpt_free_deformMats(ob->sculpt);
+ } else {
+ PBVHNode **nodes;
+ int n, totnode;
+
+ BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
+
+ for(n = 0; n < totnode; n++)
+ BLI_pbvh_node_mark_update(nodes[n]);
+
+ MEM_freeN(nodes);
}
}
More information about the Bf-blender-cvs
mailing list