Sculpt dyntopo: yet another undo bug

BKE_pbvh_bmesh_add_face had a branch where it ignored
the log_face argument, leading to corruption in
BMLog.
This commit is contained in:
Joseph Eagar 2021-08-17 14:58:37 -07:00
parent 83f94ebb6f
commit 106f542ac4
2 changed files with 23 additions and 1 deletions

View File

@ -748,6 +748,10 @@ void BKE_pbvh_bmesh_add_face(PBVH *pbvh, struct BMFace *f, bool log_face, bool f
if (force_tree_walk) {
bke_pbvh_insert_face(pbvh, f);
if (log_face) {
BM_log_face_added(pbvh->bm_log, f);
}
return;
}
@ -1462,6 +1466,8 @@ static void short_edge_queue_task_cb(void *__restrict userdata,
static bool check_face_is_tri(PBVH *pbvh, BMFace *f)
{
bool origlen = f->len;
if (f->len == 3) {
return true;
}
@ -1519,7 +1525,12 @@ static bool check_face_is_tri(PBVH *pbvh, BMFace *f)
}
}
if (dbl->link == f) {
f = NULL;
}
BM_face_kill(pbvh->bm, dbl->link);
MEM_freeN(dbl);
dbl = next;
}
@ -1539,7 +1550,9 @@ static bool check_face_is_tri(PBVH *pbvh, BMFace *f)
BKE_pbvh_bmesh_add_face(pbvh, f2, true, true);
}
BKE_pbvh_bmesh_add_face(pbvh, f, true, true);
if (f) {
BKE_pbvh_bmesh_add_face(pbvh, f, true, true);
}
BLI_array_free(fs);
BLI_array_free(es);

View File

@ -488,6 +488,11 @@ static void bm_log_verts_unmake_pre(
continue;
}
if (v->head.htype != BM_VERT) {
printf("bm_log error; vertex id: %p, type was: %d\n", key, v->head.htype);
continue;
}
/* Ensure the log has the final values of the vertex before
* deleting it */
bm_log_vert_bmvert_copy(log, entry, lv, v, cd_vert_mask_offset, true);
@ -653,6 +658,10 @@ static void bm_log_faces_restore(
continue;
}
if (v->head.htype != BM_VERT) {
printf("bm_log corruption!\n");
continue;
}
BLI_array_append(vs_tmp, v);
}