Blender V2.61 - r43446

view3d_ops.c

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version. 
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2008 Blender Foundation.
00019  * All rights reserved.
00020  *
00021  * 
00022  * Contributor(s): Blender Foundation
00023  *
00024  * ***** END GPL LICENSE BLOCK *****
00025  */
00026 
00032 #include <stdlib.h>
00033 #include <math.h>
00034 
00035 
00036 #include "DNA_object_types.h"
00037 #include "DNA_scene_types.h"
00038 #include "DNA_screen_types.h"
00039 #include "DNA_space_types.h"
00040 #include "DNA_view3d_types.h"
00041 
00042 #include "BLI_math.h"
00043 #include "BLI_blenlib.h"
00044 #include "BLI_utildefines.h"
00045 
00046 #include "RNA_access.h"
00047 
00048 #include "WM_api.h"
00049 #include "WM_types.h"
00050 
00051 #include "ED_transform.h"
00052 
00053 #include "view3d_intern.h"
00054 
00055 
00056 /* ************************** registration **********************************/
00057 
00058 void view3d_operatortypes(void)
00059 {
00060     WM_operatortype_append(VIEW3D_OT_rotate);
00061     WM_operatortype_append(VIEW3D_OT_move);
00062     WM_operatortype_append(VIEW3D_OT_zoom);
00063     WM_operatortype_append(VIEW3D_OT_zoom_camera_1_to_1);
00064     WM_operatortype_append(VIEW3D_OT_dolly);
00065     WM_operatortype_append(VIEW3D_OT_ndof_orbit);
00066     WM_operatortype_append(VIEW3D_OT_ndof_pan);
00067     WM_operatortype_append(VIEW3D_OT_view_all);
00068     WM_operatortype_append(VIEW3D_OT_viewnumpad);
00069     WM_operatortype_append(VIEW3D_OT_view_orbit);
00070     WM_operatortype_append(VIEW3D_OT_view_pan);
00071     WM_operatortype_append(VIEW3D_OT_view_persportho);
00072     WM_operatortype_append(VIEW3D_OT_background_image_add);
00073     WM_operatortype_append(VIEW3D_OT_background_image_remove);
00074     WM_operatortype_append(VIEW3D_OT_view_selected);
00075     WM_operatortype_append(VIEW3D_OT_view_center_cursor);
00076     WM_operatortype_append(VIEW3D_OT_view_center_camera);
00077     WM_operatortype_append(VIEW3D_OT_select);
00078     WM_operatortype_append(VIEW3D_OT_select_border);
00079     WM_operatortype_append(VIEW3D_OT_clip_border);
00080     WM_operatortype_append(VIEW3D_OT_select_circle);
00081     WM_operatortype_append(VIEW3D_OT_smoothview);
00082     WM_operatortype_append(VIEW3D_OT_render_border);
00083     WM_operatortype_append(VIEW3D_OT_zoom_border);
00084     WM_operatortype_append(VIEW3D_OT_manipulator);
00085     WM_operatortype_append(VIEW3D_OT_enable_manipulator);
00086     WM_operatortype_append(VIEW3D_OT_cursor3d);
00087     WM_operatortype_append(VIEW3D_OT_select_lasso);
00088     WM_operatortype_append(VIEW3D_OT_select_menu);
00089     WM_operatortype_append(VIEW3D_OT_camera_to_view);
00090     WM_operatortype_append(VIEW3D_OT_camera_to_view_selected);
00091     WM_operatortype_append(VIEW3D_OT_object_as_camera);
00092     WM_operatortype_append(VIEW3D_OT_localview);
00093     WM_operatortype_append(VIEW3D_OT_game_start);
00094     WM_operatortype_append(VIEW3D_OT_fly);
00095     WM_operatortype_append(VIEW3D_OT_layers);
00096     
00097     WM_operatortype_append(VIEW3D_OT_properties);
00098     WM_operatortype_append(VIEW3D_OT_toolshelf);
00099     
00100     WM_operatortype_append(VIEW3D_OT_snap_selected_to_grid);
00101     WM_operatortype_append(VIEW3D_OT_snap_selected_to_cursor);
00102     WM_operatortype_append(VIEW3D_OT_snap_cursor_to_grid);
00103     WM_operatortype_append(VIEW3D_OT_snap_cursor_to_center);
00104     WM_operatortype_append(VIEW3D_OT_snap_cursor_to_selected);
00105     WM_operatortype_append(VIEW3D_OT_snap_cursor_to_active);
00106         
00107     transform_operatortypes();
00108 }
00109 
00110 void view3d_keymap(wmKeyConfig *keyconf)
00111 {
00112     wmKeyMap *keymap;
00113     wmKeyMapItem *kmi;
00114     
00115     keymap= WM_keymap_find(keyconf, "3D View Generic", SPACE_VIEW3D, 0);
00116     
00117     WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0);
00118     WM_keymap_add_item(keymap, "VIEW3D_OT_toolshelf", TKEY, KM_PRESS, 0, 0);
00119     
00120     /* only for region 3D window */
00121     keymap= WM_keymap_find(keyconf, "3D View", SPACE_VIEW3D, 0);
00122     
00123     kmi = WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_ANY, 0);
00124     RNA_boolean_set(kmi->ptr, "release_confirm", TRUE);
00125     /*
00126      * Doesn't work with KM_SHIFT, have to use KM_ANY and filter in invoke
00127      * */
00128     // WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
00129     
00130     WM_keymap_verify_item(keymap, "VIEW3D_OT_cursor3d", ACTIONMOUSE, KM_PRESS, 0, 0);
00131     
00132     WM_keymap_verify_item(keymap, "VIEW3D_OT_rotate", MIDDLEMOUSE, KM_PRESS, 0, 0);
00133     WM_keymap_verify_item(keymap, "VIEW3D_OT_move", MIDDLEMOUSE, KM_PRESS, KM_SHIFT, 0);
00134     WM_keymap_verify_item(keymap, "VIEW3D_OT_zoom", MIDDLEMOUSE, KM_PRESS, KM_CTRL, 0);
00135     WM_keymap_verify_item(keymap, "VIEW3D_OT_dolly", MIDDLEMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
00136     WM_keymap_verify_item(keymap, "VIEW3D_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
00137     WM_keymap_verify_item(keymap, "VIEW3D_OT_view_center_cursor", PADPERIOD, KM_PRESS, KM_CTRL, 0);
00138     
00139     WM_keymap_verify_item(keymap, "VIEW3D_OT_fly", FKEY, KM_PRESS, KM_SHIFT, 0);
00140 
00141     WM_keymap_verify_item(keymap, "VIEW3D_OT_smoothview", TIMER1, KM_ANY, KM_ANY, 0);
00142     
00143     WM_keymap_add_item(keymap, "VIEW3D_OT_rotate", MOUSEPAN, 0, KM_ALT, 0);
00144     WM_keymap_add_item(keymap, "VIEW3D_OT_rotate", MOUSEROTATE, 0, 0, 0);
00145     WM_keymap_add_item(keymap, "VIEW3D_OT_move", MOUSEPAN, 0, 0, 0);
00146     WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MOUSEZOOM, 0, 0, 0);
00147     
00148     /*numpad +/-*/
00149     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADPLUSKEY, KM_PRESS, 0, 0)->ptr, "delta", 1);
00150     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADMINUS, KM_PRESS, 0, 0)->ptr, "delta", -1);
00151 
00152     /*ctrl +/-*/
00153     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", EQUALKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", 1);
00154     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MINUSKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", -1);
00155     
00156     /*wheel mouse forward/back*/
00157     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELINMOUSE, KM_PRESS, 0, 0)->ptr, "delta", 1);
00158     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELOUTMOUSE, KM_PRESS, 0, 0)->ptr, "delta", -1);
00159 
00160     WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_camera_1_to_1", PADENTER, KM_PRESS, KM_SHIFT, 0);
00161 
00162     WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_camera", HOMEKEY, KM_PRESS, 0, 0); /* only with camera view */
00163 
00164     kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
00165     RNA_boolean_set(kmi->ptr, "center", FALSE); /* only without camera view */
00166     kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", CKEY, KM_PRESS, KM_SHIFT, 0);
00167     RNA_boolean_set(kmi->ptr, "center", TRUE);
00168 
00169     /* numpad view hotkeys*/
00170     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD0, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_CAMERA);
00171     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_FRONT);
00172     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD2, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPDOWN);
00173     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_RIGHT);
00174     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD4, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
00175     WM_keymap_add_item(keymap, "VIEW3D_OT_view_persportho", PAD5, KM_PRESS, 0, 0);
00176     
00177     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD6, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
00178     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_TOP);
00179     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD8, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPUP);
00180     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_BACK);
00181     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_LEFT);
00182     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_BOTTOM);
00183     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD2, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANDOWN);
00184     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD4, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANLEFT);
00185     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD6, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANRIGHT);
00186     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD8, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANUP);
00187     
00188     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELUPMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANRIGHT);
00189     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANLEFT);
00190     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELUPMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", V3D_VIEW_PANUP);
00191     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", V3D_VIEW_PANDOWN);
00192 
00193     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);
00194     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);
00195     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);
00196     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);
00197     
00198     /* active aligned, replaces '*' key in 2.4x */
00199     kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT, 0);
00200     RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
00201     RNA_boolean_set(kmi->ptr, "align_active", TRUE);
00202     kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT, 0);
00203     RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_RIGHT);
00204     RNA_boolean_set(kmi->ptr, "align_active", TRUE);
00205     kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT, 0);
00206     RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_TOP);
00207     RNA_boolean_set(kmi->ptr, "align_active", TRUE);
00208     kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
00209     RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BACK);
00210     RNA_boolean_set(kmi->ptr, "align_active", TRUE);
00211     kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
00212     RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_LEFT);
00213     RNA_boolean_set(kmi->ptr, "align_active", TRUE);
00214     kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
00215     RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BOTTOM);
00216     RNA_boolean_set(kmi->ptr, "align_active", TRUE);
00217     
00218     /* 3D mouse */
00219     WM_keymap_add_item(keymap, "VIEW3D_OT_ndof_orbit", NDOF_MOTION, 0, 0, 0);
00220     WM_keymap_add_item(keymap, "VIEW3D_OT_ndof_pan", NDOF_MOTION, 0, KM_SHIFT, 0);
00221     WM_keymap_add_item(keymap, "VIEW3D_OT_view_selected", NDOF_BUTTON_FIT, KM_PRESS, 0, 0);
00222     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_FRONT, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_FRONT);
00223     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_BACK, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_BACK);
00224     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_LEFT, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_LEFT);
00225     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_RIGHT, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_RIGHT);
00226     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_TOP, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_TOP);
00227     RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_BOTTOM, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_BOTTOM);
00228 
00229     /* 3D mouse align */
00230     kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_FRONT, KM_PRESS, KM_SHIFT, 0);
00231     RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
00232     RNA_boolean_set(kmi->ptr, "align_active", TRUE);
00233     kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_RIGHT, KM_PRESS, KM_SHIFT, 0);
00234     RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_RIGHT);
00235     RNA_boolean_set(kmi->ptr, "align_active", TRUE);
00236     kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_TOP, KM_PRESS, KM_SHIFT, 0);
00237     RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_TOP);
00238     RNA_boolean_set(kmi->ptr, "align_active", TRUE);
00239 
00240     WM_keymap_add_item(keymap, "VIEW3D_OT_localview", PADSLASHKEY, KM_PRESS, 0, 0);
00241     
00242     /* layers, shift + alt are properties set in invoke() */
00243     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ACCENTGRAVEKEY, KM_PRESS, 0, 0)->ptr, "nr", 0);
00244     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ONEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 1);
00245     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", TWOKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 2);
00246     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", THREEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 3);
00247     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", FOURKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 4);
00248     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", FIVEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 5);
00249     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", SIXKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 6);
00250     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", SEVENKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 7);
00251     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", EIGHTKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 8);
00252     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", NINEKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 9);
00253     RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_layers", ZEROKEY, KM_PRESS, KM_ANY, 0)->ptr, "nr", 10);
00254     
00255     /* drawtype */
00256 
00257     kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", ZKEY, KM_PRESS, 0, 0);
00258     RNA_string_set(kmi->ptr, "data_path", "space_data.viewport_shade");
00259     RNA_string_set(kmi->ptr, "value_1", "SOLID");
00260     RNA_string_set(kmi->ptr, "value_2", "WIREFRAME");
00261 
00262     kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", ZKEY, KM_PRESS, KM_ALT, 0);
00263     RNA_string_set(kmi->ptr, "data_path", "space_data.viewport_shade");
00264     RNA_string_set(kmi->ptr, "value_1", "TEXTURED");
00265     RNA_string_set(kmi->ptr, "value_2", "SOLID");
00266 
00267     /* selection*/
00268     kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
00269     RNA_boolean_set(kmi->ptr, "extend", FALSE);
00270     RNA_boolean_set(kmi->ptr, "center", FALSE);
00271     RNA_boolean_set(kmi->ptr, "object", FALSE);
00272     RNA_boolean_set(kmi->ptr, "enumerate", FALSE);
00273     kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
00274     RNA_boolean_set(kmi->ptr, "extend", TRUE);
00275     RNA_boolean_set(kmi->ptr, "center", FALSE);
00276     RNA_boolean_set(kmi->ptr, "object", FALSE);
00277     RNA_boolean_set(kmi->ptr, "enumerate", FALSE);
00278     kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
00279     RNA_boolean_set(kmi->ptr, "extend", FALSE);
00280     RNA_boolean_set(kmi->ptr, "center", TRUE);
00281     RNA_boolean_set(kmi->ptr, "object", TRUE); /* use Ctrl+Select for 2 purposes */
00282     RNA_boolean_set(kmi->ptr, "enumerate", FALSE);
00283     kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
00284     RNA_boolean_set(kmi->ptr, "extend", FALSE);
00285     RNA_boolean_set(kmi->ptr, "center", FALSE);
00286     RNA_boolean_set(kmi->ptr, "object", FALSE);
00287     RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
00288 
00289     /* selection key-combinations */
00290     kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
00291     RNA_boolean_set(kmi->ptr, "extend", TRUE);
00292     RNA_boolean_set(kmi->ptr, "center", TRUE);
00293     RNA_boolean_set(kmi->ptr, "object", FALSE);
00294     RNA_boolean_set(kmi->ptr, "enumerate", FALSE);
00295     kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
00296     RNA_boolean_set(kmi->ptr, "extend", FALSE);
00297     RNA_boolean_set(kmi->ptr, "center", TRUE);
00298     RNA_boolean_set(kmi->ptr, "object", FALSE);
00299     RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
00300     kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
00301     RNA_boolean_set(kmi->ptr, "extend", TRUE);
00302     RNA_boolean_set(kmi->ptr, "center", FALSE);
00303     RNA_boolean_set(kmi->ptr, "object", FALSE);
00304     RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
00305     kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL|KM_ALT, 0);
00306     RNA_boolean_set(kmi->ptr, "extend", TRUE);
00307     RNA_boolean_set(kmi->ptr, "center", TRUE);
00308     RNA_boolean_set(kmi->ptr, "object", FALSE);
00309     RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
00310 
00311     WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 0, 0);
00312     kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
00313     RNA_boolean_set(kmi->ptr, "deselect", FALSE);
00314     kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT|KM_CTRL, 0);
00315     RNA_boolean_set(kmi->ptr, "deselect", TRUE);
00316     WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0);
00317     
00318     WM_keymap_add_item(keymap, "VIEW3D_OT_clip_border", BKEY, KM_PRESS, KM_ALT, 0);
00319     WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_border", BKEY, KM_PRESS, KM_SHIFT, 0);
00320     WM_keymap_add_item(keymap, "VIEW3D_OT_render_border", BKEY, KM_PRESS, KM_SHIFT, 0);
00321     
00322     WM_keymap_add_item(keymap, "VIEW3D_OT_camera_to_view", PAD0, KM_PRESS, KM_ALT|KM_CTRL, 0);
00323     WM_keymap_add_item(keymap, "VIEW3D_OT_object_as_camera", PAD0, KM_PRESS, KM_CTRL, 0);
00324     
00325     WM_keymap_add_menu(keymap, "VIEW3D_MT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
00326     
00327     /* context ops */
00328     kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", COMMAKEY, KM_PRESS, 0, 0);
00329     RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
00330     RNA_string_set(kmi->ptr, "value", "BOUNDING_BOX_CENTER");
00331 
00332     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 */
00333     RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
00334     RNA_string_set(kmi->ptr, "value", "MEDIAN_POINT");
00335 
00336     kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", COMMAKEY, KM_PRESS, KM_ALT, 0); /* new in 2.5 */
00337     RNA_string_set(kmi->ptr, "data_path", "space_data.use_pivot_point_align");
00338 
00339     kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SPACEKEY, KM_PRESS, KM_CTRL, 0); /* new in 2.5 */
00340     RNA_string_set(kmi->ptr, "data_path", "space_data.show_manipulator");
00341 
00342     kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, 0, 0);
00343     RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
00344     RNA_string_set(kmi->ptr, "value", "CURSOR");
00345 
00346     kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, KM_CTRL, 0);
00347     RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
00348     RNA_string_set(kmi->ptr, "value", "INDIVIDUAL_ORIGINS");
00349 
00350     kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_enum", PERIODKEY, KM_PRESS, KM_ALT, 0);
00351     RNA_string_set(kmi->ptr, "data_path", "space_data.pivot_point");
00352     RNA_string_set(kmi->ptr, "value", "ACTIVE_ELEMENT");
00353 
00354     transform_keymap_for_space(keyconf, keymap, SPACE_VIEW3D);
00355 
00356     fly_modal_keymap(keyconf);
00357     viewrotate_modal_keymap(keyconf);
00358     viewmove_modal_keymap(keyconf);
00359     viewzoom_modal_keymap(keyconf);
00360     viewdolly_modal_keymap(keyconf);
00361 }
00362