diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-03-26 17:56:41 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-03-27 19:52:00 +0300 |
commit | 7eacda5a2bedbefab208ac32b0556307a9ca758b (patch) | |
tree | 00bf8934d2e4645dfa322c0339374d44eb57e80b /source/blender/editors/sculpt_paint | |
parent | 0db055338ab22be926a5c9ce46b4e45689947038 (diff) |
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
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 16 |
1 files changed, 16 insertions, 0 deletions
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. */ |