Fix #33116: Blender Crashes when saving inside Sculpt Mode with with GLSL and textured view enabled.
Issue was caused by call ED_sculpt_force_update from WM_file_write which frees derived mesh and pBVH and forces them to be re-created. After this sculpt session wasn't repairing properly. Freeing data from WM_file_write is not nice by itself, but it exposed possible real issue when sculpting on modifiers. Made it so BLI_pbvh_grids_update will update pointers to material flags and hidden grids as well. This isn't idea solution for particular circumstances from the report, since pBVH would be rebuilt after save which ends up with small interface lags for while pBVH is rebuilding. Would be nice to have multires displacement propagation to higher levels without freeing data.
This commit is contained in:
@@ -3025,7 +3025,8 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
|
||||
* 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);
|
||||
BLI_pbvh_grids_update(ob->sculpt->pbvh, ccgdm->gridData, ccgdm->gridAdjacency, (void **)ccgdm->gridFaces,
|
||||
ccgdm->gridFlagMats, ccgdm->gridHidden);
|
||||
}
|
||||
|
||||
ccgdm->pbvh = ob->sculpt->pbvh;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
#include "BLI_bitmap.h"
|
||||
|
||||
struct BLI_bitmap;
|
||||
struct CCGElem;
|
||||
struct CCGKey;
|
||||
struct CustomData;
|
||||
@@ -153,7 +154,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 CCGElem **grid_elems,
|
||||
struct DMGridAdjacency *gridadj, void **gridfaces);
|
||||
struct DMGridAdjacency *gridadj, void **gridfaces,
|
||||
struct DMFlagMat *flagmats, struct BLI_bitmap *grid_hidden);
|
||||
|
||||
/* vertex deformer */
|
||||
float (*BLI_pbvh_get_vertCos(struct PBVH *pbvh))[3];
|
||||
|
||||
@@ -1707,11 +1707,14 @@ void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
|
||||
}
|
||||
}
|
||||
|
||||
void BLI_pbvh_grids_update(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj, void **gridfaces)
|
||||
void BLI_pbvh_grids_update(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj, void **gridfaces,
|
||||
DMFlagMat *flagmats, BLI_bitmap *grid_hidden)
|
||||
{
|
||||
bvh->grids = grids;
|
||||
bvh->gridadj = gridadj;
|
||||
bvh->gridfaces = gridfaces;
|
||||
bvh->grid_flag_mats = flagmats;
|
||||
bvh->grid_hidden = grid_hidden;
|
||||
}
|
||||
|
||||
float (*BLI_pbvh_get_vertCos(PBVH * pbvh))[3]
|
||||
|
||||
Reference in New Issue
Block a user