Blender V2.61 - r43446

object_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 #include "DNA_object_types.h"
00036 #include "DNA_scene_types.h"
00037 
00038 #include "BLI_math.h"
00039 #include "BLI_blenlib.h"
00040 #include "BLI_utildefines.h"
00041 
00042 #include "BKE_context.h"
00043 
00044 #include "RNA_access.h"
00045 #include "RNA_define.h"
00046 
00047 #include "WM_api.h"
00048 #include "WM_types.h"
00049 
00050 #include "ED_screen.h"
00051 #include "ED_object.h"
00052 
00053 #include "object_intern.h"
00054 
00055 
00056 /* ************************** registration **********************************/
00057 
00058 
00059 void ED_operatortypes_object(void)
00060 {
00061     WM_operatortype_append(OBJECT_OT_location_clear);
00062     WM_operatortype_append(OBJECT_OT_rotation_clear);
00063     WM_operatortype_append(OBJECT_OT_scale_clear);
00064     WM_operatortype_append(OBJECT_OT_origin_clear);
00065     WM_operatortype_append(OBJECT_OT_visual_transform_apply);
00066     WM_operatortype_append(OBJECT_OT_transform_apply);
00067     WM_operatortype_append(OBJECT_OT_origin_set);
00068     
00069     WM_operatortype_append(OBJECT_OT_mode_set);
00070     WM_operatortype_append(OBJECT_OT_editmode_toggle);
00071     WM_operatortype_append(OBJECT_OT_posemode_toggle);
00072     WM_operatortype_append(OBJECT_OT_proxy_make);
00073     WM_operatortype_append(OBJECT_OT_hide_view_clear);
00074     WM_operatortype_append(OBJECT_OT_hide_view_set);
00075     WM_operatortype_append(OBJECT_OT_hide_render_clear);
00076     WM_operatortype_append(OBJECT_OT_hide_render_set);
00077     WM_operatortype_append(OBJECT_OT_shade_smooth);
00078     WM_operatortype_append(OBJECT_OT_shade_flat);
00079     WM_operatortype_append(OBJECT_OT_paths_calculate);
00080     WM_operatortype_append(OBJECT_OT_paths_clear);
00081     WM_operatortype_append(OBJECT_OT_forcefield_toggle);
00082 
00083     WM_operatortype_append(OBJECT_OT_parent_set);
00084     WM_operatortype_append(OBJECT_OT_parent_no_inverse_set);
00085     WM_operatortype_append(OBJECT_OT_parent_clear);
00086     WM_operatortype_append(OBJECT_OT_vertex_parent_set);
00087     WM_operatortype_append(OBJECT_OT_track_set);
00088     WM_operatortype_append(OBJECT_OT_track_clear);
00089     WM_operatortype_append(OBJECT_OT_slow_parent_set);
00090     WM_operatortype_append(OBJECT_OT_slow_parent_clear);
00091     WM_operatortype_append(OBJECT_OT_make_local);
00092     WM_operatortype_append(OBJECT_OT_make_single_user);
00093     WM_operatortype_append(OBJECT_OT_make_links_scene);
00094     WM_operatortype_append(OBJECT_OT_make_links_data);
00095     WM_operatortype_append(OBJECT_OT_move_to_layer);
00096 
00097     WM_operatortype_append(OBJECT_OT_select_random);
00098     WM_operatortype_append(OBJECT_OT_select_all);
00099     WM_operatortype_append(OBJECT_OT_select_same_group);
00100     WM_operatortype_append(OBJECT_OT_select_by_type);
00101     WM_operatortype_append(OBJECT_OT_select_by_layer);
00102     WM_operatortype_append(OBJECT_OT_select_linked);
00103     WM_operatortype_append(OBJECT_OT_select_grouped);
00104     WM_operatortype_append(OBJECT_OT_select_mirror);
00105 
00106     WM_operatortype_append(GROUP_OT_create);
00107     WM_operatortype_append(GROUP_OT_objects_remove);
00108     WM_operatortype_append(GROUP_OT_objects_add_active);
00109     WM_operatortype_append(GROUP_OT_objects_remove_active);
00110 
00111     WM_operatortype_append(OBJECT_OT_delete);
00112     WM_operatortype_append(OBJECT_OT_text_add);
00113     WM_operatortype_append(OBJECT_OT_armature_add);
00114     WM_operatortype_append(OBJECT_OT_lamp_add);
00115     WM_operatortype_append(OBJECT_OT_camera_add);
00116     WM_operatortype_append(OBJECT_OT_speaker_add);
00117     WM_operatortype_append(OBJECT_OT_add);
00118     WM_operatortype_append(OBJECT_OT_add_named);
00119     WM_operatortype_append(OBJECT_OT_effector_add);
00120     WM_operatortype_append(OBJECT_OT_group_instance_add);
00121     WM_operatortype_append(OBJECT_OT_metaball_add);
00122     WM_operatortype_append(OBJECT_OT_duplicates_make_real);
00123     WM_operatortype_append(OBJECT_OT_duplicate);
00124     WM_operatortype_append(OBJECT_OT_join);
00125     WM_operatortype_append(OBJECT_OT_join_shapes);
00126     WM_operatortype_append(OBJECT_OT_convert);
00127 
00128     WM_operatortype_append(OBJECT_OT_modifier_add);
00129     WM_operatortype_append(OBJECT_OT_modifier_remove);
00130     WM_operatortype_append(OBJECT_OT_modifier_move_up);
00131     WM_operatortype_append(OBJECT_OT_modifier_move_down);
00132     WM_operatortype_append(OBJECT_OT_modifier_apply);
00133     WM_operatortype_append(OBJECT_OT_modifier_convert);
00134     WM_operatortype_append(OBJECT_OT_modifier_copy);
00135     WM_operatortype_append(OBJECT_OT_multires_subdivide);
00136     WM_operatortype_append(OBJECT_OT_multires_reshape);
00137     WM_operatortype_append(OBJECT_OT_multires_higher_levels_delete);
00138     WM_operatortype_append(OBJECT_OT_multires_base_apply);
00139     WM_operatortype_append(OBJECT_OT_multires_external_save);
00140     WM_operatortype_append(OBJECT_OT_multires_external_pack);
00141     WM_operatortype_append(OBJECT_OT_meshdeform_bind);
00142     WM_operatortype_append(OBJECT_OT_explode_refresh);
00143     WM_operatortype_append(OBJECT_OT_ocean_bake);
00144     
00145     WM_operatortype_append(OBJECT_OT_constraint_add);
00146     WM_operatortype_append(OBJECT_OT_constraint_add_with_targets);
00147     WM_operatortype_append(POSE_OT_constraint_add);
00148     WM_operatortype_append(POSE_OT_constraint_add_with_targets);
00149     WM_operatortype_append(OBJECT_OT_constraints_copy);
00150     WM_operatortype_append(POSE_OT_constraints_copy);
00151     WM_operatortype_append(OBJECT_OT_constraints_clear);
00152     WM_operatortype_append(POSE_OT_constraints_clear);
00153     WM_operatortype_append(POSE_OT_ik_add);
00154     WM_operatortype_append(POSE_OT_ik_clear);
00155     WM_operatortype_append(CONSTRAINT_OT_delete);
00156     WM_operatortype_append(CONSTRAINT_OT_move_up);
00157     WM_operatortype_append(CONSTRAINT_OT_move_down);
00158     WM_operatortype_append(CONSTRAINT_OT_stretchto_reset);
00159     WM_operatortype_append(CONSTRAINT_OT_limitdistance_reset);
00160     WM_operatortype_append(CONSTRAINT_OT_childof_set_inverse);
00161     WM_operatortype_append(CONSTRAINT_OT_childof_clear_inverse);
00162     WM_operatortype_append(CONSTRAINT_OT_objectsolver_set_inverse);
00163     WM_operatortype_append(CONSTRAINT_OT_objectsolver_clear_inverse);
00164 
00165     WM_operatortype_append(OBJECT_OT_vertex_group_add);
00166     WM_operatortype_append(OBJECT_OT_vertex_group_remove);
00167     WM_operatortype_append(OBJECT_OT_vertex_group_assign);
00168     WM_operatortype_append(OBJECT_OT_vertex_group_remove_from);
00169     WM_operatortype_append(OBJECT_OT_vertex_group_select);
00170     WM_operatortype_append(OBJECT_OT_vertex_group_deselect);
00171     WM_operatortype_append(OBJECT_OT_vertex_group_copy_to_linked);
00172     WM_operatortype_append(OBJECT_OT_vertex_group_copy_to_selected);
00173     WM_operatortype_append(OBJECT_OT_vertex_group_copy);
00174     WM_operatortype_append(OBJECT_OT_vertex_group_normalize);
00175     WM_operatortype_append(OBJECT_OT_vertex_group_normalize_all);
00176     WM_operatortype_append(OBJECT_OT_vertex_group_lock);
00177     WM_operatortype_append(OBJECT_OT_vertex_group_fix);
00178     WM_operatortype_append(OBJECT_OT_vertex_group_invert);
00179     WM_operatortype_append(OBJECT_OT_vertex_group_levels);
00180     WM_operatortype_append(OBJECT_OT_vertex_group_blend);
00181     WM_operatortype_append(OBJECT_OT_vertex_group_clean);
00182     WM_operatortype_append(OBJECT_OT_vertex_group_mirror);
00183     WM_operatortype_append(OBJECT_OT_vertex_group_set_active);
00184     WM_operatortype_append(OBJECT_OT_vertex_group_sort);
00185     WM_operatortype_append(OBJECT_OT_vertex_group_move);
00186 
00187     WM_operatortype_append(OBJECT_OT_game_property_new);
00188     WM_operatortype_append(OBJECT_OT_game_property_remove);
00189     WM_operatortype_append(OBJECT_OT_game_property_copy);
00190     WM_operatortype_append(OBJECT_OT_game_property_clear);
00191     WM_operatortype_append(OBJECT_OT_logic_bricks_copy);
00192     WM_operatortype_append(OBJECT_OT_game_physics_copy);
00193 
00194     WM_operatortype_append(OBJECT_OT_shape_key_add);
00195     WM_operatortype_append(OBJECT_OT_shape_key_remove);
00196     WM_operatortype_append(OBJECT_OT_shape_key_clear);
00197     WM_operatortype_append(OBJECT_OT_shape_key_mirror);
00198     WM_operatortype_append(OBJECT_OT_shape_key_move);
00199 
00200     WM_operatortype_append(LATTICE_OT_select_all);
00201     WM_operatortype_append(LATTICE_OT_make_regular);
00202 
00203     WM_operatortype_append(OBJECT_OT_group_add);
00204     WM_operatortype_append(OBJECT_OT_group_link);
00205     WM_operatortype_append(OBJECT_OT_group_remove);
00206 
00207     WM_operatortype_append(OBJECT_OT_hook_add_selobj);
00208     WM_operatortype_append(OBJECT_OT_hook_add_newobj);
00209     WM_operatortype_append(OBJECT_OT_hook_remove);
00210     WM_operatortype_append(OBJECT_OT_hook_select);
00211     WM_operatortype_append(OBJECT_OT_hook_assign);
00212     WM_operatortype_append(OBJECT_OT_hook_reset);
00213     WM_operatortype_append(OBJECT_OT_hook_recenter);
00214 
00215     WM_operatortype_append(OBJECT_OT_bake_image);
00216     WM_operatortype_append(OBJECT_OT_drop_named_material);
00217 }
00218 
00219 
00220 void ED_operatormacros_object(void)
00221 {
00222     wmOperatorType *ot;
00223     wmOperatorTypeMacro *otmacro;
00224     
00225     ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate Objects", OPTYPE_UNDO|OPTYPE_REGISTER);
00226     if(ot) {
00227         ot->description = "Duplicate selected objects and move them";
00228         WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
00229         otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
00230         RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF);
00231     }
00232 
00233     /* grr, should be able to pass options on... */
00234     ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move_linked", "Duplicate Linked", OPTYPE_UNDO|OPTYPE_REGISTER);
00235     if(ot) {
00236         ot->description = "Duplicate selected objects and move them";
00237         otmacro= WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
00238         RNA_boolean_set(otmacro->ptr, "linked", TRUE);
00239         otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
00240         RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF);
00241     }
00242     
00243     /* XXX */
00244     ot= WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add named object at cursor", OPTYPE_UNDO|OPTYPE_REGISTER);
00245     if(ot) {
00246         ot->description = "Add named object at cursor";
00247         RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME-2, "Name", "Object name to add");
00248 
00249         WM_operatortype_macro_define(ot, "VIEW3D_OT_cursor3d");
00250         WM_operatortype_macro_define(ot, "OBJECT_OT_add_named");
00251     }
00252 }
00253 
00254 static int object_mode_poll(bContext *C)
00255 {
00256     Object *ob= CTX_data_active_object(C);
00257     return (!ob || ob->mode == OB_MODE_OBJECT);
00258 }
00259 
00260 void ED_keymap_object(wmKeyConfig *keyconf)
00261 {
00262     wmKeyMap *keymap;
00263     wmKeyMapItem *kmi;
00264     int i;
00265     
00266     /* Objects, Regardless of Mode -------------------------------------------------- */
00267     keymap= WM_keymap_find(keyconf, "Object Non-modal", 0, 0);
00268     
00269     /* Note: this keymap works disregarding mode */
00270     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
00271     RNA_enum_set(kmi->ptr, "mode", OB_MODE_EDIT);
00272     RNA_boolean_set(kmi->ptr, "toggle", TRUE);
00273 
00274     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, KM_CTRL, 0);
00275     RNA_enum_set(kmi->ptr, "mode", OB_MODE_POSE);
00276     RNA_boolean_set(kmi->ptr, "toggle", TRUE);
00277 
00278     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", VKEY, KM_PRESS, 0, 0);
00279     RNA_enum_set(kmi->ptr, "mode", OB_MODE_VERTEX_PAINT);
00280     RNA_boolean_set(kmi->ptr, "toggle", TRUE);
00281     
00282     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, KM_CTRL, 0);
00283     RNA_enum_set(kmi->ptr, "mode", OB_MODE_WEIGHT_PAINT);
00284     RNA_boolean_set(kmi->ptr, "toggle", TRUE);
00285     
00286     WM_keymap_add_item(keymap, "OBJECT_OT_origin_set", CKEY, KM_PRESS, KM_ALT|KM_SHIFT|KM_CTRL, 0);
00287 
00288     /* Object Mode ---------------------------------------------------------------- */
00289     /* Note: this keymap gets disabled in non-objectmode,  */
00290     keymap= WM_keymap_find(keyconf, "Object Mode", 0, 0);
00291     keymap->poll= object_mode_poll;
00292     
00293     /* object mode supports PET now */
00294     ED_object_generic_keymap(keyconf, keymap, 1);
00295 
00296     WM_keymap_add_item(keymap, "VIEW3D_OT_game_start", PKEY, KM_PRESS, 0, 0);
00297 
00298     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_all", AKEY, KM_PRESS, 0, 0);
00299     RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
00300     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
00301     RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
00302 
00303     WM_keymap_add_item(keymap, "OBJECT_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0);
00304     WM_keymap_add_item(keymap, "OBJECT_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0);
00305     WM_keymap_add_item(keymap, "OBJECT_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
00306     
00307     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
00308     RNA_enum_set_identifier(kmi->ptr, "direction", "PARENT");
00309     RNA_boolean_set(kmi->ptr, "extend", FALSE);
00310 
00311     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
00312     RNA_enum_set_identifier(kmi->ptr, "direction", "PARENT");
00313     RNA_boolean_set(kmi->ptr, "extend", TRUE);
00314 
00315     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
00316     RNA_enum_set_identifier(kmi->ptr, "direction", "CHILD");
00317     RNA_boolean_set(kmi->ptr, "extend", FALSE);
00318 
00319     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
00320     RNA_enum_set_identifier(kmi->ptr, "direction", "CHILD");
00321     RNA_boolean_set(kmi->ptr, "extend", TRUE);
00322 
00323     WM_keymap_verify_item(keymap, "OBJECT_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
00324     WM_keymap_verify_item(keymap, "OBJECT_OT_parent_no_inverse_set", PKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
00325     WM_keymap_verify_item(keymap, "OBJECT_OT_parent_clear", PKEY, KM_PRESS, KM_ALT, 0);
00326     WM_keymap_verify_item(keymap, "OBJECT_OT_track_set", TKEY, KM_PRESS, KM_CTRL, 0);
00327     WM_keymap_verify_item(keymap, "OBJECT_OT_track_clear", TKEY, KM_PRESS, KM_ALT, 0);
00328     
00329     WM_keymap_verify_item(keymap, "OBJECT_OT_constraint_add_with_targets", CKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
00330     WM_keymap_verify_item(keymap, "OBJECT_OT_constraints_clear", CKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
00331     
00332     WM_keymap_verify_item(keymap, "OBJECT_OT_location_clear", GKEY, KM_PRESS, KM_ALT, 0);
00333     WM_keymap_verify_item(keymap, "OBJECT_OT_rotation_clear", RKEY, KM_PRESS, KM_ALT, 0);
00334     WM_keymap_verify_item(keymap, "OBJECT_OT_scale_clear", SKEY, KM_PRESS, KM_ALT, 0);
00335     WM_keymap_verify_item(keymap, "OBJECT_OT_origin_clear", OKEY, KM_PRESS, KM_ALT, 0);
00336     
00337     WM_keymap_add_item(keymap, "OBJECT_OT_hide_view_clear", HKEY, KM_PRESS, KM_ALT, 0);
00338     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_hide_view_set", HKEY, KM_PRESS, 0, 0);
00339     RNA_boolean_set(kmi->ptr, "unselected", FALSE);
00340 
00341     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_hide_view_set", HKEY, KM_PRESS, KM_SHIFT, 0);
00342     RNA_boolean_set(kmi->ptr, "unselected", TRUE);
00343 
00344     /* same as above but for rendering */
00345     WM_keymap_add_item(keymap, "OBJECT_OT_hide_render_clear", HKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
00346     WM_keymap_add_item(keymap, "OBJECT_OT_hide_render_set", HKEY, KM_PRESS, KM_CTRL, 0);
00347 
00348     /* conflicts, removing */
00349 #if 0
00350     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_hide_render_set", HKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)
00351     RNA_boolean_set(kmi->ptr, "unselected", TRUE);
00352 #endif
00353 
00354     WM_keymap_add_item(keymap, "OBJECT_OT_move_to_layer", MKEY, KM_PRESS, 0, 0);
00355     
00356     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, 0, 0);
00357     RNA_boolean_set(kmi->ptr, "use_global", FALSE);
00358 
00359     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, KM_SHIFT, 0);
00360     RNA_boolean_set(kmi->ptr, "use_global", TRUE);
00361 
00362     WM_keymap_add_item(keymap, "OBJECT_OT_delete", DELKEY, KM_PRESS, 0, 0);
00363     RNA_boolean_set(kmi->ptr, "use_global", FALSE);
00364     kmi = WM_keymap_add_item(keymap, "OBJECT_OT_delete", DELKEY, KM_PRESS, KM_SHIFT, 0);
00365     RNA_boolean_set(kmi->ptr, "use_global", TRUE);
00366 
00367     WM_keymap_add_menu(keymap, "INFO_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
00368 
00369     WM_keymap_add_item(keymap, "OBJECT_OT_duplicates_make_real", AKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
00370 
00371     WM_keymap_add_menu(keymap, "VIEW3D_MT_object_apply", AKEY, KM_PRESS, KM_CTRL, 0);
00372     WM_keymap_add_menu(keymap, "VIEW3D_MT_make_single_user", UKEY, KM_PRESS, 0, 0);
00373     WM_keymap_add_menu(keymap, "VIEW3D_MT_make_links", LKEY, KM_PRESS, KM_CTRL, 0);
00374 
00375     WM_keymap_add_item(keymap, "OBJECT_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
00376     WM_keymap_add_item(keymap, "OBJECT_OT_duplicate_move_linked", DKEY, KM_PRESS, KM_ALT, 0);
00377     
00378     WM_keymap_add_item(keymap, "OBJECT_OT_join", JKEY, KM_PRESS, KM_CTRL, 0);
00379     WM_keymap_add_item(keymap, "OBJECT_OT_convert", CKEY, KM_PRESS, KM_ALT, 0);
00380     WM_keymap_add_item(keymap, "OBJECT_OT_proxy_make", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
00381     WM_keymap_add_item(keymap, "OBJECT_OT_make_local", LKEY, KM_PRESS, 0, 0);
00382 
00383     // XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith
00384     WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_insert_menu", IKEY, KM_PRESS, 0, 0);
00385     WM_keymap_verify_item(keymap, "ANIM_OT_keyframe_delete_v3d", IKEY, KM_PRESS, KM_ALT, 0);
00386     WM_keymap_verify_item(keymap, "ANIM_OT_keying_set_active_set", IKEY, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0);
00387     
00388     WM_keymap_verify_item(keymap, "GROUP_OT_create", GKEY, KM_PRESS, KM_CTRL, 0);
00389     WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove", GKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
00390     WM_keymap_verify_item(keymap, "GROUP_OT_objects_add_active", GKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
00391     WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove_active", GKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
00392 
00393     WM_keymap_add_menu(keymap, "VIEW3D_MT_object_specials", WKEY, KM_PRESS, 0, 0);
00394 
00395     for(i=0; i<=5; i++) {
00396         kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY+i, KM_PRESS, KM_CTRL, 0);
00397         RNA_int_set(kmi->ptr, "level", i);
00398     }
00399 
00400     /* ############################################################################ */
00401     /* ################################ LATTICE ################################### */
00402     /* ############################################################################ */
00403 
00404     keymap= WM_keymap_find(keyconf, "Lattice", 0, 0);
00405     keymap->poll= ED_operator_editlattice;
00406 
00407     WM_keymap_add_item(keymap, "LATTICE_OT_select_all", AKEY, KM_PRESS, 0, 0);
00408     
00409     WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
00410     
00411     /* menus */
00412     WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0);
00413 
00414     ED_object_generic_keymap(keyconf, keymap, 2);
00415 }
00416 
00417 void ED_object_generic_keymap(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap, int do_pet)
00418 {
00419     wmKeyMapItem *kmi;
00420 
00421     /* used by mesh, curve & lattice only */
00422     if(do_pet) {
00423         /* context ops */
00424         kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_enum", OKEY, KM_PRESS, KM_SHIFT, 0);
00425         RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_edit_falloff");
00426 
00427         // Object mode
00428         if (do_pet == 1) {
00429 
00430             kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, 0, 0);
00431             RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_proportional_edit_objects");
00432 
00433         } else { // Edit mode
00434 
00435             kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, 0, 0);
00436             RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_edit");
00437             RNA_string_set(kmi->ptr, "value_1", "DISABLED");
00438             RNA_string_set(kmi->ptr, "value_2", "ENABLED");
00439 
00440             /* for modes/object types that allow 'connected' mode, add the Alt O key */
00441             if (do_pet == 3) {
00442                 kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, KM_ALT, 0);
00443                 RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_edit");
00444                 RNA_string_set(kmi->ptr, "value_1", "DISABLED");
00445                 RNA_string_set(kmi->ptr, "value_2", "CONNECTED");
00446             }
00447         }
00448     }
00449 }
00450