Sculpt: fix multi-res crash

This commit is contained in:
Joseph Eagar 2021-10-06 03:10:57 -07:00
parent f6a8d745c2
commit 88efbf7d1e
1 changed files with 18 additions and 0 deletions

View File

@ -1836,6 +1836,22 @@ static void sculpt_update_object(Depsgraph *depsgraph,
}
}
}
int totvert = 0;
switch (BKE_pbvh_type(pbvh)) {
case PBVH_FACES:
totvert = me->totvert;
break;
case PBVH_BMESH:
totvert = ss->bm ? ss->bm->totvert : me->totvert;
break;
case PBVH_GRIDS:
totvert = BKE_pbvh_get_grid_num_vertices(ss->pbvh);
break;
}
BKE_sculptsession_check_mdyntopo(ob->sculpt, pbvh, totvert);
}
void BKE_sculpt_update_object_before_eval(Object *ob)
@ -2311,6 +2327,8 @@ bool BKE_sculptsession_check_mdyntopo(SculptSession *ss, PBVH *pbvh, int totvert
return true;
}
BKE_pbvh_set_mdyntopo_verts(pbvh, ss->mdyntopo_verts);
return false;
}