How to Use Blender Custom Event Maps - dummies

How to Use Blender Custom Event Maps

By Jason van Gumster

A primary inspiration for the deep structural changes introduced in Blender’s code for the 2.5 series was to refactor Blender’s event system. An event system is required for a complex program to interact with the users. Each time you press a button or move your mouse, it registers with the program as an event. The program then handles the event by performing an action of some sort.

As an example, moving your mouse registers as an event, which then triggers your computer to perform the action of updating the location of the mouse cursor on your monitor.

Blender provides you the ability to customize the event system to suit your needs, mapping events to a wide variety of possible Blender operations. Don’t like using a particular hotkey in Blender’s default configuration? You’re free to change it. And that’s just the start!

The entire right side of the editor is devoted to modifying how events are handled within Blender. This list of events is particularly daunting to look at, and you can easily get lost among all of those expanding and collapsing categories of events. Fortunately, you can modify how events are handled in a much easier way, and you don’t even have use the User Preferences editor if you don’t want to. Instead, you can use the following steps:

  1. Find the operation you want to bind in Blender’s menu system.

    Say that you want to change the hotkey for opening a new project from Ctrl+N (the current hotkey) to Ctrl+X, the hotkey used in previous versions of Blender. You can find this operation by going to the Info editor’s header and choosing File→New. Go to that menu item, but don’t click it yet. Just hover your mouse cursor over it and proceed to the next step.

  2. Right-click the menu item for the operation you want to add or change hotkeys and choose Change Shortcut from the menu that appears.

    In this example, go to File→New, right-click it, and choose Change Shortcut. Blender prompts you for a new hotkey.

  3. When prompted, use the new hotkey that you want to assign to the operation.

    In this case, you press Ctrl+X.

    Congratulations! Your new hotkey is assigned!

The figure shows this process in action.

Customizing a hotkey sequence directly from Blender's menus.
Customizing a hotkey sequence directly from Blender’s menus.

As of this writing, Blender doesn’t warn you if you attempt to assign a hotkey that has already been bound to another operation. Blender simply double-binds the hotkey, favoring default behaviors over custom ones. Blender’s interface will still say your custom hotkey is assigned to the desired action, but it just won’t work as expected. Currently, the only way to get around this problem is to make sure that your desired hotkey isn’t already assigned.

Of course, for ultimate control, the Input section of User Preferences is really the way to go. As daunting as this section may appear, it’s actually pretty easy to use. The most effective way to make use of the event editor is to use the search feature, a text field with a magnifying glass icon in the upper right corner of the Input section:

  1. In the search filter field, type all or part of the operation you want to customize and press Enter.

    The listing below updates with Blender’s best guesses for the operation you’re looking for. Alternatively, you can just drill down through the ­categories until you find the event you want.

    If you don’t know the name of the operator, you can search by the hotkey it uses. Left-click the drop-down menu to the left of the search filter field. You can choose between Name (the default) to search by operator name or Key-Binding to search by hotkey.

  2. Modify the event you want to change.

    Changing an actual event is much like the process used to add hotkeys to menu items. It works like so:

    1. Use the Type of Event Mapping drop-down menu displayed to the right or the operation name to stipulate whether the event is coming from a keyboard, mouse, text input, or some other source.

      For example, if you’re adjusting a hotkey, make sure that you’ve set it to Keyboard.

    2. Left-click the Type of Event field that comes after the Type of Event Mapping menu.

      It will either be blank or already have an event in it. Upon doing so, Blender prompts you for your new custom event (hotkey, mouse click, and so on).

    3. Set the event with the action you want assigned to it.

      For example, if you’re changing a hotkey, simply enter the key combination you want to use. If you decide that you don’t want to change the event, just click anywhere outside of the Event Type field.

While you’re editing your events, you might notice that a Restore button appears under the search filter field. At any time, if you decide that you want to revert to the system defaults, click the Restore button. Everything goes back to the way it initially was.

You can also use this interface to activate and deactivate events, delete events, and restore them to their initial values. Furthermore, if you expand the event’s details by left-clicking the triangle to the left of the operation name, you have even more advanced controls. This figure shows an expanded event.

Blender gives you a lot of custom control over its event ­system.
Blender gives you a lot of custom control over its event ­system.

Customizing the event system can be a pretty involved topic, so if you’re really interested in making extensive changes, it’s to your benefit to play with the event system editor in the Input section of User Preferences a lot and make heavy use of the Restore buttons so that you can get Blender back to its defaults if something messes up.

After you have your events customized, you can save them to an external file that you can share with other users or simply carry with you on a USB drive so that your customized version of Blender is available wherever you go. To do so, click the Export Key Configuration button at the bottom of the User Preferences editor. A File Browser opens, and you can pick where you want to save your configuration file. The configuration is saved as a Python script.

To load your custom configuration, it’s possible to load your script in Blender and just run it. However, simply using the Import Key Configuration button at the bottom of the User Preferences editor is much easier.