Sculpt: Init Face Sets by Face Sets boundary
This commit is contained in:
parent
e973c94036
commit
88921150ff
|
@ -3206,6 +3206,9 @@ class VIEW3D_MT_face_sets_init(Menu):
|
|||
op = layout.operator("sculpt.face_sets_init", text='By Loose Parts')
|
||||
op.mode = 'LOOSE_PARTS'
|
||||
|
||||
op = layout.operator("sculpt.face_sets_init", text='By Face Set Boundaries')
|
||||
op.mode = 'FACE_SET_BOUNDARIES'
|
||||
|
||||
op = layout.operator("sculpt.face_sets_init", text='By Materials')
|
||||
op.mode = 'MATERIALS'
|
||||
|
||||
|
|
|
@ -442,6 +442,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[] = {
|
||||
|
@ -501,6 +502,13 @@ 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},
|
||||
};
|
||||
|
||||
|
@ -543,6 +551,13 @@ static bool sculpt_face_sets_init_bevel_weight_test(
|
|||
return BM_elem_float_data_get(&bm->edata, from_e, CD_BWEIGHT) < threshold;
|
||||
}
|
||||
|
||||
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 bool sculpt_face_sets_init_sharp_edges_test(BMesh *UNUSED(bm),
|
||||
BMFace *UNUSED(from_f),
|
||||
BMEdge *from_e,
|
||||
|
@ -715,6 +730,9 @@ 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;
|
||||
|
|
Loading…
Reference in New Issue