remove remaining event recording code
[blender.git] / source / blender / editors / space_view3d / view3d_ops.c
1 /*
2  * $Id$
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version. 
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *
20  * The Original Code is Copyright (C) 2008 Blender Foundation.
21  * All rights reserved.
22  *
23  * 
24  * Contributor(s): Blender Foundation
25  *
26  * ***** END GPL LICENSE BLOCK *****
27  */
28
29 /** \file blender/editors/space_view3d/view3d_ops.c
30  *  \ingroup spview3d
31  */
32
33
34 #include <stdlib.h>
35 #include <math.h>
36
37
38 #include "DNA_object_types.h"
39 #include "DNA_scene_types.h"
40 #include "DNA_screen_types.h"
41 #include "DNA_space_types.h"
42 #include "DNA_view3d_types.h"
43
44 #include "BLI_math.h"
45 #include "BLI_blenlib.h"
46 #include "BLI_utildefines.h"
47
48 #include "RNA_access.h"
49
50 #include "WM_api.h"
51 #include "WM_types.h"
52
53 #include "ED_transform.h"
54
55 #include "view3d_intern.h"
56
57
58 /* ************************** registration **********************************/
59
60 void view3d_operatortypes(void)
61 {
62         WM_operatortype_append(VIEW3D_OT_rotate);
63         WM_operatortype_append(VIEW3D_OT_move);
64         WM_operatortype_append(VIEW3D_OT_zoom);
65         WM_operatortype_append(VIEW3D_OT_zoom_camera_1_to_1);
66         WM_operatortype_append(VIEW3D_OT_dolly);
67         WM_operatortype_append(VIEW3D_OT_view_all);
68         WM_operatortype_append(VIEW3D_OT_viewnumpad);
69         WM_operatortype_append(VIEW3D_OT_view_orbit);
70         WM_operatortype_append(VIEW3D_OT_view_pan);
71         WM_operatortype_append(VIEW3D_OT_view_persportho);
72         WM_operatortype_append(VIEW3D_OT_background_image_add);
73         WM_operatortype_append(VIEW3D_OT_background_image_remove);
74         WM_operatortype_append(VIEW3D_OT_view_selected);
75         WM_operatortype_append(VIEW3D_OT_view_center_cursor);
76         WM_operatortype_append(VIEW3D_OT_view_center_camera);
77         WM_operatortype_append(VIEW3D_OT_select);
78         WM_operatortype_append(VIEW3D_OT_select_border);
79         WM_operatortype_append(VIEW3D_OT_clip_border);
80         WM_operatortype_append(VIEW3D_OT_select_circle);
81         WM_operatortype_append(VIEW3D_OT_smoothview);
82         WM_operatortype_append(VIEW3D_OT_render_border);
83         WM_operatortype_append(VIEW3D_OT_zoom_border);
84         WM_operatortype_append(VIEW3D_OT_manipulator);
85         WM_operatortype_append(VIEW3D_OT_enable_manipulator);
86         WM_operatortype_append(VIEW3D_OT_cursor3d);
87         WM_operatortype_append(VIEW3D_OT_select_lasso);
88         WM_operatortype_append(VIEW3D_OT_setcameratoview);
89         WM_operatortype_append(VIEW3D_OT_object_as_camera);
90         WM_operatortype_append(VIEW3D_OT_localview);
91         WM_operatortype_append(VIEW3D_OT_game_start);
92         WM_operatortype_append(VIEW3D_OT_fly);
93         WM_operatortype_append(VIEW3D_OT_layers);
94         
95         WM_operatortype_append(VIEW3D_OT_properties);
96         WM_operatortype_append(VIEW3D_OT_toolshelf);
97         
98         WM_operatortype_append(VIEW3D_OT_snap_selected_to_grid);
99         WM_operatortype_append(VIEW3D_OT_snap_selected_to_cursor);
100         WM_operatortype_append(VIEW3D_OT_snap_cursor_to_grid);
101         WM_operatortype_append(VIEW3D_OT_snap_cursor_to_center);
102         WM_operatortype_append(VIEW3D_OT_snap_cursor_to_selected);
103         WM_operatortype_append(VIEW3D_OT_snap_cursor_to_active);
104                 
105         transform_operatortypes();
106 }
107
108 void view3d_keymap(wmKeyConfig *keyconf)
109 {
110         wmKeyMap *keymap;
111         wmKeyMapItem *kmi;
112         
113         keymap= WM_keymap_find(keyconf, "3D View Generic", SPACE_VIEW3D, 0);
114         
115         WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0);
116         WM_keymap_add_item(keymap, "VIEW3D_OT_toolshelf", TKEY, KM_PRESS, 0, 0);
117         
118         /* only for region 3D window */
119         keymap= WM_keymap_find(keyconf, "3D View", SPACE_VIEW3D, 0);
120         
121         kmi = WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_ANY, 0);
122         RNA_boolean_set(kmi->ptr, "release_confirm", 1);
123         /*
124          * Doesn't work with KM_SHIFT, have to use KM_ANY and filter in invoke
125          * */
126         // WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
127         
128         WM_keymap_verify_item(keymap, "VIEW3D_OT_cursor3d", ACTIONMOUSE, KM_PRESS, 0, 0);
129         
130         WM_keymap_verify_item(keymap, "VIEW3D_OT_rotate", MIDDLEMOUSE, KM_PRESS, 0, 0);
131         WM_keymap_verify_item(keymap, "VIEW3D_OT_move", MIDDLEMOUSE, KM_PRESS, KM_SHIFT, 0);
132         WM_keymap_verify_item(keymap, "VIEW3D_OT_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0);
133         WM_keymap_verify_item(keymap, "VIEW3D_OT_dolly", MIDDLEMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
134         WM_keymap_verify_item(keymap, "VIEW3D_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
135         WM_keymap_verify_item(keymap, "VIEW3D_OT_view_center_cursor", PADPERIOD, KM_PRESS, KM_CTRL, 0);
136         
137         WM_keymap_verify_item(keymap, "VIEW3D_OT_fly", FKEY, KM_PRESS, KM_SHIFT, 0);
138
139         WM_keymap_verify_item(keymap, "VIEW3D_OT_smoothview", TIMER1, KM_ANY, KM_ANY, 0);
140         
141         WM_keymap_add_item(keymap, "VIEW3D_OT_rotate", MOUSEPAN, 0, KM_ALT, 0);
142         WM_keymap_add_item(keymap, "VIEW3D_OT_rotate", MOUSEROTATE, 0, 0, 0);
143         WM_keymap_add_item(keymap, "VIEW3D_OT_move", MOUSEPAN, 0, 0, 0);
144         WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MOUSEZOOM, 0, 0, 0);
145         
146         /*numpad +/-*/
147         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADPLUSKEY, KM_PRESS, 0, 0)->ptr, "delta", 1);
148         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADMINUS, KM_PRESS, 0, 0)->ptr, "delta", -1);
149
150         /*ctrl +/-*/
151         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", EQUALKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", 1);
152         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MINUSKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", -1);
153         
154         /*wheel mouse forward/back*/
155         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELINMOUSE, KM_PRESS, 0, 0)->ptr, "delta", 1);
156         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELOUTMOUSE, KM_PRESS, 0, 0)->ptr, "delta", -1);
157
158         WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_camera_1_to_1", PADENTER, KM_PRESS, KM_SHIFT, 0);
159
160         WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_camera", HOMEKEY, KM_PRESS, 0, 0); /* only with camera view */
161         RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, 0, 0)->ptr, "center", 0); /* only without camera view */
162         RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", CKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "center", 1);
163
164         /* numpad view hotkeys*/
165         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD0, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_CAMERA);
166         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_FRONT);
167         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD2, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPDOWN);
168         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_RIGHT);
169         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD4, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
170         WM_keymap_add_item(keymap, "VIEW3D_OT_view_persportho", PAD5, KM_PRESS, 0, 0);
171         
172         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD6, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
173         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_TOP);
174         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD8, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPUP);
175         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_BACK);
176         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_LEFT);
177         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_BOTTOM);
178         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD2, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANDOWN);
179         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD4, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANLEFT);
180         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD6, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANRIGHT);
181         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD8, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANUP);
182         
183         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELUPMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANRIGHT);
184         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANLEFT);
185         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELUPMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", V3D_VIEW_PANUP);
186         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", V3D_VIEW_PANDOWN);
187
188         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELUPMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
189         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
190         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELUPMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPUP);
191         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPDOWN);
192         
193         /* active aligned, replaces '*' key in 2.4x */
194         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT, 0);
195         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
196         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
197         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT, 0);
198         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_RIGHT);
199         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
200         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT, 0);
201         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_TOP);
202         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
203         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
204         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BACK);
205         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
206         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
207         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_LEFT);
208         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
209         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
210         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BOTTOM);
211         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
212
213         WM_keymap_add_item(keymap, "VIEW3D_OT_localview", PADSLASHKEY, KM_PRESS, 0, 0);
214         
215         /* layers, shift + alt are properties set in invoke() */
216         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ACCENTGRAVEKEY, KM_PRESS, 0, 0)->ptr, "nr", 0);
217         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ONEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 1);
218         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", TWOKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 2);
219         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", THREEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 3);
220         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", FOURKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 4);
221         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", FIVEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 5);
222         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", SIXKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 6);
223         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", SEVENKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 7);
224         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", EIGHTKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 8);
225         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", NINEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 9);
226         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ZEROKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 10);
227         
228         /* drawtype */
229
230         kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", ZKEY, KM_PRESS, 0, 0);
231         RNA_string_set(kmi->ptr, "data_path", "space_data.viewport_shade");
232         RNA_string_set(kmi->ptr, "value_1", "SOLID");
233         RNA_string_set(kmi->ptr, "value_2", "WIREFRAME");
234
235         kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", ZKEY, KM_PRESS, KM_ALT, 0);
236         RNA_string_set(kmi->ptr, "data_path", "space_data.viewport_shade");
237         RNA_string_set(kmi->ptr, "value_1", "TEXTURED");
238         RNA_string_set(kmi->ptr, "value_2", "SOLID");
239
240         /* selection*/
241         WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
242         RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE);
243         RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "center", TRUE);
244         RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "enumerate", TRUE);
245
246         /* selection key-combinations */
247         kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
248         RNA_boolean_set(kmi->ptr, "center", TRUE);
249         RNA_boolean_set(kmi->ptr, "extend", TRUE);
250         kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
251         RNA_boolean_set(kmi->ptr, "center", TRUE);
252         RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
253         kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
254         RNA_boolean_set(kmi->ptr, "extend", TRUE);
255         RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
256         kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL|KM_ALT, 0);
257         RNA_boolean_set(kmi->ptr, "center", TRUE);
258         RNA_boolean_set(kmi->ptr, "extend", TRUE);
259         RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
260
261         WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 0, 0);
262         WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
263         RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT|KM_CTRL, 0)->ptr, "deselect", 1);
264         WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0);
265         
266         WM_keymap_add_item(keymap, "VIEW3D_OT_clip_border", BKEY, KM_PRESS, KM_ALT, 0);
267         WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_border", BKEY, KM_PRESS, KM_SHIFT, 0);
268         WM_keymap_add_item(keymap, "VIEW3D_OT_render_border", BKEY, KM_PRESS, KM_SHIFT, 0);
269         
270         WM_keymap_add_item(keymap, "VIEW3D_OT_camera_to_view", PAD0, KM_PRESS, KM_ALT|KM_CTRL, 0);
271         WM_keymap_add_item(keymap, "VIEW3D_OT_object_as_camera", PAD0, KM_PRESS, KM_CTRL, 0);
272         
273         WM_keymap_add_menu(keymap, "VIEW3D_MT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
274         
275         /* context ops */
276         kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, 0, 0);
277         RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
278         RNA_string_set(kmi->ptr, "value", "BOUNDING_BOX_CENTER");
279
280         kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, KM_CTRL, 0); /* 2.4x allowed Comma+Shift too, rather not use both */
281         RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
282         RNA_string_set(kmi->ptr, "value", "MEDIAN_POINT");
283
284         kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", COMMAKEY, KM_PRESS, KM_ALT, 0); /* new in 2.5 */
285         RNA_string_set(kmi->ptr, "data_path", "space_data.use_pivot_point_align");
286
287         kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SPACEKEY, KM_PRESS, KM_CTRL, 0); /* new in 2.5 */
288         RNA_string_set(kmi->ptr, "data_path", "space_data.show_manipulator");
289
290         kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, 0, 0);
291         RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
292         RNA_string_set(kmi->ptr, "value", "CURSOR");
293
294         kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, KM_CTRL, 0);
295         RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
296         RNA_string_set(kmi->ptr, "value", "INDIVIDUAL_ORIGINS");
297
298         kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, KM_ALT, 0);
299         RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
300         RNA_string_set(kmi->ptr, "value", "ACTIVE_ELEMENT");
301
302         transform_keymap_for_space(keyconf, keymap, SPACE_VIEW3D);
303
304         fly_modal_keymap(keyconf);
305         viewrotate_modal_keymap(keyconf);
306         viewmove_modal_keymap(keyconf);
307         viewzoom_modal_keymap(keyconf);
308 }
309