Merge branch 'blender2.7'
[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 #include "DNA_scene_types.h"
32
33 #include "RNA_access.h"
34
35 #include "WM_api.h"
36 #include "WM_types.h"
37
38 #include "ED_mball.h"
39 #include "ED_screen.h"
40 #include "ED_select_utils.h"
41 #include "ED_object.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_similar);
55         WM_operatortype_append(MBALL_OT_select_random_metaelems);
56 }
57
58 void ED_operatormacros_metaball(void)
59 {
60         wmOperatorType *ot;
61         wmOperatorTypeMacro *otmacro;
62
63         ot = WM_operatortype_append_macro("MBALL_OT_duplicate_move", "Duplicate",
64                                           "Make copies of the selected metaelements and move them",
65                                           OPTYPE_UNDO | OPTYPE_REGISTER);
66         WM_operatortype_macro_define(ot, "MBALL_OT_duplicate_metaelems");
67         otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
68         RNA_enum_set(otmacro->ptr, "proportional", 0);
69 }
70
71 void ED_keymap_metaball(wmKeyConfig *keyconf)
72 {
73         wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Metaball", 0, 0);
74         keymap->poll = ED_operator_editmball;
75 }