[Bf-blender-cvs] [7eacda5a2be] master: Fix T74637: Reset face set data when disabling dyntopo

Pablo Dobarro noreply at git.blender.org
Fri Mar 27 17:52:25 CET 2020


Commit: 7eacda5a2bedbefab208ac32b0556307a9ca758b
Author: Pablo Dobarro
Date:   Thu Mar 26 15:56:41 2020 +0100
Branches: master
https://developer.blender.org/rB7eacda5a2bedbefab208ac32b0556307a9ca758b

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.

Reviewed By: jbakker

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 a15a8263a3b..7db792d43ce 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -8298,6 +8298,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++) {
+      me->mvert[i].flag &= ~ME_HIDE;
+      me->mvert[i].flag |= ME_VERT_PBVH_UPDATE;
+    }
   }
 
   /* Clear data. */



More information about the Bf-blender-cvs mailing list