Sculpt: Fix T102209: Multiresolution levels greater than 6 crashes

pbvh->leaf_limit needs to be at least 4 to split nodes
original face boundaries properly.
This commit is contained in:
Joseph Eagar 2022-11-10 11:49:39 -08:00
parent cad11f3098
commit b2000412f2
Notes: blender-bot 2023-02-13 14:07:33 +01:00
Referenced by issue #102209, Regression: Blender crashes in Sculpt Mode when subdividing with the Multiresmodifier to level 7
1 changed files with 6 additions and 1 deletions

View File

@ -833,7 +833,12 @@ void BKE_pbvh_build_grids(PBVH *pbvh,
pbvh->gridkey = *key;
pbvh->grid_hidden = grid_hidden;
pbvh->subdiv_ccg = subdiv_ccg;
pbvh->leaf_limit = max_ii(LEAF_LIMIT / (gridsize * gridsize), 1);
/* Ensure leaf limit is at least 4 so there's room
* to split at original face boundaries.
* Fixes T102209.
*/
pbvh->leaf_limit = max_ii(LEAF_LIMIT / (gridsize * gridsize), 4);
/* We need the base mesh attribute layout for PBVH draw. */
pbvh->vdata = &me->vdata;