fix for sharp edge selection being inverted, change default angle from 1 to 30deg.
authorCampbell Barton <ideasman42@gmail.com>
Fri, 14 Sep 2012 11:10:03 +0000 (11:10 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 14 Sep 2012 11:10:03 +0000 (11:10 +0000)
source/blender/editors/mesh/editmesh_select.c

index dc5d1cea4434738604f479087e07011cec6e8450..81776ff7f4fee8fabef214b66b8bbc2fdb2d0e55 100644 (file)
@@ -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)