[Bf-blender-cvs] [12e1f7e50b1] temp-face-set-fixes: Fix T74637: Reset face set data when disabling dyntopo

Pablo Dobarro noreply at git.blender.org
Wed Mar 25 15:31:33 CET 2020


Commit: 12e1f7e50b16f53ced6a785c69b104c1c76fddf7
Author: Pablo Dobarro
Date:   Wed Mar 25 15:30:18 2020 +0100
Branches: temp-face-set-fixes
https://developer.blender.org/rB12e1f7e50b16f53ced6a785c69b104c1c76fddf7

Fix T74637: Reset face set data when disabling dyntopo

Last time I checked Face Sets were preserved in a more or less
predictable way when modifying the mesh with dyntopo. As it looks that
in some problems this may cause bugs and you can't see or use face sets
when modifying the topology of the mesh whith dyntopo active, it is
probably better to reset them when going from dyntopo to mesh. This way
you know that you are always going to get a predictable face sets state.

Maniphest Tasks: T74637

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

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

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 e87be70e382..a7b65ceb936 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -8148,6 +8148,22 @@ static void sculpt_dynamic_topology_disable_ex(
   }
   else {
     BKE_sculptsession_bm_to_me(ob, true);
+
+    /* Reset Face Sets as they are no longer valid. */
+    if (!CustomData_has_layer(&me->pdata, CD_SCULPT_FACE_SETS)) {
+      CustomData_add_layer(&me->pdata, CD_SCULPT_FACE_SETS, CD_CALLOC, NULL, me->totpoly);
+    }
+    ss->face_sets = CustomData_get_layer(&me->pdata, CD_SCULPT_FACE_SETS);
+    for (int i = 0; i < me->totpoly; i++) {
+      ss->face_sets[i] = 1;
+    }
+    me->face_sets_color_default = 1;
+
+    /* Sync the visibility to vertices manually as the pmap is still not initialized. */
+    for (int i = 0; i < me->totvert; i++) {
+      SET_FLAG_FROM_TEST(me->mvert[i].flag, false, ME_HIDE);
+      me->mvert[i].flag |= ME_VERT_PBVH_UPDATE;
+    }
   }
 
   /* Clear data. */



More information about the Bf-blender-cvs mailing list