Make Ctrl+RMB in editmode behave like 2.4x, was re-using center option which worked...
[blender-staging.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_ndof_orbit);
68         WM_operatortype_append(VIEW3D_OT_ndof_pan);
69         WM_operatortype_append(VIEW3D_OT_view_all);
70         WM_operatortype_append(VIEW3D_OT_viewnumpad);
71         WM_operatortype_append(VIEW3D_OT_view_orbit);
72         WM_operatortype_append(VIEW3D_OT_view_pan);
73         WM_operatortype_append(VIEW3D_OT_view_persportho);
74         WM_operatortype_append(VIEW3D_OT_background_image_add);
75         WM_operatortype_append(VIEW3D_OT_background_image_remove);
76         WM_operatortype_append(VIEW3D_OT_view_selected);
77         WM_operatortype_append(VIEW3D_OT_view_center_cursor);
78         WM_operatortype_append(VIEW3D_OT_view_center_camera);
79         WM_operatortype_append(VIEW3D_OT_select);
80         WM_operatortype_append(VIEW3D_OT_select_border);
81         WM_operatortype_append(VIEW3D_OT_clip_border);
82         WM_operatortype_append(VIEW3D_OT_select_circle);
83         WM_operatortype_append(VIEW3D_OT_smoothview);
84         WM_operatortype_append(VIEW3D_OT_render_border);
85         WM_operatortype_append(VIEW3D_OT_zoom_border);
86         WM_operatortype_append(VIEW3D_OT_manipulator);
87         WM_operatortype_append(VIEW3D_OT_enable_manipulator);
88         WM_operatortype_append(VIEW3D_OT_cursor3d);
89         WM_operatortype_append(VIEW3D_OT_select_lasso);
90         WM_operatortype_append(VIEW3D_OT_setcameratoview);
91         WM_operatortype_append(VIEW3D_OT_object_as_camera);
92         WM_operatortype_append(VIEW3D_OT_localview);
93         WM_operatortype_append(VIEW3D_OT_game_start);
94         WM_operatortype_append(VIEW3D_OT_fly);
95         WM_operatortype_append(VIEW3D_OT_layers);
96         
97         WM_operatortype_append(VIEW3D_OT_properties);
98         WM_operatortype_append(VIEW3D_OT_toolshelf);
99         
100         WM_operatortype_append(VIEW3D_OT_snap_selected_to_grid);
101         WM_operatortype_append(VIEW3D_OT_snap_selected_to_cursor);
102         WM_operatortype_append(VIEW3D_OT_snap_cursor_to_grid);
103         WM_operatortype_append(VIEW3D_OT_snap_cursor_to_center);
104         WM_operatortype_append(VIEW3D_OT_snap_cursor_to_selected);
105         WM_operatortype_append(VIEW3D_OT_snap_cursor_to_active);
106                 
107         transform_operatortypes();
108 }
109
110 void view3d_keymap(wmKeyConfig *keyconf)
111 {
112         wmKeyMap *keymap;
113         wmKeyMapItem *kmi;
114         
115         keymap= WM_keymap_find(keyconf, "3D View Generic", SPACE_VIEW3D, 0);
116         
117         WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0);
118         WM_keymap_add_item(keymap, "VIEW3D_OT_toolshelf", TKEY, KM_PRESS, 0, 0);
119         
120         /* only for region 3D window */
121         keymap= WM_keymap_find(keyconf, "3D View", SPACE_VIEW3D, 0);
122         
123         kmi = WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_ANY, 0);
124         RNA_boolean_set(kmi->ptr, "release_confirm", 1);
125         /*
126          * Doesn't work with KM_SHIFT, have to use KM_ANY and filter in invoke
127          * */
128         // WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
129         
130         WM_keymap_verify_item(keymap, "VIEW3D_OT_cursor3d", ACTIONMOUSE, KM_PRESS, 0, 0);
131         
132         WM_keymap_verify_item(keymap, "VIEW3D_OT_rotate", MIDDLEMOUSE, KM_PRESS, 0, 0);
133         WM_keymap_verify_item(keymap, "VIEW3D_OT_move", MIDDLEMOUSE, KM_PRESS, KM_SHIFT, 0);
134         WM_keymap_verify_item(keymap, "VIEW3D_OT_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0);
135         WM_keymap_verify_item(keymap, "VIEW3D_OT_dolly", MIDDLEMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
136         WM_keymap_verify_item(keymap, "VIEW3D_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
137         WM_keymap_verify_item(keymap, "VIEW3D_OT_view_center_cursor", PADPERIOD, KM_PRESS, KM_CTRL, 0);
138         
139         WM_keymap_verify_item(keymap, "VIEW3D_OT_fly", FKEY, KM_PRESS, KM_SHIFT, 0);
140
141         WM_keymap_verify_item(keymap, "VIEW3D_OT_smoothview", TIMER1, KM_ANY, KM_ANY, 0);
142         
143         WM_keymap_add_item(keymap, "VIEW3D_OT_rotate", MOUSEPAN, 0, KM_ALT, 0);
144         WM_keymap_add_item(keymap, "VIEW3D_OT_rotate", MOUSEROTATE, 0, 0, 0);
145         WM_keymap_add_item(keymap, "VIEW3D_OT_move", MOUSEPAN, 0, 0, 0);
146         WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MOUSEZOOM, 0, 0, 0);
147         
148         /*numpad +/-*/
149         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADPLUSKEY, KM_PRESS, 0, 0)->ptr, "delta", 1);
150         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADMINUS, KM_PRESS, 0, 0)->ptr, "delta", -1);
151
152         /*ctrl +/-*/
153         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", EQUALKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", 1);
154         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MINUSKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", -1);
155         
156         /*wheel mouse forward/back*/
157         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELINMOUSE, KM_PRESS, 0, 0)->ptr, "delta", 1);
158         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELOUTMOUSE, KM_PRESS, 0, 0)->ptr, "delta", -1);
159
160         WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_camera_1_to_1", PADENTER, KM_PRESS, KM_SHIFT, 0);
161
162         WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_camera", HOMEKEY, KM_PRESS, 0, 0); /* only with camera view */
163         RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, 0, 0)->ptr, "center", 0); /* only without camera view */
164         RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", CKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "center", 1);
165
166         /* 3D mouse */
167         WM_keymap_add_item(keymap, "VIEW3D_OT_ndof_orbit", NDOF_MOTION, 0, 0, 0);
168         WM_keymap_add_item(keymap, "VIEW3D_OT_ndof_pan", NDOF_MOTION, 0, KM_SHIFT, 0);
169         WM_keymap_add_item(keymap, "VIEW3D_OT_view_selected", NDOF_BUTTON_FIT, KM_PRESS, 0, 0);
170         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_FRONT, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_FRONT);
171         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_BACK, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_BACK);
172         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_LEFT, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_LEFT);
173         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_RIGHT, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_RIGHT);
174         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_TOP, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_TOP);
175         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_BOTTOM, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_BOTTOM);
176
177         /* numpad view hotkeys*/
178         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD0, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_CAMERA);
179         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_FRONT);
180         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD2, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPDOWN);
181         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_RIGHT);
182         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD4, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
183         WM_keymap_add_item(keymap, "VIEW3D_OT_view_persportho", PAD5, KM_PRESS, 0, 0);
184         
185         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD6, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
186         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_TOP);
187         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD8, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPUP);
188         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_BACK);
189         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_LEFT);
190         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_BOTTOM);
191         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD2, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANDOWN);
192         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD4, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANLEFT);
193         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD6, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANRIGHT);
194         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD8, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANUP);
195         
196         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELUPMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANRIGHT);
197         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANLEFT);
198         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELUPMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", V3D_VIEW_PANUP);
199         RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", V3D_VIEW_PANDOWN);
200
201         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);
202         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);
203         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);
204         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);
205         
206         /* active aligned, replaces '*' key in 2.4x */
207         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT, 0);
208         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
209         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
210         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT, 0);
211         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_RIGHT);
212         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
213         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT, 0);
214         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_TOP);
215         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
216         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
217         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BACK);
218         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
219         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
220         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_LEFT);
221         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
222         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
223         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BOTTOM);
224         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
225
226         /* 3D mouse align */
227         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_FRONT, KM_PRESS, KM_SHIFT, 0);
228         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
229         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
230         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_RIGHT, KM_PRESS, KM_SHIFT, 0);
231         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_RIGHT);
232         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
233         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_TOP, KM_PRESS, KM_SHIFT, 0);
234         RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_TOP);
235         RNA_boolean_set(kmi->ptr, "align_active", TRUE);
236
237         WM_keymap_add_item(keymap, "VIEW3D_OT_localview", PADSLASHKEY, KM_PRESS, 0, 0);
238         
239         /* layers, shift + alt are properties set in invoke() */
240         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ACCENTGRAVEKEY, KM_PRESS, 0, 0)->ptr, "nr", 0);
241         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ONEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 1);
242         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", TWOKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 2);
243         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", THREEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 3);
244         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", FOURKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 4);
245         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", FIVEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 5);
246         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", SIXKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 6);
247         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", SEVENKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 7);
248         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", EIGHTKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 8);
249         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", NINEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 9);
250         RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ZEROKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 10);
251         
252         /* drawtype */
253
254         kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", ZKEY, KM_PRESS, 0, 0);
255         RNA_string_set(kmi->ptr, "data_path", "space_data.viewport_shade");
256         RNA_string_set(kmi->ptr, "value_1", "SOLID");
257         RNA_string_set(kmi->ptr, "value_2", "WIREFRAME");
258
259         kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", ZKEY, KM_PRESS, KM_ALT, 0);
260         RNA_string_set(kmi->ptr, "data_path", "space_data.viewport_shade");
261         RNA_string_set(kmi->ptr, "value_1", "TEXTURED");
262         RNA_string_set(kmi->ptr, "value_2", "SOLID");
263
264         /* selection*/
265         WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
266         kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
267         RNA_boolean_set(kmi->ptr, "extend", TRUE);
268         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
269         RNA_boolean_set(kmi->ptr, "center", TRUE);
270         RNA_boolean_set(kmi->ptr, "object", TRUE); /* use Ctrl+Select for 2 purposes */
271         kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
272         RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
273
274         /* selection key-combinations */
275         kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
276         RNA_boolean_set(kmi->ptr, "center", TRUE);
277         RNA_boolean_set(kmi->ptr, "extend", TRUE);
278         kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
279         RNA_boolean_set(kmi->ptr, "center", TRUE);
280         RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
281         kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
282         RNA_boolean_set(kmi->ptr, "extend", TRUE);
283         RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
284         kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL|KM_ALT, 0);
285         RNA_boolean_set(kmi->ptr, "center", TRUE);
286         RNA_boolean_set(kmi->ptr, "extend", TRUE);
287         RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
288
289         WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 0, 0);
290         WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
291         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);
292         WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0);
293         
294         WM_keymap_add_item(keymap, "VIEW3D_OT_clip_border", BKEY, KM_PRESS, KM_ALT, 0);
295         WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_border", BKEY, KM_PRESS, KM_SHIFT, 0);
296         WM_keymap_add_item(keymap, "VIEW3D_OT_render_border", BKEY, KM_PRESS, KM_SHIFT, 0);
297         
298         WM_keymap_add_item(keymap, "VIEW3D_OT_camera_to_view", PAD0, KM_PRESS, KM_ALT|KM_CTRL, 0);
299         WM_keymap_add_item(keymap, "VIEW3D_OT_object_as_camera", PAD0, KM_PRESS, KM_CTRL, 0);
300         
301         WM_keymap_add_menu(keymap, "VIEW3D_MT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
302         
303         /* context ops */
304         kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, 0, 0);
305         RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
306         RNA_string_set(kmi->ptr, "value", "BOUNDING_BOX_CENTER");
307
308         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 */
309         RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
310         RNA_string_set(kmi->ptr, "value", "MEDIAN_POINT");
311
312         kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", COMMAKEY, KM_PRESS, KM_ALT, 0); /* new in 2.5 */
313         RNA_string_set(kmi->ptr, "data_path", "space_data.use_pivot_point_align");
314
315         kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SPACEKEY, KM_PRESS, KM_CTRL, 0); /* new in 2.5 */
316         RNA_string_set(kmi->ptr, "data_path", "space_data.show_manipulator");
317
318         kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, 0, 0);
319         RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
320         RNA_string_set(kmi->ptr, "value", "CURSOR");
321
322         kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, KM_CTRL, 0);
323         RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
324         RNA_string_set(kmi->ptr, "value", "INDIVIDUAL_ORIGINS");
325
326         kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, KM_ALT, 0);
327         RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
328         RNA_string_set(kmi->ptr, "value", "ACTIVE_ELEMENT");
329
330         transform_keymap_for_space(keyconf, keymap, SPACE_VIEW3D);
331
332         fly_modal_keymap(keyconf);
333         viewrotate_modal_keymap(keyconf);
334         viewmove_modal_keymap(keyconf);
335         viewzoom_modal_keymap(keyconf);
336         viewdolly_modal_keymap(keyconf);
337 }
338