Commit: e22f49c80192a7d3b3661ac132d7026d16b9d2e1
Author: Hans Goudey
Date:   Tue Dec 13 14:11:06 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rBe22f49c80192a7d3b3661ac132d7026d16b9d2e1

Fix T103052: Box trim does not create face sets attribute

Previously the sculpt box trim operator always created face sets,
but after face sets became optional it only modified them if they
already existed. Absent a better way to turn the behavior on and off,
the fix is to just always create face sets.

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

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

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

diff --git a/source/blender/editors/sculpt_paint/paint_mask.c 
b/source/blender/editors/sculpt_paint/paint_mask.c
index eb24d15dad5..ad9ae6b4349 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -1345,6 +1345,11 @@ static void 
sculpt_gesture_apply_trim(SculptGestureContext *sgcontext)
 
 static void sculpt_gesture_trim_begin(bContext *C, SculptGestureContext 
*sgcontext)
 {
+  Object *object = sgcontext->vc.obact;
+  SculptSession *ss = object->sculpt;
+  Mesh *mesh = (Mesh *)object->data;
+  ss->face_sets = BKE_sculpt_face_sets_ensure(mesh);
+
   Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
   sculpt_gesture_trim_calculate_depth(sgcontext);
   sculpt_gesture_trim_geometry_generate(sgcontext);
@@ -1369,9 +1374,9 @@ static void sculpt_gesture_trim_end(bContext *UNUSED(C), 
SculptGestureContext *s
 {
   Object *object = sgcontext->vc.obact;
   SculptSession *ss = object->sculpt;
+  Mesh *mesh = (Mesh *)object->data;
 
-  ss->face_sets = CustomData_get_layer_named(
-      &((Mesh *)object->data)->pdata, CD_PROP_INT32, ".sculpt_face_set");
+  ss->face_sets = CustomData_get_layer_named(&mesh->pdata, CD_PROP_INT32, 
".sculpt_face_set");
   if (ss->face_sets) {
     /* Assign a new Face Set ID to the new faces created by the trim 
operation. */
     const int next_face_set_id = 
ED_sculpt_face_sets_find_next_available_id(object->data);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to