[Bf-committers] Substituting hot keys in an addon

Michael Fox mfoxdogg at gmail.com
Thu Jun 16 09:22:48 CEST 2011


On 16/06/11 06:46, Nathan Vegdahl wrote:
> 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
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
why don't you look at how dynamic spacebar addon does it



More information about the Bf-committers mailing list