The function of the keyboard can be extensively customized CityEngine using the keys preference page. Within CityEngine, key strokes and key sequences are assigned to invoke particular commands.
Key Strokes, sequences, and bindings
A 'key stroke' is the pressing of a key on the keyboard, while optionally holding down one or more of these modifier keys: CTRL, ALT, or SHIFT. For example, holding down CTRL then pressing A produces the key stroke CTRL+A. The pressing of the modifier keys themselves do not constitute key strokes.
A 'key sequence' is one or more key strokes. Traditionally, Emacs assigned two or three key stroke key sequences to particular commands. For example, the normal key sequence assigned to Close All in emacs is CTRL+X CTRL+C. To enter this key sequence, one presses the key stroke CTRL+X followed by the key stroke CTRL+C. While Eclipse supports key sequences of arbitrary lengths, it is recommended that keyboard shortcuts be four key strokes in length (or less).
A 'key binding' is the assignment of a key sequence to a command.
Schemes
A 'scheme' is a set of bindings. CityEngine includes two schemes:
- Procedural CityEngine (default)
- Autodesk Maya
- Autodesk Revit
- Google SketchUp
- McNeel Rhino
- Autodesk 3ds Max
- Blender
- Autodesk Autocad
- Graphisoft ArchiCAD
- Maxon Cinema4D
- Emacs (do not use)
- Default (do not use)
The Procedural CityEngine scheme contains a general set of bindings, in many cases recognizable as traditional key sequences for well known commands. For instance, CTRL+A is assigned to Select All, and CTRL+S is assigned to Save.
Choose the scheme you are most comfortable with by changing the 'Scheme' setting on the keys preference page.
Contexts
Key bindings can vary based on the current context of CityEngine.
Sometimes the active part might be a CGA shape grammar editor, for instance, where a different set of key sequence assignments may be more appropriate than if the active part was a 3D viewport. As a specific example, typically X, Y, or Z, are assigned to normal typing actions in a context such as CGA shape grammar editing, while X, Y, or Z is assigned to axis alignment in a 3D viewport. This context is usually determined by the active window, but it can be influenced by the active dialog as well. If the active window does not choose a particular context, CityEngine will set the active context to In Windows.
CityEngine includes a number of different contexts. Some examples are:
- In Dialogs and Windows
- In Windows (extends In Dialogs and Windows)
- In Dialogs (extends In Dialogs and Windows)
- Editing Text (extends In Windows)
- In Viewport
- In Console
NOTE: It is not recommended to promote a key binding to a context which it extends. For example, it is not recommended to move an Editing Text key binding to the In Dialogs and Windows context. This may have unexpected results.
It is possible for some key bindings to work in dialogs. Those key bindings are assigned to the In Dialogs and Windows context. One example of such a key binding is the key binding for "cut". It is possible to change these key bindings. For example, it is possible to have CTRL+X as cut in dialogs, but CTRL+W as cut in windows.
Platform and locale
Key bindings also vary by platform and locale. On Chinese locales (zh), ALT+/ is assigned to Content Assist, instead of the usual CTRL+SPACE.
The current platform and locale is determined when CityEngine starts, and does not vary over the lifetime of a running CityEngine.
Customizing key bindings
With multi-stroke key sequences, schemes, and contexts, there are a lot of things to keep in mind when customizing key bindings. To make things easier, all key customization is done on the keys preference page.
In this example we want to bind CTRL+5 to the About command. By default, the keys preference page will show you all possible key bindings. You can see the About command listed in the Help category. You can bind the command by putting focus in the Binding text box and pressing CTRL and 5 like you would if you were executing the command.
When you type CTRL+5 you have created a binding for About. The right-most column will indicate that this is a user binding by displaying a U. If there was a conflict with another key, this column would also display a C. The binding will be in the default context, "In Windows". You can now use the When combo box to change the key binding context (for example, to move this binding to "Editing Text").
If you wanted to add a second key binding to About, you can use the Copy Command button to create a second command entry for you to bind another key to. If you want to delete a binding, you can either use the Remove Binding button or simply give focus to the Binding text box and hit Backspace.
Conflict resolution
There are only a finite number of simple, common key strokes available to assign to a multitude of commands. We have seen that scheme, context, platform, and locale all partition key sequence assignments into domains where they don't conflict with one another.
If the user sets a keybinding and creates a conflict, the conflicting bindings will be displayed in the conflicts list. This can be used to navigate between conflicting key bindings so that they can be changed.
These types of conflicts can be resolved by explicitly assigning the key sequence to one of the commands, or remove it from the other.