From a6056b870b1da9bf422920439897a5cf8616c925 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 23 Aug 2022 14:09:46 -0400 Subject: Fix T100494: Broken sculpt hide status undo/redo Caused by 2480b55f216c31 using the undo step indices instead of the indices of vertices in the mesh, causing the hide values to be swapped around randomly in the mesh. --- source/blender/editors/sculpt_paint/sculpt_undo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/sculpt_paint') diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 9a445359c4e..58d62fb2165 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -373,10 +373,11 @@ static bool sculpt_undo_restore_hidden(bContext *C, SculptUndoNode *unode, bool if (unode->maxvert) { for (int i = 0; i < unode->totvert; i++) { - if ((BLI_BITMAP_TEST(unode->vert_hidden, i) != 0) != hide_vert[i]) { + const int vert_index = unode->index[i]; + if ((BLI_BITMAP_TEST(unode->vert_hidden, i) != 0) != hide_vert[vert_index]) { BLI_BITMAP_FLIP(unode->vert_hidden, i); - hide_vert[unode->index[i]] = !hide_vert[i]; - modified_vertices[unode->index[i]] = true; + hide_vert[vert_index] = !hide_vert[vert_index]; + modified_vertices[vert_index] = true; } } } @@ -902,7 +903,6 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase .modified_hidden_vertices = modified_hidden_vertices, .modified_mask_vertices = modified_mask_vertices, .modified_color_vertices = modified_color_vertices, - }; BKE_pbvh_search_callback(ss->pbvh, NULL, NULL, update_cb_partial, &data); BKE_pbvh_update_bounds(ss->pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateRedraw); -- cgit v1.2.3