Blender V5.3
WM_keymap.hh File Reference
#include <optional>
#include <string>
#include "DNA_windowmanager_types.h"
#include "WM_types.hh"

Go to the source code of this file.

Classes

struct  blender::KeyMapItem_Params

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define KMI_PARAMS_MOD_TO_ANY(mod)
#define KMI_PARAMS_MOD_FROM_ANY(mod)

Functions

void blender::WM_keyconfig_init (bContext *C)
void blender::WM_keyconfig_reload (bContext *C)
Key Configuration

List of keymaps for all editors, modes, etc. There is a builtin default key configuration, a user key configuration, and other preset configurations.

wmKeyConfig * blender::WM_keyconfig_new (wmWindowManager *wm, const char *idname, bool user_defined)
wmKeyConfig * blender::WM_keyconfig_ensure (wmWindowManager *wm, const char *idname, bool user_defined)
void blender::WM_keyconfig_remove (wmWindowManager *wm, wmKeyConfig *keyconf)
void blender::WM_keyconfig_clear (wmKeyConfig *keyconf)
void blender::WM_keyconfig_free (wmKeyConfig *keyconf)
void blender::WM_keyconfig_set_active (wmWindowManager *wm, const char *idname)
Update Final Configuration

On load or other changes, the final user key configuration is rebuilt from the preset, add-on and user preferences keymaps. We also test if the final configuration changed and write the changes to the user preferences.

void blender::WM_keyconfig_update_ex (wmWindowManager *wm, bool keep_properties)
void blender::WM_keyconfig_update (wmWindowManager *wm)
void blender::WM_keyconfig_update_on_startup (wmWindowManager *wm)
void blender::WM_keyconfig_update_tag (wmKeyMap *keymap, wmKeyMapItem *kmi)
void blender::WM_keyconfig_update_operatortype_tag ()
void blender::WM_keyconfig_update_suppress_begin ()
void blender::WM_keyconfig_update_suppress_end ()
void blender::WM_keyconfig_update_postpone_begin ()
void blender::WM_keyconfig_update_postpone_end ()
Keymap

List of keymap items for one editor, mode, modal operator.

void blender::WM_keymap_clear (wmKeyMap *keymap)
wmKeyMapItem * blender::WM_keymap_add_item (wmKeyMap *keymap, const char *idname, const KeyMapItem_Params *params)
wmKeyMapItem * blender::WM_keymap_add_item_copy (wmKeyMap *keymap, const wmKeyMapItem *kmi_src)
void blender::WM_keymap_remove_item (wmKeyMap *keymap, wmKeyMapItem *kmi)
void blender::WM_keymap_remove (wmKeyConfig *keyconf, wmKeyMap *keymap)
bool blender::WM_keymap_poll (bContext *C, wmKeyMap *keymap)
Text from Key Events
std::optional< std::string > blender::WM_keymap_item_to_string (const wmKeyMapItem *kmi, const bool compact)
std::optional< std::string > blender::WM_modalkeymap_items_to_string (const wmKeyMap *km, const int propvalue, const bool compact)
std::optional< std::string > blender::WM_modalkeymap_operator_items_to_string (wmOperatorType *ot, const int propvalue, const bool compact)
const char * blender::WM_key_event_string (const short type, const bool compact)
std::optional< std::string > blender::WM_keymap_item_raw_to_string (const int8_t shift, const int8_t ctrl, const int8_t alt, const int8_t oskey, const int8_t hyper, const short keymodifier, const short val, const short type, const bool compact)
Storage in WM

Name id's are for storing general or multiple keymaps.

wmKeyMap * blender::WM_keymap_list_find (ListBaseT< wmKeyMap > *lb, const char *idname, int spaceid, int regionid)
wmKeyMap * blender::WM_keymap_list_find_spaceid_or_empty (ListBaseT< wmKeyMap > *lb, const char *idname, int spaceid, int regionid)
wmKeyMap * blender::WM_keymap_ensure (wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
wmKeyMap * blender::WM_keymap_find_all (wmWindowManager *wm, const char *idname, int spaceid, int regionid)
wmKeyMap * blender::WM_keymap_find_all_spaceid_or_empty (wmWindowManager *wm, const char *idname, int spaceid, int regionid)
Event Handling

Handlers have pointers to the keymap in the default configuration. During event handling this function is called to get the keymap from the final configuration.

wmKeyMap * blender::WM_keymap_active (const wmWindowManager *wm, wmKeyMap *keymap)
Keymap Queries
wmKeyMapItem * blender::WM_keymap_item_find_id (wmKeyMap *keymap, const int id)
wmKeyMapItem * blender::WM_keymap_item_find_match (wmKeyMap *km_base, wmKeyMap *km_match, const wmKeyMapItem *kmi_match, ReportList *reports)
Keymap Finding Utilities
bool blender::WM_keymap_item_compare (const wmKeyMapItem *k1, const wmKeyMapItem *k2)
wmKeyMapItem * blender::WM_key_event_operator (const bContext *C, const char *opname, wm::OpCallContext opcontext, IDProperty *properties, const short include_mask, const short exclude_mask, wmKeyMap **r_keymap)
std::optional< std::string > blender::WM_key_event_operator_string (const bContext *C, const char *opname, wm::OpCallContext opcontext, IDProperty *properties, const bool is_strict)
wmKeyMapItem * blender::WM_key_event_operator_from_keymap (wmKeyMap *keymap, const char *opname, IDProperty *properties, const short include_mask, const short exclude_mask)
Wrappers for #WM_keymap_add_item
wmKeyMapItem * blender::WM_keymap_add_menu (wmKeyMap *keymap, const char *idname, const KeyMapItem_Params *params)
wmKeyMapItem * blender::WM_keymap_add_menu_pie (wmKeyMap *keymap, const char *idname, const KeyMapItem_Params *params)
wmKeyMapItem * blender::WM_keymap_add_panel (wmKeyMap *keymap, const char *idname, const KeyMapItem_Params *params)
wmKeyMapItem * blender::WM_keymap_add_tool (wmKeyMap *keymap, const char *idname, const KeyMapItem_Params *params)
Introspection
wmKeyMap * blender::WM_keymap_guess_from_context (const bContext *C)
wmKeyMap * blender::WM_keymap_guess_opname (const bContext *C, const char *opname)
bool blender::WM_keymap_uses_event_modifier (const wmKeyMap *keymap, const int event_modifier)
void blender::WM_keymap_fix_linking ()
Modal Keymaps

Modal key-maps get linked to a running operator, and filter the keys before sending to #wmOperatorType.modal callback.

wmKeyMap * blender::WM_modalkeymap_ensure (wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
wmKeyMap * blender::WM_modalkeymap_find (wmKeyConfig *keyconf, const char *idname)
wmKeyMapItem * blender::WM_modalkeymap_add_item (wmKeyMap *km, const KeyMapItem_Params *params, int value)
wmKeyMapItem * blender::WM_modalkeymap_add_item_str (wmKeyMap *km, const KeyMapItem_Params *params, const char *value)
const wmKeyMapItem * blender::WM_modalkeymap_find_propvalue (const wmKeyMap *km, const int propvalue)
void blender::WM_modalkeymap_assign (wmKeyMap *km, const char *opname)
Keymap Editor

In the keymap editor the user key configuration is edited.

void blender::WM_keymap_restore_to_default (wmKeyMap *keymap, wmWindowManager *wm)
void blender::WM_keymap_item_restore_to_default (wmWindowManager *wm, wmKeyMap *keymap, wmKeyMapItem *kmi)
const char * blender::WM_bool_as_string (bool test)
Keymap Item

Item in a keymap, that maps from an event to an operator or modal map item.

void blender::WM_keymap_item_properties_reset (wmKeyMapItem *kmi, IDProperty *properties)
int blender::WM_keymap_item_map_type_get (const wmKeyMapItem *kmi)

Macro Definition Documentation

◆ KMI_PARAMS_MOD_FROM_ANY

#define KMI_PARAMS_MOD_FROM_ANY ( mod)
Value:
((mod) >> 8)
VecBase< float, D > constexpr mod(VecOp< float, D >, VecOp< float, D >) RET

Use to read modifiers from #KeyMapItem_Params::modifier which can have any state (held or released).

Definition at line 91 of file WM_keymap.hh.

Referenced by blender::keymap_event_set().

◆ KMI_PARAMS_MOD_TO_ANY

#define KMI_PARAMS_MOD_TO_ANY ( mod)
Value:
((mod) << 8)

Use to assign modifiers to #KeyMapItem_Params::modifier which can have any state (held or released).

Definition at line 86 of file WM_keymap.hh.