Читать книгу Blender For Dummies - Jason van Gumster - Страница 62
Using custom event maps
ОглавлениеBlender has one of the most customizable event systems of any application I’ve worked with. An event system is required for a complex program to interact with you and me, 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 majority of the Keymap section in Preferences (Edit ⇒ Preferences) 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 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 to use the Preferences editor if you don’t want to. Instead, you can follow these steps:
1 Find the operator you want to bind in Blender’s menu system.As mentioned earlier in this chapter, an operator is a thing that Blender does; it’s the thing that happens when you click a menu item in Blender’s interface. As an example, say that you want to change the hotkey for saving a project from Ctrl+S (the current hotkey) to Ctrl+W, the hotkey used in older versions of Blender. You can find this operator by going to the menus at the top of your Blender window and choosing File ⇒ Save. 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 operator and choose Change Shortcut from the menu that appears.In this example, choose File ⇒ Save, 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+W.Congratulations! Your new hotkey is assigned!
Figure 2-14 shows this process in action.
FIGURE 2-14: 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 operator. 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 Keymap section of 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:
1 In the search filter field, type all or part of the operator you want to customize and press Enter.The listing below updates with Blender’s best guesses for the operator you’re looking for. Alternatively, you can just drill down through the categories until you find the event you want. Using the previous example, you might type “save” in this field to find the Save Blender File operator. 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: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.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).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 at the top of the section you’re working on. 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.
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 Keymap section of 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 button at the top right of the 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 button at the top of the Preferences editor is much easier.