How to implement a future to register the hotkey with C languages

Excuse me.
in blender source project.
how to implement a future to register the hotkey with C languages?

This question is too vague, you’ll need to add more detail for someone to be able to answer it.

I am sorry, my English is not very good and I may have problems in comunicating with people here.

Try adding more background on what you want to do. Do you want to add a new shortcut to the default keymap? Did you add a new operator and want to add a shortcut for that? Do you want to make some change to keymap editing for users?

no, i think in c source add new pop menu and the key map
code is this
WM_operatortype_append( UserOperatorPrinter );
MenuType* mt = ( MenuType* )MEM_callocN( sizeof( MenuType ), func );
strcpy( mt->idname, menuName );
strcpy( mt->label, N_( menuName ) );
strcpy( mt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA );
mt->draw = myPrint;
WM_menutype_add( mt );
// now , How to implement a future to register the hotkey ???

The keymap is defined in Python in release/scripts/presets/keyconfig/keymap_data/ Search for op_menu to see other shortcuts for menus.

thank you.
but i think use C source code over job.

It’s done in Python because it would require a re-compile to change if it were hard-coded in C. And it;s also all in one place. Python is also easier to write than C, and of course Python addons can add their own key-bindings.

1 Like