[Bf-blender-cvs] [a6056b870b1] master: Fix T100494: Broken sculpt hide status undo/redo

Hans Goudey noreply at git.blender.org
Tue Aug 23 20:09:54 CEST 2022


Commit: a6056b870b1da9bf422920439897a5cf8616c925
Author: Hans Goudey
Date:   Tue Aug 23 14:09:46 2022 -0400
Branches: master
https://developer.blender.org/rBa6056b870b1da9bf422920439897a5cf8616c925

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.

===================================================================

M	source/blender/editors/sculpt_paint/sculpt_undo.c

===================================================================

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);



More information about the Bf-blender-cvs mailing list