From e762797af5fb6b903cc255fd746c7ac4b7687dd1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 14 Sep 2012 11:10:03 +0000 Subject: fix for sharp edge selection being inverted, change default angle from 1 to 30deg. --- source/blender/editors/mesh/editmesh_select.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index dc5d1cea443..81776ff7f4f 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -2324,25 +2324,19 @@ static int edbm_select_sharp_edges_exec(bContext *C, wmOperator *op) BMIter iter; BMEdge *e; BMLoop *l1, *l2; - float sharp = RNA_float_get(op->ptr, "sharpness"), angle; + const float sharp = RNA_float_get(op->ptr, "sharpness"); BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) { - if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) || !e->l) - continue; - - l1 = e->l; - l2 = l1->radial_next; - - if (l1 == l2) - continue; - - /* edge has exactly two neighboring faces, check angle */ - angle = angle_normalized_v3v3(l1->f->no, l2->f->no); + if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) == FALSE && + BM_edge_loop_pair(e, &l1, &l2)) + { + /* edge has exactly two neighboring faces, check angle */ + const float angle = angle_normalized_v3v3(l1->f->no, l2->f->no); - if (fabsf(angle) < sharp) { - BM_edge_select_set(em->bm, e, TRUE); + if (fabsf(angle) > sharp) { + BM_edge_select_set(em->bm, e, TRUE); + } } - } WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); @@ -2369,7 +2363,7 @@ void MESH_OT_edges_select_sharp(wmOperatorType *ot) /* props */ prop = RNA_def_float_rotation(ot->srna, "sharpness", 0, NULL, DEG2RADF(0.01f), DEG2RADF(180.0f), "Sharpness", "", DEG2RADF(1.0f), DEG2RADF(180.0f)); - RNA_def_property_float_default(prop, DEG2RADF(1.0f)); + RNA_def_property_float_default(prop, DEG2RADF(30.0f)); } static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op) -- cgit v1.2.3