BMesh: add sharp edge delimiter

This commit is contained in:
Campbell Barton 2015-05-16 10:18:38 +10:00
parent 5cc55486ee
commit 05c4c2409e
Notes: blender-bot 2023-02-14 11:08:33 +01:00
Referenced by issue #44791, Unpaintable transparent triangles with texture paint
Referenced by issue #44801, Blender crash in UV-editor
Referenced by issue #44780, Decimate Planar generates concave edges
Referenced by issue #44728, UV seams visible at distance with texpaint even with 8 px bleed & 0.1 filter size
Referenced by issue #44714, crashing to desktop when switching to node editor.
4 changed files with 14 additions and 0 deletions

View File

@ -302,6 +302,7 @@ typedef enum {
BMO_DELIM_NORMAL = 1 << 0,
BMO_DELIM_MATERIAL = 1 << 1,
BMO_DELIM_SEAM = 1 << 2,
BMO_DELIM_SHARP = 1 << 3,
} BMO_Delimit;
void BMO_op_flag_enable(BMesh *bm, BMOperator *op, const int op_flag);

View File

@ -74,6 +74,12 @@ static float bm_edge_calc_dissolve_error(const BMEdge *e, const BMO_Delimit deli
goto fail;
}
if ((delimit & BMO_DELIM_SHARP) &&
(BM_elem_flag_test(e, BM_ELEM_SMOOTH) == 0))
{
goto fail;
}
if ((delimit & BMO_DELIM_MATERIAL) &&
(e->l->f->mat_nr != e->l->radial_next->f->mat_nr))
{

View File

@ -2363,6 +2363,12 @@ static bool select_linked_delimit_test(BMEdge *e, int delimit)
}
}
if (delimit & BMO_DELIM_SHARP) {
if (BM_elem_flag_test(e, BM_ELEM_SMOOTH) == 0) {
return true;
}
}
if (delimit & BMO_DELIM_NORMAL) {
if (!BM_edge_is_contiguous(e)) {
return true;

View File

@ -55,6 +55,7 @@ EnumPropertyItem mesh_delimit_mode_items[] = {
{BMO_DELIM_NORMAL, "NORMAL", 0, "Normal", "Delimit by face directions"},
{BMO_DELIM_MATERIAL, "MATERIAL", 0, "Material", "Delimit by face material"},
{BMO_DELIM_SEAM, "SEAM", 0, "Seam", "Delimit by edge seams"},
{BMO_DELIM_SHARP, "SHARP", 0, "Sharp", "Delimit by sharp edges"},
{0, NULL, 0, NULL, NULL},
};