Bootstrap Chameleon Logo

Use Shortcut Keys

If you want to be even faster, you must try the shortcut keys.

TAPython has a built-in configurable shortcut key feature, which can be used to:

Steps

  1. Open <Your_UE_Project>/Plugins/TAPython/UI/HotkeyConfig.json and modify its content to bind ChameleonTools or a piece of Python code to the shortcut key.

HotkeyConfig.json

{
    "Hotkeys":
    {
        "HotkeyA": {
            "ChameleonTools": "../Python/ChameleonGallery/ChameleonGallery.json"
        },
        "HotkeyB": {
            "command": "unreal.EditorLevelLibrary.set_selected_level_actors([actor for actor in unreal.EditorLevelLibrary.get_all_level_actors() if len(str(actor.get_name())) > 60])"
        },
        "HotkeyC": {
            "command": "print('Hotkey C')"
        },
        "HotkeyD": {
            "command": "print('Hotkey D')"
        },
        "HotkeyE": {
            "command": "print('Hotkey E')"
        }
        ...
    }
}

For example, the configuration above assigns theChameleonGallery tool to "HotkeyA", and a short Python code (select all Actors in the scene with a name length exceeding 60) to "HotkeyB"

Like configuring menu items, the Python command is specified using the "command" field, and opening Python tools uses the "ChameleonTools" field.

NOTE
Here, we assign tools and commands to the abstract "HotKeyX" instead of directly binding them to specific shortcut keys. The advantage is that different users working on the same project can configure their preferred shortcut keys.

  1. In Editor Preferences, bind each "HotKeyX" to the actual shortcut keys.

TAPython shortcut settings in Unreal Engine's Editor settings

In this example, when we press "Alt + Shift + G", it will trigger "HotKeyA" and open theChameleonGallery

Other Tips

If we want to bind a button in a Chameleon tool to a shortcut key, for example, binding the button click in minimum Example to a shortcut key.

TAPython does not directly provide this feature. However, we can directly bind the code to be executed in the button's OnClick event, chameleon_example.on_button_click(), to a shortcut key to achieve a similar purpose.

TIP
In the code above, the chameleon_example variable is empty before the minimum Example is opened, so remember to check for null values in the shortcut key binding code.