Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-04-02 16:58:50 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-04-14 20:24:44 +0300
commitbf49bb354fca4ad96f8f3e6802ecf733b29ac3e3 (patch)
treee25495b117658570205344755fd8038cac5b3c2f /source/blender/editors/sculpt_paint
parent7fbd9b67afa8a5f7afadbd4fa996e3839b68a3b7 (diff)
Fix T75104: Update Face Sets visibility when entering Sculpt Mode
Geometry that was just added to sculpt mode has the SCULPT_FACE_SET_NONE assigned, so it was hidden by default. By doing this when entering sculpt mode a new visible face set is created for it, making it easier to isolate it again if you want to do further tweaking with the sculpt tools. Also, this also fixes the issue that may happen when changing the mesh visibility in edit mode. Now visibility changes done outside sculpt mode are stored in the face sets when entering sculpt mode, so mesh visibility should stay the same. Reviewed By: jbakker Maniphest Tasks: T75104 Differential Revision: https://developer.blender.org/D7249
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index b304a476dec..b8c6e97fcc1 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -7477,6 +7477,28 @@ static void sculpt_init_session(Depsgraph *depsgraph, Scene *scene, Object *ob)
ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session");
ob->sculpt->mode_type = OB_MODE_SCULPT;
BKE_sculpt_update_object_for_edit(depsgraph, ob, false, false);
+
+ /* Here we can detect geometry that was just added to Sculpt Mode as it has the
+ * SCULPT_FACE_SET_NONE assigned, so we can create a new Face Set for it. */
+ /* In sculpt mode all geometry that is assigned to SCULPT_FACE_SET_NONE is considered as not
+ * initialized, which is used is some operators that modify the mesh topology to preform certain
+ * actions in the new polys. After these operations are finished, all polys should have a valid
+ * face set ID assigned (different from SCULPT_FACE_SET_NONE) to manage their visibility
+ * correctly. */
+ /* TODO(pablodp606): Based on this we can improve the UX in future tools for creating new
+ * objects, like moving the transform pivot position to the new area or masking existing
+ * geometry. */
+ SculptSession *ss = ob->sculpt;
+ const int new_face_set = SCULPT_face_set_next_available_get(ss);
+ for (int i = 0; i < ss->totfaces; i++) {
+ if (ss->face_sets[i] == SCULPT_FACE_SET_NONE) {
+ ss->face_sets[i] = new_face_set;
+ }
+ }
+
+ /* Update the Face Sets visibility with the vertex visibility changes that may have been done
+ * outside Sculpt Mode */
+ SCULPT_visibility_sync_all_vertex_to_face_sets(ob->sculpt);
}
static int ed_object_sculptmode_flush_recalc_flag(Scene *scene,