Fix T100494: Broken sculpt hide status undo/redo
Caused by 2480b55f21
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.
This commit is contained in:
parent
e36ced1dce
commit
a6056b870b
Notes:
blender-bot
2024-04-11 14:26:06 +02:00
Referenced by issue #100494, Regression: Erratic undo behaviors with hidden faces in Sculpt and Vertex/Weight Paint modes
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue