diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-05-16 03:18:38 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-05-16 03:18:38 +0300 |
commit | 05c4c2409ea4618704df28258866e39a8a53b3cb (patch) | |
tree | 580691568f8bdc4d2d8065846f73bd588364cecc | |
parent | 5cc55486eee7ab5131750fae4a93b1472d1d5688 (diff) |
BMesh: add sharp edge delimiter
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operator_api.h | 1 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_decimate_dissolve.c | 6 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 1 |
4 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h index 96f954f8ee7..917b9a9dcf9 100644 --- a/source/blender/bmesh/intern/bmesh_operator_api.h +++ b/source/blender/bmesh/intern/bmesh_operator_api.h @@ -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); diff --git a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c index 6d3b738a462..8a14291d3bc 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c +++ b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c @@ -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)) { diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 288909e382f..bf32008ee45 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -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; diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 400e98befd0..b5eb1a265b5 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -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}, }; |