- remove UV_OT_select_inverse, instead use invert option for UV_OT_select_all.
[blender-staging.git] / source / blender / editors / uvedit / uvedit_ops.c
index 494cf7dee8365bb0f3d4afe4ca3da8d55c149639..eee7a3d7f69580421b860c2a56ef9f2acdcfe64d 100644 (file)
@@ -1308,59 +1308,6 @@ static void UV_OT_stitch(wmOperatorType *ot)
 
 /* ******************** (de)select all operator **************** */
 
-static int select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
-{
-       Scene *scene;
-       ToolSettings *ts;
-       Object *obedit;
-       EditMesh *em;
-       EditFace *efa;
-       Image *ima;
-       MTFace *tf;
-       
-       scene= CTX_data_scene(C);
-       ts= CTX_data_tool_settings(C);
-       obedit= CTX_data_edit_object(C);
-       em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-       ima= CTX_data_edit_image(C);
-
-       if(ts->uv_flag & UV_SYNC_SELECTION) {
-               EM_select_swap(em);
-       }
-       else {
-               for(efa= em->faces.first; efa; efa= efa->next) {
-                       tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-                       if(uvedit_face_visible(scene, ima, efa, tf)) {
-                               tf->flag ^= TF_SEL1;
-                               tf->flag ^= TF_SEL2;
-                               tf->flag ^= TF_SEL3;
-                               if(efa->v4) tf->flag ^= TF_SEL4;
-                       }
-               }
-       }
-
-       WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-       BKE_mesh_end_editmesh(obedit->data, em);
-       return OPERATOR_FINISHED;
-}
-
-static void UV_OT_select_inverse(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name= "Select Inverse";
-       ot->description= "Select inverse of (un)selected UV vertices";
-       ot->idname= "UV_OT_select_inverse";
-       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-       
-       /* api callbacks */
-       ot->exec= select_inverse_exec;
-       ot->poll= ED_operator_uvedit;
-}
-
-/* ******************** (de)select all operator **************** */
-
 static int select_all_exec(bContext *C, wmOperator *op)
 {
        Scene *scene;
@@ -1425,11 +1372,7 @@ static int select_all_exec(bContext *C, wmOperator *op)
                                        tf->flag &= ~select_flag;
                                        break;
                                case SEL_INVERT:
-                                       if ((tf->flag & select_flag) == select_flag) {
-                                               tf->flag &= ~select_flag;
-                                       } else {
-                                               tf->flag &= ~select_flag;
-                                       }
+                                       tf->flag ^= select_flag;
                                        break;
                                }
                        }
@@ -3196,7 +3139,6 @@ static void UV_OT_tile_set(wmOperatorType *ot)
 void ED_operatortypes_uvedit(void)
 {
        WM_operatortype_append(UV_OT_select_all);
-       WM_operatortype_append(UV_OT_select_inverse);
        WM_operatortype_append(UV_OT_select);
        WM_operatortype_append(UV_OT_select_loop);
        WM_operatortype_append(UV_OT_select_linked);
@@ -3258,7 +3200,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
 
        WM_keymap_add_item(keymap, "UV_OT_unlink_selected", LKEY, KM_PRESS, KM_ALT, 0);
        WM_keymap_add_item(keymap, "UV_OT_select_all", AKEY, KM_PRESS, 0, 0);
-       WM_keymap_add_item(keymap, "UV_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
+       RNA_enum_set(WM_keymap_add_item(keymap, "UV_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0)->ptr, "action", SEL_INVERT);
        WM_keymap_add_item(keymap, "UV_OT_select_pinned", PKEY, KM_PRESS, KM_SHIFT, 0);
 
        WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_weldalign", WKEY, KM_PRESS, 0, 0);