[Bf-blender-cvs] [697e6e53b86] sculpt-dev: Sculpt Expand: Improve and fix Face Set snapping whit Face Sets

Pablo Dobarro noreply at git.blender.org
Wed Feb 17 17:51:07 CET 2021


Commit: 697e6e53b86580b0d0b3b45bcd59291957caaf3e
Author: Pablo Dobarro
Date:   Wed Feb 17 17:44:00 2021 +0100
Branches: sculpt-dev
https://developer.blender.org/rB697e6e53b86580b0d0b3b45bcd59291957caaf3e

Sculpt Expand: Improve and fix Face Set snapping whit Face Sets

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

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

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

diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index e6118c9a417..013ebd8fbf3 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -242,6 +242,9 @@ static bool sculpt_expand_state_get(SculptSession *ss, ExpandCache *expand_cache
   bool enabled = false;
 
   if (expand_cache->snap) {
+    /* Face Sets are not being modified when using this function, so it is ok to get this directly
+     * from the Sculpt API instead of implementing a custom function to get them from
+     * expand_cache->original_face_sets. */
     const int face_set = SCULPT_vertex_face_set_get(ss, v);
     enabled = BLI_gset_haskey(expand_cache->snap_enabled_face_sets, POINTER_FROM_INT(face_set));
   }
@@ -282,7 +285,7 @@ static bool sculpt_expand_face_state_get(SculptSession *ss, ExpandCache *expand_
   bool enabled = false;
 
   if (expand_cache->snap_enabled_face_sets) {
-    const int face_set = ss->face_sets[f];
+    const int face_set = expand_cache->original_face_sets[f];
     enabled = BLI_gset_haskey(expand_cache->snap_enabled_face_sets, POINTER_FROM_INT(face_set));
   }
   else {
@@ -1013,7 +1016,7 @@ static void sculpt_expand_snap_initialize_from_enabled(SculptSession *ss,
 
   const int totface = ss->totfaces;
   for (int i = 0; i < totface; i++) {
-    const int face_set = expand_cache->initial_face_sets[i];
+    const int face_set = expand_cache->original_face_sets[i];
     BLI_gset_add(expand_cache->snap_enabled_face_sets, POINTER_FROM_INT(face_set));
   }
 
@@ -1027,7 +1030,7 @@ static void sculpt_expand_snap_initialize_from_enabled(SculptSession *ss,
       }
     }
     if (any_disabled) {
-      const int face_set = expand_cache->initial_face_sets[p];
+      const int face_set = expand_cache->original_face_sets[p];
       if (BLI_gset_haskey(expand_cache->snap_enabled_face_sets, POINTER_FROM_INT(face_set))) {
         BLI_gset_remove(expand_cache->snap_enabled_face_sets, POINTER_FROM_INT(face_set), NULL);
       }



More information about the Bf-blender-cvs mailing list