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