fix for clear line adjusting console selection.
[blender.git] / source / blender / editors / metaball / mball_ops.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version. 
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2008 Blender Foundation.
19  * All rights reserved.
20  *
21  * 
22  * Contributor(s): Blender Foundation
23  *
24  * ***** END GPL LICENSE BLOCK *****
25  */
26
27 /** \file blender/editors/metaball/mball_ops.c
28  *  \ingroup edmeta
29  */
30
31
32 #include "WM_api.h"
33 #include "WM_types.h"
34
35 #include "RNA_access.h"
36
37 #include "ED_mball.h"
38 #include "ED_screen.h"
39 #include "ED_object.h"
40
41 #include "BLI_utildefines.h"
42
43 #include "mball_intern.h"
44
45 void ED_operatortypes_metaball(void)
46 {
47         WM_operatortype_append(MBALL_OT_delete_metaelems);
48         WM_operatortype_append(MBALL_OT_duplicate_metaelems);
49         
50         WM_operatortype_append(MBALL_OT_hide_metaelems);
51         WM_operatortype_append(MBALL_OT_reveal_metaelems);
52         
53         WM_operatortype_append(MBALL_OT_select_all);
54         WM_operatortype_append(MBALL_OT_select_random_metaelems);
55 }
56
57 void ED_keymap_metaball(wmKeyConfig *keyconf)
58 {
59         wmKeyMap *keymap;
60         wmKeyMapItem *kmi;
61         
62         keymap = WM_keymap_find(keyconf, "Metaball", 0, 0);
63         keymap->poll = ED_operator_editmball;
64
65         WM_keymap_add_item(keymap, "OBJECT_OT_metaball_add", AKEY, KM_PRESS, KM_SHIFT, 0);
66         
67         WM_keymap_add_item(keymap, "MBALL_OT_reveal_metaelems", HKEY, KM_PRESS, KM_ALT, 0);
68         kmi = WM_keymap_add_item(keymap, "MBALL_OT_hide_metaelems", HKEY, KM_PRESS, 0, 0);
69         RNA_boolean_set(kmi->ptr, "unselected", FALSE);
70         kmi = WM_keymap_add_item(keymap, "MBALL_OT_hide_metaelems", HKEY, KM_PRESS, KM_SHIFT, 0);
71         RNA_boolean_set(kmi->ptr, "unselected", TRUE);
72         
73         WM_keymap_add_item(keymap, "MBALL_OT_delete_metaelems", XKEY, KM_PRESS, 0, 0);
74         WM_keymap_add_item(keymap, "MBALL_OT_delete_metaelems", DELKEY, KM_PRESS, 0, 0);
75         WM_keymap_add_item(keymap, "MBALL_OT_duplicate_metaelems", DKEY, KM_PRESS, KM_SHIFT, 0);
76         
77         kmi = WM_keymap_add_item(keymap, "MBALL_OT_select_all", AKEY, KM_PRESS, 0, 0);
78         RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
79         kmi = WM_keymap_add_item(keymap, "MBALL_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
80         RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
81
82         ED_keymap_proportional_cycle(keyconf, keymap);
83         ED_keymap_proportional_editmode(keyconf, keymap, TRUE);
84 }
85