Fix T62271: Particles with multires crash on sculpt
In fact, any modifier on top of multires would lead to crash. Was missing pointer update. Basically, bring the control flow closer to 2.7.
This commit is contained in:
parent
594f2b8016
commit
967d82d9b9
|
@ -56,6 +56,7 @@ struct UnifiedPaintSettings;
|
|||
struct ViewLayer;
|
||||
struct bContext;
|
||||
struct bToolRef;
|
||||
struct SubdivCCG;
|
||||
|
||||
enum eOverlayFlags;
|
||||
|
||||
|
@ -287,6 +288,8 @@ void BKE_sculpt_toolsettings_data_ensure(struct Scene *scene);
|
|||
|
||||
struct PBVH *BKE_sculpt_object_pbvh_ensure(struct Depsgraph *depsgraph, struct Object *ob);
|
||||
|
||||
void BKE_sculpt_bvh_update_from_ccg(struct PBVH *pbvh, struct SubdivCCG *subdiv_ccg);
|
||||
|
||||
enum {
|
||||
SCULPT_MASK_LAYER_CALC_VERT = (1 << 0),
|
||||
SCULPT_MASK_LAYER_CALC_LOOP = (1 << 1),
|
||||
|
|
|
@ -1381,7 +1381,16 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
|
|||
}
|
||||
PBVH *pbvh = ob->sculpt->pbvh;
|
||||
if (pbvh != NULL) {
|
||||
/* Nothing to do, PBVH is already up to date. */
|
||||
/* NOTE: It is possible that grids were re-allocated due to modifier
|
||||
* stack. Need to update those pointers. */
|
||||
if (BKE_pbvh_type(pbvh) == PBVH_GRIDS) {
|
||||
Object *object_eval = DEG_get_evaluated_object(depsgraph, ob);
|
||||
Mesh *mesh_eval = object_eval->data;
|
||||
SubdivCCG *subdiv_ccg = mesh_eval->runtime.subdiv_ccg;
|
||||
if (subdiv_ccg != NULL) {
|
||||
BKE_sculpt_bvh_update_from_ccg(pbvh, subdiv_ccg);
|
||||
}
|
||||
}
|
||||
return pbvh;
|
||||
}
|
||||
|
||||
|
@ -1405,3 +1414,9 @@ PBVH *BKE_sculpt_object_pbvh_ensure(Depsgraph *depsgraph, Object *ob)
|
|||
ob->sculpt->pbvh = pbvh;
|
||||
return pbvh;
|
||||
}
|
||||
|
||||
void BKE_sculpt_bvh_update_from_ccg(PBVH *pbvh, SubdivCCG *subdiv_ccg)
|
||||
{
|
||||
BKE_pbvh_grids_update(pbvh, subdiv_ccg->grids, (void **)subdiv_ccg->grid_faces,
|
||||
subdiv_ccg->grid_flag_mats, subdiv_ccg->grid_hidden);
|
||||
}
|
||||
|
|
|
@ -164,6 +164,7 @@ static void sculpt_update_pbvh_normals(Object *object)
|
|||
if (pbvh == NULL || subdiv_ccg == NULL) {
|
||||
return;
|
||||
}
|
||||
BKE_sculpt_bvh_update_from_ccg(pbvh, subdiv_ccg);
|
||||
struct CCGFace **faces;
|
||||
int num_faces;
|
||||
BKE_pbvh_get_grid_updates(pbvh, 1, (void ***)&faces, &num_faces);
|
||||
|
|
Loading…
Reference in New Issue