How to set custom shortcuts for mode switching?

What is the keyboard shortcut assignment syntax for these guys:

I can see from console that they are:


But I haven’t been able to figure out the syntax for assigning them.

Also I noticed Object/Edit modes seem to be treated as the same - both register as bpy.ops.object.editmode_toggle()
I’d like to keep the Tab key working as it does by default (an Object/Edit mode toggle) but also have a shortcut for jumping to each of the other modes. Considering a shortcut for cycling through as well, but first I need to know how to plug in the syntax.

Thanks in advance.

object.editmode_toggle etc. (drop the bpy.ops. and parens). As for setting specific mode, you can use object.mode_set . Check the docs for parameters.

In user preferences / Input search for the Z key binding to show the shortcut format for 3D View

for the different modes see

bpy.ops.object.mode_set(mode=‘OBJECT’, toggle=False)
Sets the object interaction mode
[TABLE=“class: docutils field-list”]
[TR=“class: field-odd field”]
[TH=“class: field-name”]Parameters:

  • mode (enum in [‘OBJECT’, ‘EDIT’, ‘SCULPT’, ‘VERTEX_PAINT’, ‘WEIGHT_PAINT’, ‘TEXTURE_PAINT’, ‘PARTICLE_EDIT’, ‘POSE’], (optional)) – Mode
  • toggle (boolean, (optional)) – Toggle


Hi there QA.

The Tab key behavior puzzled me for some time, because I wrongfully expected Object Mode to be the “master” mode that Tab would always toggle back to. Rather, Tab seems to be a 2-ways toggle between Edit and Model Modes, and also a shortcut to go back to Edit mode from any other mode.

Here is my hotkey setup for direct access to Object, Edit and Sculpt Modes, respectively bound to F4, F3 and F2 with Tab still active :

I hope this helps !

That is the best description I’ve seen of the mode shortcut schema. And it points out just how crazy it is.
On top of that let’s throw Pose Mode and Particle Edit Mode into the mix.
It’s easy to get locked into a back-and-forth toggle between two modes you don’t want to be in, and then need to stop and think about which one will allow you to get back out and what key combination you need to use to do it.
This is why for anything other than Object or Edit Modes I just used the mouse. But of course when we use the mouse for a repeated command we are wasting time.

I hope this helps !

Yes, it does! Immensely! Thank you! Your reply very specifically addressed what I wanted to do.
I decided on assigning Tab & F1~F7 to the various modes. When a mode does not pertain to the selected object (for example, trying to enter Pose Mode on an object that’s not an armature) it will just be ignored, which I have no problem with. When I was looking at what the function keys are assigned to by default and none of them are things I would use function keys for (I render stills and animations with Cmd R and Opt R respectively). Furthermore they don’t have any sequential relation. So re-assigning the function keys to set modes will make much more sense.

My config…
Tab: toggles between Object Mode and whichever mode was last selected
(Object Mode is home base, as you use it to switch objects)
F1: Edit Mode
F2: Texture Paint
F3: Weight Paint
F4: Vertex Paint
F5: Sculpt Mode
F6: Pose Mode
F7: Particle Edit Mode

What the prefs look like:

…and so on for F3, F4, etc.

I’m still giving consideration to the exact order of these, but the workflow concept I’m set and happy with.

(Stan and Richard, thank you as well. You are always helpful when key customization questions come up!)