Sculpt: Fix box face sets not working for multires

This commit is contained in:
Joseph Eagar
2022-11-22 12:30:36 -08:00
parent df788ecfd9
commit acf8f6220d
2 changed files with 6 additions and 1 deletions

View File

@@ -710,6 +710,7 @@ typedef struct PBVHFaceIter {
int prim_index_;
const struct SubdivCCG *subdiv_ccg_;
const struct BMesh *bm;
CCGKey subdiv_key_;
int last_face_index_;
} PBVHFaceIter;

View File

@@ -3738,10 +3738,12 @@ void pbvh_face_iter_step(PBVHFaceIter *fd, bool do_step)
pbvh_face_iter_verts_reserve(fd, mp->totloop);
const MLoop *ml = fd->mloop_ + mp->loopstart;
const int grid_area = fd->subdiv_key_.grid_area;
for (int i = 0; i < mp->totloop; i++, ml++) {
if (fd->pbvh_type_ == PBVH_GRIDS) {
/* Grid corners. */
fd->verts[i].i = mp->loopstart + i;
fd->verts[i].i = (mp->loopstart + i) * grid_area + grid_area - 1;
}
else {
fd->verts[i].i = ml->v;
@@ -3771,6 +3773,8 @@ void BKE_pbvh_face_iter_init(PBVH *pbvh, PBVHNode *node, PBVHFaceIter *fd)
switch (BKE_pbvh_type(pbvh)) {
case PBVH_GRIDS:
fd->subdiv_ccg_ = pbvh->subdiv_ccg;
fd->subdiv_key_ = pbvh->gridkey;
ATTR_FALLTHROUGH;
case PBVH_FACES:
fd->mpoly_ = pbvh->mpoly;
fd->mloop_ = pbvh->mloop;