[Bf-blender-cvs] [90fd75c869c] blender-v2.81-release: Fix T70866: Missing PBVH updates after mask undo

Pablo Dobarro noreply at git.blender.org
Thu Oct 31 14:32:04 CET 2019


Commit: 90fd75c869c01df27b68e0e2836aa3e4fdfcb429
Author: Pablo Dobarro
Date:   Wed Oct 30 15:48:31 2019 +0100
Branches: blender-v2.81-release
https://developer.blender.org/rB90fd75c869c01df27b68e0e2836aa3e4fdfcb429

Fix T70866: Missing PBVH updates after mask undo

With the latest changes, the PBVH needs extra flags each time the mask is
modified to keep the internal fully_masked and fully_unmasked node flags
updated.

Reviewed By: jbakker

Maniphest Tasks: T70866

Differential Revision: https://developer.blender.org/D6088

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

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 5d95cc80280..fc990c01bfb 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -77,6 +77,7 @@ static UndoSculpt *sculpt_undo_get_nodes(void);
 static void update_cb(PBVHNode *node, void *rebuild)
 {
   BKE_pbvh_node_mark_update(node);
+  BKE_pbvh_node_mark_update_mask(node);
   if (*((bool *)rebuild)) {
     BKE_pbvh_node_mark_rebuild_draw(node);
   }
@@ -497,7 +498,7 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
   SculptSession *ss = ob->sculpt;
   SubdivCCG *subdiv_ccg = ss->subdiv_ccg;
   SculptUndoNode *unode;
-  bool update = false, rebuild = false;
+  bool update = false, rebuild = false, update_mask = false;
   bool need_mask = false;
 
   for (unode = lb->first; unode; unode = unode->next) {
@@ -579,6 +580,7 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
       case SCULPT_UNDO_MASK:
         if (sculpt_undo_restore_mask(C, unode)) {
           update = true;
+          update_mask = true;
         }
         break;
 
@@ -616,6 +618,9 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
     };
     BKE_pbvh_search_callback(ss->pbvh, NULL, NULL, update_cb_partial, &data);
     BKE_pbvh_update_bounds(ss->pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateRedraw);
+    if (update_mask) {
+      BKE_pbvh_update_vertex_data(ss->pbvh, PBVH_UpdateMask);
+    }
 
     if (BKE_sculpt_multires_active(scene, ob)) {
       if (rebuild) {



More information about the Bf-blender-cvs mailing list