Code Cleanup: comment, remove or use unused functions.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 6 Feb 2012 09:39:47 +0000 (09:39 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 6 Feb 2012 09:39:47 +0000 (09:39 +0000)
source/blender/editors/include/ED_mesh.h
source/blender/editors/mesh/bmesh_select.c
source/blender/editors/mesh/bmesh_tools.c
source/blender/editors/mesh/bmeshutils.c
source/blender/editors/mesh/editface.c
source/blender/editors/mesh/meshtools.c

index a6cc38de084cce6efd9bae65f2946a93a4b57cfb..d9f8784177a4bbcc9aff23344906338bfb69ceba 100644 (file)
@@ -153,6 +153,8 @@ int EDBM_CallAndSelectOpf(struct BMEditMesh *em, struct wmOperator *op,
   edges select/deselect faces and vertices, and in face select mode faces select/deselect
   edges and vertices.*/
 void EDBM_selectmode_flush(struct BMEditMesh *em);
+void EDBM_select_more(struct BMEditMesh *em);
+void EDBM_select_less(struct BMEditMesh *em);
 
 int EDBM_get_actSelection(struct BMEditMesh *em, struct BMEditSelection *ese);
 
@@ -202,6 +204,7 @@ void                EM_free_data_layer(struct BMEditMesh *em, struct CustomData *data, int typ
 void EDBM_toggle_select_all(struct BMEditMesh *em);
 void EDBM_set_flag_all(struct BMEditMesh *em, const char hflag);
 void EDBM_clear_flag_all(struct BMEditMesh *em, const char hflag);
+void EDBM_select_mirrored(struct Object *obedit, struct BMEditMesh *em, int extend);
 void EDBM_automerge(struct Scene *scene, struct Object *ob, int update);
 
 /* editmesh_mods.c */
index 1fd3981e7302f471505c7d616e5a166ee5e6cdcc..39a74ed2fd89f313244a3e1950c4f24267359aa3 100644 (file)
@@ -96,25 +96,36 @@ BMEditMesh_mods.c, UI level access, no geometry changes
 
 /* ****************************** MIRROR **************** */
 
-static void EDBM_select_mirrored(Object *obedit, BMEditMesh *em)
+void EDBM_select_mirrored(Object *UNUSED(obedit), BMEditMesh *em, int extend)
 {
-       if (em->selectmode & SCE_SELECT_VERTEX) {
-               BMVert *eve, *v1;
-               BMIter iter;
-               int i;
+       BMVert *v1, *v2;
+       BMIter iter;
 
-               i= 0;
-               BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-                       if (BM_TestHFlag(eve, BM_SELECT) && !BM_TestHFlag(eve, BM_HIDDEN)) {
-                               v1= editbmesh_get_x_mirror_vert(obedit, em, eve, eve->co, i);
-                               if (v1) {
-                                       BM_Select(em->bm, eve, FALSE);
-                                       BM_Select(em->bm, v1, TRUE);
-                               }
-                       }
-                       i++;
+       BM_ITER(v1, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
+               if (!BM_TestHFlag(v1, BM_SELECT) || BM_TestHFlag(v1, BM_HIDDEN)) {
+                       BM_ClearHFlag(v1, BM_TMP_TAG);
+               }
+               else {
+                       BM_SetHFlag(v1, BM_TMP_TAG);
+               }
+       }
+
+       EDBM_CacheMirrorVerts(em, TRUE);
+
+       if (!extend)
+               EDBM_clear_flag_all(em, BM_SELECT);
+
+       BM_ITER(v1, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
+               if (!BM_TestHFlag(v1, BM_TMP_TAG) || BM_TestHFlag(v1, BM_HIDDEN))
+                       continue;
+
+               v2= EDBM_GetMirrorVert(em, v1);
+               if (v2 && !BM_TestHFlag(v2, BM_HIDDEN)) {
+                       BM_Select(em->bm, v2, TRUE);
                }
        }
+
+       EDBM_EndMirrorCache(em);
 }
 
 void EDBM_automerge(Scene *scene, Object *obedit, int update)
@@ -1898,23 +1909,12 @@ void MESH_OT_select_linked(wmOperatorType *ot)
 
 /* ******************** **************** */
 
-static int select_more(bContext *C, wmOperator *op)
+static int select_more(bContext *C, wmOperator *UNUSED(op))
 {
        Object *obedit= CTX_data_edit_object(C);
        BMEditMesh *em= (((Mesh *)obedit->data))->edit_btmesh;
-       BMOperator bmop;
-       int usefaces = em->selectmode > SCE_SELECT_EDGE;
-
-       EDBM_InitOpf(em, &bmop, op, "regionextend geom=%hvef constrict=%d usefaces=%d", 
-                    BM_SELECT, 0, usefaces);
-
-       BMO_Exec_Op(em->bm, &bmop);
-       BMO_HeaderFlag_Buffer(em->bm, &bmop, "geomout", BM_SELECT, BM_ALL);
-
-       EDBM_selectmode_flush(em);
 
-       if (!EDBM_FinishOp(em, &bmop, op, 1))
-               return OPERATOR_CANCELLED;
+       EDBM_select_more(em);
 
        WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
        return OPERATOR_FINISHED;
@@ -1935,23 +1935,12 @@ void MESH_OT_select_more(wmOperatorType *ot)
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
-static int select_less(bContext *C, wmOperator *op)
+static int select_less(bContext *C, wmOperator *UNUSED(op))
 {
        Object *obedit= CTX_data_edit_object(C);
        BMEditMesh *em= (((Mesh *)obedit->data))->edit_btmesh;
-       BMOperator bmop;
-       int usefaces = em->selectmode > SCE_SELECT_EDGE;
-
-       EDBM_InitOpf(em, &bmop, op, "regionextend geom=%hvef constrict=%d usefaces=%d", 
-                    BM_SELECT, 1, usefaces);
-
-       BMO_Exec_Op(em->bm, &bmop);
-       BMO_UnHeaderFlag_Buffer(em->bm, &bmop, "geomout", BM_SELECT, BM_ALL);
 
-       EDBM_selectmode_flush(em);
-
-       if (!EDBM_FinishOp(em, &bmop, op, 1))
-               return OPERATOR_CANCELLED;
+       EDBM_select_less(em);
 
        WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
        return OPERATOR_FINISHED;
index 77671ae6b070ca6119816edb8765578b75932cb0..a03e25cc1f98d633429c7b9439080f253393624d 100644 (file)
@@ -1041,62 +1041,6 @@ void MESH_OT_edge_face_add(wmOperatorType *ot)
        
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-       
-}
-
-static EnumPropertyItem prop_mesh_edit_types[] = {
-       {1, "VERT", 0, "Vertices", ""},
-       {2, "EDGE", 0, "Edges", ""},
-       {3, "FACE", 0, "Faces", ""},
-       {0, NULL, 0, NULL, NULL}
-};
-
-static int mesh_selection_type_exec(bContext *C, wmOperator *op)
-{              
-       
-       Object *obedit= CTX_data_edit_object(C);
-       BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
-       int type = RNA_enum_get(op->ptr,"type");
-
-       switch (type) {
-               case 1:
-                       em->selectmode = SCE_SELECT_VERTEX;
-                       break;
-               case 2:
-                       em->selectmode = SCE_SELECT_EDGE;
-                       break;
-               case 3:
-                       em->selectmode = SCE_SELECT_FACE;
-                       break;
-       }
-
-       EDBM_selectmode_set(em);
-       CTX_data_tool_settings(C)->selectmode = em->selectmode;
-
-       WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
-       
-       return OPERATOR_FINISHED;
-}
-
-static void MESH_OT_selection_type(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Selection Mode";
-       ot->description= "Set the selection mode type";
-       ot->idname= "MESH_OT_selection_type";
-       
-       /* api callbacks */
-       ot->invoke= WM_menu_invoke;
-       ot->exec= mesh_selection_type_exec;
-       
-       ot->poll= ED_operator_editmesh;
-       
-       /* flags */
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-       
-       /* props */
-       RNA_def_enum(ot->srna, "type", prop_mesh_edit_types, 0, "Type", "Set the mesh selection type");
-       RNA_def_boolean(ot->srna, "inclusive", 0, "Inclusive", "Selects geometry around selected geometry, occording to selection mode");       
 }
 
 /* ************************* SEAMS AND EDGES **************** */
@@ -3958,43 +3902,16 @@ void MESH_OT_select_loose_verts(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
-#define MIRROR_THRESH  1.0f
-
 static int select_mirror_exec(bContext *C, wmOperator *op)
 {
        Object *obedit= CTX_data_edit_object(C);
        BMEditMesh *em= ((Mesh *)obedit->data)->edit_btmesh;
-       BMVert *v1, *v2;
-       BMIter iter;
        int extend= RNA_boolean_get(op->ptr, "extend");
 
-       BM_ITER(v1, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-               if (!BM_TestHFlag(v1, BM_SELECT) || BM_TestHFlag(v1, BM_HIDDEN)) {
-                       BM_ClearHFlag(v1, BM_TMP_TAG);
-               }
-               else {
-                       BM_SetHFlag(v1, BM_TMP_TAG);
-               }
-       }
-
-       EDBM_CacheMirrorVerts(em, TRUE);
-
-       if (!extend)
-               EDBM_clear_flag_all(em, BM_SELECT);
-
-       BM_ITER(v1, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-               if (!BM_TestHFlag(v1, BM_TMP_TAG) || BM_TestHFlag(v1, BM_HIDDEN))
-                       continue;
-
-               v2= EDBM_GetMirrorVert(em, v1);
-               if (v2 && !BM_TestHFlag(v2, BM_HIDDEN)) {
-                       BM_Select(em->bm, v2, TRUE);
-               }
-       }
-
-       EDBM_EndMirrorCache(em);
-
+       EDBM_select_mirrored(obedit, em, extend);
+       EDBM_selectmode_flush(em);
        WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+
        return OPERATOR_FINISHED;
 }
 
index 05a1d96753cf4ccb561d72504fdde518f978fb11..a1a203009c801dce1922034a40ca54f9057cfd79 100644 (file)
@@ -434,9 +434,7 @@ void EDBM_selectmode_flush(BMEditMesh *em)
        BM_SelectMode_Flush(em->bm);
 }
 
-/*EDBM_select_[more/less] are api functions, I think the uv editor
-  uses them? though the select more/less ops themselves do not.*/
-static void EDBM_select_more(BMEditMesh *em)
+void EDBM_select_more(BMEditMesh *em)
 {
        BMOperator bmop;
        int usefaces = em->selectmode > SCE_SELECT_EDGE;
@@ -451,7 +449,7 @@ static void EDBM_select_more(BMEditMesh *em)
        EDBM_selectmode_flush(em);
 }
 
-static void EDBM_select_less(BMEditMesh *em)
+void EDBM_select_less(BMEditMesh *em)
 {
        BMOperator bmop;
        int usefaces = em->selectmode > SCE_SELECT_EDGE;
index 3962768222db83ebe648a1a5ef07b11fac9cffcb..4885751b7f6ba166e5c5f69b0a8e631a59d0222f 100644 (file)
@@ -162,26 +162,6 @@ static int facesel_face_pick(struct bContext *C, Mesh *me, Object *ob, const int
        return 1;
 }
 
-/* last_sel, use em->act_face otherwise get the last selected face in the editselections
- * at the moment, last_sel is mainly useful for gaking sure the space image dosnt flicker */
-static MTexPoly *EDBM_get_active_mtface(BMEditMesh *em, BMFace **act_efa, int sloppy)
-{
-       BMFace *efa = NULL;
-       
-       if(!EDBM_texFaceCheck(em))
-               return NULL;
-       
-       efa = BM_get_actFace(em->bm, sloppy);
-       
-       if (efa) {
-               if (act_efa) *act_efa = efa; 
-               return CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
-       }
-
-       if (act_efa) *act_efa= NULL;
-       return NULL;
-}
-
 void paintface_hide(Object *ob, const int unselected)
 {
        Mesh *me;
@@ -422,26 +402,6 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
        }
 }
 
-static void selectswap_tface(Scene *scene)
-{
-       Mesh *me;
-       MPoly *mface;
-       int a;
-               
-       me= get_mesh(OBACT);
-       if(me==0) return;
-       
-       mface= me->mpoly;
-       a= me->totpoly;
-       while(a--) {
-               if(mface->flag & ME_HIDE);
-               else {
-                       if(mface->flag & ME_FACE_SEL) mface->flag &= ~ME_FACE_SEL;
-                       else mface->flag |= ME_FACE_SEL;
-               }
-       }
-}
-
 int paintface_minmax(Object *ob, float *min, float *max)
 {
        Mesh *me;
index 2f863d5f9ab2310c77868c070f55168a07945d54..2b3be42ac674d8897a413a4c41777ef1c7d15399 100644 (file)
@@ -1007,14 +1007,16 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, struct BMEditMesh *e
 
 BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, float *co, int index)
 {
-       //BMESH_TODO use this flag, ME_EDIT_MIRROR_TOPO, at appropriate places
        if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) {
                return editbmesh_get_x_mirror_vert_topo(ob, em, eve, index);
-       } else {
+       }
+       else {
                return editbmesh_get_x_mirror_vert_spacial(ob, em, co);
        }
 }
 
+#if 0
+
 static float *editmesh_get_mirror_uv(BMEditMesh *em, int axis, float *uv, float *mirrCent, float *face_cent)
 {
        float vec[2];
@@ -1067,6 +1069,8 @@ static float *editmesh_get_mirror_uv(BMEditMesh *em, int axis, float *uv, float
        return NULL;
 }
 
+#endif
+
 static unsigned int mirror_facehash(const void *ptr)
 {
        const MFace *mf= ptr;