fix for own regression, edge path tagging worked but toggline bevel didnt.
authorCampbell Barton <ideasman42@gmail.com>
Wed, 27 Feb 2013 07:05:01 +0000 (07:05 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 27 Feb 2013 07:05:01 +0000 (07:05 +0000)
reported as bug [#34449]

source/blender/editors/mesh/editmesh_select.c

index 85aeb713f05ea21264bd29042c07739b9986226d..2c6ce107eae1bbb2b5eb9434a35b7054317dba47 100644 (file)
@@ -1339,6 +1339,22 @@ static int edgetag_context_check(Scene *scene, BMesh *bm, BMEdge *e)
        return 0;
 }
 
+static void edgetag_ensure_cd_flag(Scene *scene, Mesh *me)
+{
+       BMesh *bm = me->edit_btmesh->bm;
+
+       switch (scene->toolsettings->edge_mode) {
+               case EDGE_MODE_TAG_CREASE:
+                       BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_EDGE_CREASE);
+                       break;
+               case EDGE_MODE_TAG_BEVEL:
+                       BM_mesh_cd_flag_ensure(bm, me, ME_CDFLAG_EDGE_BWEIGHT);
+                       break;
+               default:
+                       break;
+       }
+}
+
 static int edgetag_shortest_path(Scene *scene, BMesh *bm, BMEdge *e_src, BMEdge *e_dst)
 {
        /* BM_ELEM_TAG flag is used to store visited edges */
@@ -1352,16 +1368,7 @@ static int edgetag_shortest_path(Scene *scene, BMesh *bm, BMEdge *e_src, BMEdge
        /* note, would pass BM_EDGE except we are looping over all edges anyway */
        BM_mesh_elem_index_ensure(bm, BM_VERT /* | BM_EDGE */);
 
-       switch (scene->toolsettings->edge_mode) {
-               case EDGE_MODE_TAG_CREASE:
-                       BM_mesh_cd_flag_ensure(bm, BKE_mesh_from_object(OBACT), ME_CDFLAG_EDGE_CREASE);
-                       break;
-               case EDGE_MODE_TAG_BEVEL:
-                       BM_mesh_cd_flag_ensure(bm, BKE_mesh_from_object(OBACT), ME_CDFLAG_EDGE_BWEIGHT);
-                       break;
-               default:
-                       break;
-       }
+       edgetag_ensure_cd_flag(scene, OBACT->data);
 
        BM_ITER_MESH_INDEX (e, &eiter, bm, BM_EDGES_OF_MESH, i) {
                if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) == FALSE) {
@@ -1451,7 +1458,7 @@ static int mouse_mesh_shortest_path_edge(ViewContext *vc)
        e_dst = EDBM_edge_find_nearest(vc, &dist);
        if (e_dst) {
                Mesh *me = vc->obedit->data;
-               int path = 0;
+               bool is_path = false;
                
                if (em->bm->selected.last) {
                        BMEditSelection *ese = em->bm->selected.last;
@@ -1462,13 +1469,14 @@ static int mouse_mesh_shortest_path_edge(ViewContext *vc)
                                if (e_act != e_dst) {
                                        if (edgetag_shortest_path(vc->scene, em->bm, e_act, e_dst)) {
                                                BM_select_history_remove(em->bm, e_act);
-                                               path = 1;
+                                               is_path = true;
                                        }
                                }
                        }
                }
-               if (path == 0) {
+               if (is_path == false) {
                        int act = (edgetag_context_check(vc->scene, em->bm, e_dst) == 0);
+                       edgetag_ensure_cd_flag(vc->scene, vc->obedit->data);
                        edgetag_context_set(em->bm, vc->scene, e_dst, act); /* switch the edge option */
                }