From 3064da1200a97e4fba08be33dd271b09d65a2fde Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 8 Nov 2018 15:59:51 +1100 Subject: Keymap: move builtin keymaps from C to Python This should be purely an implementation change, for end users there should be no functional difference. The entire key configuration is in one file with ~5000 lines of code. Mostly avoiding code duplication and preserve comments and utility functions from the C code. It's a bit long but for searching and editing it's also convenient to have it all in one file. Notes: - Actual keymap is shared by blender / blender_legacy and stored in `keymap_data/blender_default.py` This only generates JSON-like data to be passed into `keyconfig_import_from_data`, allowing other presets to load and manipulate the default keymap. - Each preset defines 'keyconfig_data' which can be shared between presets. - Some of the utility functions for generating keymap items still need to be ported over to Python. - Some keymap items can be made into loops (marked as TODO). See: D3907 --- source/blender/editors/physics/physics_ops.c | 54 +--------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) (limited to 'source/blender/editors/physics/physics_ops.c') diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c index fc2a6bad561..06b0d557d86 100644 --- a/source/blender/editors/physics/physics_ops.c +++ b/source/blender/editors/physics/physics_ops.c @@ -35,7 +35,6 @@ #include "WM_types.h" #include "ED_select_utils.h" -#include "ED_keymap_templates.h" #include "ED_physics.h" #include "ED_object.h" @@ -112,48 +111,8 @@ static void operatortypes_particle(void) static void keymap_particle(wmKeyConfig *keyconf) { - wmKeyMapItem *kmi; - wmKeyMap *keymap; - - keymap = WM_keymap_ensure(keyconf, "Particle", 0, 0); + wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Particle", 0, 0); keymap->poll = PE_poll; - - ED_keymap_template_select_all(keymap, "PARTICLE_OT_select_all"); - - WM_keymap_add_item(keymap, "PARTICLE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "PARTICLE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); - - kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, 0, 0); - RNA_boolean_set(kmi->ptr, "deselect", false); - kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0); - RNA_boolean_set(kmi->ptr, "deselect", true); - - WM_keymap_add_item(keymap, "PARTICLE_OT_delete", XKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "PARTICLE_OT_delete", DELKEY, KM_PRESS, 0, 0); - - WM_keymap_add_item(keymap, "PARTICLE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0); - kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, 0, 0); - RNA_boolean_set(kmi->ptr, "unselected", false); - kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0); - RNA_boolean_set(kmi->ptr, "unselected", true); - - WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", LEFTMOUSE, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "PARTICLE_OT_brush_edit", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0); - - /* size radial control */ - kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, 0, 0); - RNA_string_set(kmi->ptr, "data_path_primary", "tool_settings.particle_edit.brush.size"); - - /* size radial control */ - kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0); - RNA_string_set(kmi->ptr, "data_path_primary", "tool_settings.particle_edit.brush.strength"); - - WM_keymap_add_menu(keymap, "VIEW3D_MT_particle_specials", WKEY, KM_PRESS, 0, 0); - - WM_keymap_add_item(keymap, "PARTICLE_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0); - - ED_keymap_proportional_cycle(keyconf, keymap); - ED_keymap_proportional_editmode(keyconf, keymap, false); } /******************************* boids *************************************/ @@ -202,16 +161,6 @@ static void operatortypes_dynamicpaint(void) WM_operatortype_append(DPAINT_OT_output_toggle); } -//static void keymap_pointcache(wmWindowManager *wm) -//{ -// wmKeyMap *keymap = WM_keymap_ensure(wm, "Pointcache", 0, 0); -// -// WM_keymap_add_item(keymap, "PHYSICS_OT_bake_all", AKEY, KM_PRESS, 0, 0); -// WM_keymap_add_item(keymap, "PHYSICS_OT_free_all", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); -// WM_keymap_add_item(keymap, "PHYSICS_OT_bake_particle_system", PADMINUS, KM_PRESS, KM_CTRL, 0); -// WM_keymap_add_item(keymap, "PHYSICS_OT_free_particle_system", LKEY, KM_PRESS, 0, 0); -//} - /****************************** general ************************************/ void ED_operatortypes_physics(void) @@ -226,5 +175,4 @@ void ED_operatortypes_physics(void) void ED_keymap_physics(wmKeyConfig *keyconf) { keymap_particle(keyconf); - //keymap_pointcache(keyconf); } -- cgit v1.2.3