[Bf-blender-cvs] [6eb76f64304] master: Fix T74492: Reset Face Set data when cancelling the expand operator

Pablo Dobarro noreply at git.blender.org
Mon Mar 9 19:26:05 CET 2020


Commit: 6eb76f64304235bd91e7a226019da5424e0b28d3
Author: Pablo Dobarro
Date:   Fri Mar 6 14:05:55 2020 +0100
Branches: master
https://developer.blender.org/rB6eb76f64304235bd91e7a226019da5424e0b28d3

Fix T74492: Reset Face Set data when cancelling the expand operator

The operator was resetting the mask data when cancelling instead of the
face set data, so it was crashing because mask data was not available
when starting the operator in expand face set mode.

Reviewed By: brecht

Maniphest Tasks: T74492

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

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

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

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 0fb5897628f..443aaef85c5 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -9687,22 +9687,32 @@ static void sculpt_mask_expand_cancel(bContext *C, wmOperator *op)
 {
   Object *ob = CTX_data_active_object(C);
   SculptSession *ss = ob->sculpt;
+  const bool create_face_set = RNA_boolean_get(op->ptr, "create_face_set");
 
   MEM_freeN(op->customdata);
 
   for (int n = 0; n < ss->filter_cache->totnode; n++) {
     PBVHNode *node = ss->filter_cache->nodes[n];
-    PBVHVertexIter vd;
-    BKE_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE)
-    {
-      *vd.mask = ss->filter_cache->prev_mask[vd.index];
+    if (create_face_set) {
+      for (int i = 0; i < ss->totpoly; i++) {
+        ss->face_sets[i] = ss->filter_cache->prev_face_set[i];
+      }
+    }
+    else {
+      PBVHVertexIter vd;
+      BKE_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE)
+      {
+        *vd.mask = ss->filter_cache->prev_mask[vd.index];
+      }
+      BKE_pbvh_vertex_iter_end;
     }
-    BKE_pbvh_vertex_iter_end;
 
     BKE_pbvh_node_mark_redraw(node);
   }
 
-  sculpt_flush_update_step(C, SCULPT_UPDATE_MASK);
+  if (!create_face_set) {
+    sculpt_flush_update_step(C, SCULPT_UPDATE_MASK);
+  }
   sculpt_filter_cache_free(ss);
   SCULPT_undo_push_end();
   sculpt_flush_update_done(C, ob, SCULPT_UPDATE_MASK);



More information about the Bf-blender-cvs mailing list