# Can I add command/hotkey to the Blueprint Editors SEditorViewport from a Plugin?

**URL:** <https://forums.unrealengine.com/t/can-i-add-command-hotkey-to-the-blueprint-editors-seditorviewport-from-a-plugin/1604844>\
**Category:** Editor Scripting\
**Tags:** unreal-engine, editor, question, CPP\
**Created:** [January 10, 2024, 6:48pm UTC](https://forums.unrealengine.com/t/can-i-add-command-hotkey-to-the-blueprint-editors-seditorviewport-from-a-plugin/1604844 "2024-01-10T18:48:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![officernickwilde](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/officernickwilde/32/547477_2.png) [@officernickwilde](https://forums.unrealengine.com/u/officernickwilde)\
**Post date:** [January 10, 2024, 6:48pm UTC](https://forums.unrealengine.com/t/can-i-add-command-hotkey-to-the-blueprint-editors-seditorviewport-from-a-plugin/1604844/1 "2024-01-10T18:48:20Z")

</div>

Hi, Im writing an editor plugin that adds some basic transformation tools - I noticed that commands like translate/rotate/scale is added by appending directly to `SEditorViewport::CommandList` in `SEditorViewport::BindCommands()` - so I naively had a go at doing the same via `SEditorViewport::GetCommandList().Append()` on a `SEditorViewport` instance whilst the editor was well up & running - but this resulted in an invalid memory access due to `SEditorViewport`s `CommandList` lacking a FUICommandList “parent” (I dont remember the name of the attribute on the top of my head, but it was something with parent).

## So to my question:

Does anyone know of any code samples or plugins that appear to be able to bind commands to the Blueprint asset editor’s 3D viewport or alternatively all viewports in the engine (2D & 3D)?

### Thanks for reading 💝

---

<div class="post-metadata">

**Author:** ![pasotee](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pasotee/32/1225098_2.png) [@pasotee](https://forums.unrealengine.com/u/pasotee)\
**Post date:** [January 13, 2024, 1:39pm UTC](https://forums.unrealengine.com/t/can-i-add-command-hotkey-to-the-blueprint-editors-seditorviewport-from-a-plugin/1604844/2 "2024-01-13T13:39:52Z")

</div>

You can write an `IInputProcessor` which captures input before it is processed by the engine. This way you can trigger certain actions/behavior when a shortcut is triggered.

Here is a sample:

```auto
#pragma once

#include <Framework/Application/IInputProcessor.h>

class FExample : public IInputProcessor
{
public:
	virtual void Tick(const float DeltaTime, FSlateApplication& SlateApp, TSharedRef<ICursor> Cursor) override{};
	virtual bool HandleKeyDownEvent(FSlateApplication& SlateApp, const FKeyEvent& InKeyEvent) override;
};

```

```auto
bool FExample::HandleKeyDownEvent(FSlateApplication& SlateApp, const FKeyEvent& InKeyEvent)
{
	// check for your input
	// return true if you want to prevent the engine from handling the input, false otherwise.
	return true;
}

```

and to register it inside the `StartupModule` you need to:

```auto
InputProcessor = MakeShared<FExample>();
FSlateApplication::Get().RegisterInputPreProcessor(InputProcessor, 0);

```

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [February 12, 2024, 1:40pm UTC](https://forums.unrealengine.com/t/can-i-add-command-hotkey-to-the-blueprint-editors-seditorviewport-from-a-plugin/1604844/3 "2024-02-12T13:40:26Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
