[Bf-committers] Substituting hot keys in an addon

Nathan Vegdahl cessen at cessen.com
Wed Jun 15 22:46:01 CEST 2011


Hello all,
   I am wondering if there is a best practice for substituting hotkeys
via an addon.

   The use-case is that in Rigify I would like to allow the user to
add rig-type samples via shift-A in armature edit mode.  Doing so will
require popping up a menu of some kind.  However, currently shift-A in
armature edit mode does not produce a menu, and instead immediately
calls the bone_primitive_add operator, so I cannot simply insert items
into the non-existent menu.

   What I would like to do is substitute in a menu when the Rigify
addon is enabled.  I am curious if there is an accepted best-practice
way to do this, that is robust against custom keymaps, for example,
and other corner-cases.  Should I just search the active keymap for
the bone_primitive_add operator, and substitute in my own?  That seems
like it could potentially cause problems.

   Alternatively I could make vanilla Blender produce a menu, and then
simply insert my own items into the menu when rigify is enabled.
Would that be a better way to go about it?

--Nathan


More information about the Bf-committers mailing list