Is it possible to add custom commands/shortcuts to the Viewport?

Hi !

I managed to have custom commands working with “MainFrame” Module, but shortcuts only work when the focus is elsewere outside of the level viewport. Any idea how to add these commands/shortcuts on the level viewport too ?

Here a sneak peek of the c++ part which add a custom command to the “MainFrame” module.

#include "MyPlugin.h"
#include "MyPluginCommands.h"

#include "MainFrame.h"


void FMyPluginModule::StartupModule()
{

    FMyPluginCommands::Register();

    ...

    // Keyboard shortcut on MainFrame
    auto const MainFrameCommands = FModuleManager::LoadModuleChecked<IMainFrameModule>("MainFrame").GetMainFrameCommandBindings();
    {
        FUIAction const Action(FExecuteAction::CreateRaw(this, &FMyPluginModule::PluginButtonClicked));
        MainFrameCommands->MapAction(FMyPluginCommands::Get().PluginAction, Action);
    }

}

// (Don’t forget to add “MainFrame” module to your Plugin dependencies)

Thanks !