diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_face_set.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c index df03d2adeaf..332e551c577 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.c +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c @@ -447,6 +447,7 @@ typedef enum eSculptFaceSetsInitMode { SCULPT_FACE_SETS_FROM_SHARP_EDGES = 5, SCULPT_FACE_SETS_FROM_BEVEL_WEIGHT = 6, SCULPT_FACE_SETS_FROM_FACE_MAPS = 7, + SCULPT_FACE_SETS_FROM_FACE_SET_BOUNDARIES = 8, } eSculptFaceSetsInitMode; static EnumPropertyItem prop_sculpt_face_sets_init_types[] = { @@ -506,6 +507,14 @@ static EnumPropertyItem prop_sculpt_face_sets_init_types[] = { "Face Sets from Face Maps", "Create a Face Set per Face Map", }, + { + SCULPT_FACE_SETS_FROM_FACE_SET_BOUNDARIES, + "FACE_SET_BOUNDARIES", + 0, + "Face Sets from Face Set Boundaries", + "Create a Face Set per isolated Face Set", + }, + {0, NULL, 0, NULL, NULL}, }; @@ -557,6 +566,14 @@ static bool sculpt_face_sets_init_sharp_edges_test(BMesh *UNUSED(bm), return BM_elem_flag_test(from_e, BM_ELEM_SMOOTH); } +static bool sculpt_face_sets_init_face_set_boundary_test( + BMesh *bm, BMFace *from_f, BMEdge *UNUSED(from_e), BMFace *to_f, const float UNUSED(threshold)) +{ + const int cd_face_sets_offset = CustomData_get_offset(&bm->pdata, CD_SCULPT_FACE_SETS); + return BM_ELEM_CD_GET_INT(from_f, cd_face_sets_offset) == + BM_ELEM_CD_GET_INT(to_f, cd_face_sets_offset); +} + static void sculpt_face_sets_init_flood_fill(Object *ob, face_sets_flood_fill_test test, const float threshold) @@ -725,6 +742,10 @@ static int sculpt_face_set_init_exec(bContext *C, wmOperator *op) case SCULPT_FACE_SETS_FROM_BEVEL_WEIGHT: sculpt_face_sets_init_flood_fill(ob, sculpt_face_sets_init_bevel_weight_test, threshold); break; + case SCULPT_FACE_SETS_FROM_FACE_SET_BOUNDARIES: + sculpt_face_sets_init_flood_fill( + ob, sculpt_face_sets_init_face_set_boundary_test, threshold); + break; case SCULPT_FACE_SETS_FROM_FACE_MAPS: sculpt_face_sets_init_loop(ob, SCULPT_FACE_SETS_FROM_FACE_MAPS); break; |