TInteractiveToolCommands

[TInteractiveToolCommands](API\Editor\UnrealEd\Tools\TInteractiveToolCommands) is a base class that handles connecting up Tool Actions (ie the [FInteractiveToolAction](API\Runtime\InteractiveToolsFramework\FInteractiveToolAction) provided by a [UInteractiveTool](API\Runtime\InteractiveToolsFramework\UInteractiveTool)) to the UnrealEditor Command system, which allows for remappable hotkeys, etc

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

UnrealEd

Header

/Engine/Source/Editor/UnrealEd/Public/Tools/InteractiveToolsCommands.h

Include

#include "Tools/InteractiveToolsCommands.h"

Syntax

template<typename CommandContextType>
class TInteractiveToolCommands : public TCommands< CommandContextType >

Remarks

TInteractiveToolCommands is a base class that handles connecting up Tool Actions (ie the FInteractiveToolAction provided by a UInteractiveTool) to the UnrealEditor Command system, which allows for remappable hotkeys, etc

Usage is as follows:

  • in your EdMode Module, create a subclass-instance of this, say FMyToolCommands and call FMyToolCommands::Register() in your ::StartupModule() function

  • subclass must implement ::GetToolDefaultObjectList(), here you just add GetMutableDefault<MyToolX> to the input list for all your Tools

  • add a member TSharedPtr<FUICommandList> UICommandList; to your EdMode impl

  • when you start a new Tool, call FMyToolCommands::Get().BindCommandsForCurrentTool(UICommandList, NewTool)

  • when you end a Tool, call FMyToolCommands::Get().UnbindActiveCommands()

  • in your EdModeImpl::InputKey override, call UICommandList->ProcessCommandBindings()

Variables

Name Description

Protected variable

TArray< FToolAc...

 

ActionCommands

Protected variable

TMap< EStandard...

 

SharedActionCommands

Support for sharing common commands between Tools where the commands are not shared across Tool Modes (and hence not in FStandardToolModeCommands)List FToolActionCommands for standard Tool Actions

Constructors

Name Description

Protected function

TInteractiveToolCommands

(
    const FName InContextName,
    const FText& InContextDesc,
    const FName InContextParent,
    const FName InStyleSetName
)

Forwarding constructor

Functions

Name Description

Public function Virtual Const

void

 

BindCommandsForCurrentTool

(
    TSharedPtr< FUICommandList > UIComm...,
    UInteractiveTool* Tool
)

Bind any of the registered UICommands to the given Tool, if they are compatible.

Protected function

bool

 

FindOrCreateSharedCommand

(
    EStandardToolActions ActionID,
    FToolActionCommand& FoundOut
)

Find or Create a UICommand for a standard Tool Action, that will be shared across Tools

Protected function Virtual

TSharedPtr< ...

 

FindStandardCommand

(
    EStandardToolActions ToolActionID
)

Query FStandardToolModeCommands to find an existing command/hotkey for this standard tool action

Public function

void

 

GetToolDefaultObjectList

(
    TArray< UInteractiveTool* >& ...
)

Interface that subclasses need to implement RegisterCommands() needs actual UInteractiveTool instances for all the Tools that want to provide Actions which will be connected to hotkeys.

Protected function Virtual

bool

 

IntializeStandardToolAction

(
    EStandardToolActions ActionID,
    FInteractiveToolAction& ToolAction...
)

Create a suitable FInteractiveToolAction for the standard Tool Action, ie with suitable command name and description strings and hotkeys.

Protected function

void

 

RegisterUIToolCommand

(
    const FInteractiveToolAction& Tool...,
    TSharedPtr< FUICommandInfo >& UICo...
)

Utility function that registeres a Tool Aciton as a UICommand

Public function Virtual Const

void

 

UnbindActiveCommands

(
    TSharedPtr< FUICommandList > UIComm...
)

Unbind all of the currently-registered commands

Overridden from TCommands

Name Description

Public function Virtual

void

 

RegisterCommands()

Initialize commands.

Classes

Name

Description

Protected struct

FToolActionCommand

List of pairs of known Tool Actions and their associated UICommands.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss