UInteractiveToolManager

[UInteractiveToolManager](API\Runtime\InteractiveToolsFramework\UInteractiveToolManager) allows users of the tools framework to create and operate Tool instances.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

UObjectBase

UObjectBaseUtility

UObject

UInteractiveToolManager

References

Module

InteractiveToolsFramework

Header

/Engine/Source/Runtime/InteractiveToolsFramework/Public/InteractiveToolManager.h

Include

#include "InteractiveToolManager.h"

Syntax

class UInteractiveToolManager :
    public UObject,
    public IToolContextTransactionProvider

Remarks

UInteractiveToolManager allows users of the tools framework to create and operate Tool instances. For each Tool, a (string,ToolBuilder) pair is registered with the ToolManager. Tools can then be activated via the string identifier.

Currently a single Tool can be active for each input device. So for mouse input a single Tool is available and effectively a lightweight mode. The mouse uses the "Left" tool slot.

For VR controllers and touch input, a "Left" and "Right" tool can be active at the same time.

Tools are not directly created. Use SelectActiveToolType(side,string) to set the active ToolBuilder on a given side, and then use ActivateTool() to create the new Tool instance.

Variables

Name Description

Protected variable

UInteractiveToo...

 

ActiveLeftBuilder

Protected variable

FString

 

ActiveLeftBuilderName

Currently-active Left ToolBuilder

Public variable

TObjectPtr< UIn...

 

ActiveLeftTool

Currently-active Left Tool, or null if no Tool is active

Protected variable

FString

 

ActiveLeftToolName

Protected variable

UInteractiveToo...

 

ActiveRightBuilder

Protected variable

FString

 

ActiveRightBuilderName

Currently-active Right ToolBuilder

Public variable

TObjectPtr< UIn...

 

ActiveRightTool

Currently-active Right Tool, or null if no Tool is active

Protected variable

FString

 

ActiveRightToolName

Protected variable

EToolChangeTrac...

 

ActiveToolChangeTrackingMode

Protected variable

bool

 

bActiveToolMadeSelectionStoreRequest

Tracks whether the last activated tool has made a request to store a tool selection.

Protected variable

bool

 

bIsActive

This flag is set to true on Initialize() and false on Shutdown().

Protected variable

UInputRouter &#...

 

InputRouter

Pointer to current InputRouter (Context owns this)

Public variable

FToolManagerToo...

 

OnToolEnded

Public variable

FToolManagerToo...

 

OnToolPostBuild

Public variable

FToolManagerToo...

 

OnToolPostSetup

Public variable

FToolManagerToo...

 

OnToolStarted

Protected variable

IToolsContextQu...

 

QueriesAPI

Pointer to current Context-Queries implementation

Protected variable

TMap< FString, ...

 

ToolBuilders

Current set of named ToolBuilders

Protected variable

IToolsContextTr...

 

TransactionsAPI

Pointer to current Transactions implementation

Constructors

Name Description

Protected function

UInteractiveToolManager()

Functions

Name Description

Public function Virtual

bool

 

ActivateTool

(
    EToolSide Side
)

Try to activate a new Tool instance on the given Side

Protected function Virtual

bool

 

ActivateToolInternal

(
    EToolSide Side
)

Public function Virtual

bool

 

CanAcceptActiveTool

(
    EToolSide Side
)

Check if an active Tool on the given Side can be Accepted in its current state

Public function Virtual

bool

 

CanActivateTool

(
    EToolSide eSide,
    FString Identifier
)

Check if a named Tool type can currently be activated on the given ToolSide

Public function Virtual

bool

 

CanCancelActiveTool

(
    EToolSide Side
)

Check if an active Tool on the given Side can be Canceled

Public function Virtual

void

 

ConfigureChangeTrackingMode

(
    EToolChangeTrackingMode ChangeMode
)

Configure how tool changes emit change events. See EToolChangeTrackingMode for details.

Public function Virtual

void

 

DeactivateTool

(
    EToolSide Side,
    EToolShutdownType ShutdownType
)

Shut down an active Tool on the given side

Protected function Virtual

void

 

DeactivateToolInternal

(
    EToolSide Side,
    EToolShutdownType ShutdownType
)

Public function Virtual

void

 

DisplayMessage

(
    const FText& Message,
    EToolMessageLevel Level
)

Functions that Tools can call to interact with Transactions APIPost a message via the Transactions API

Protected function Virtual

void

 

DoPostBuild

(
    EToolSide Side,
    UInteractiveTool* InBuiltTool,
    UInteractiveToolBuilder* InToo...,
    const FToolBuilderState& InBuilder...
)

Called immediately after a tool is built. Broadcasts OnToolPostBuild.

Protected function Virtual

void

 

DoPostSetup

(
    EToolSide Side,
    UInteractiveTool* InInteractiv...,
    UInteractiveToolBuilder* InToo...,
    const FToolBuilderState& InBuilder...
)

Called immediately after a tool's Setup is called. Broadcasts OnToolPostSetup.

Public function Virtual

void

 

DrawHUD

(
    FCanvas* Canvas,
    IToolsContextRenderAPI* Render...
)

Let active Tools do their screen space drawing.

Public function Virtual

UInteractive...

 

GetActiveTool

(
    EToolSide Side
)

Get pointer to active Tool on a given side

Public function Virtual

UInteractive...

 

GetActiveToolBuilder

(
    EToolSide Side
)

Get pointer to active Tool Builder on a given side

Public function Virtual

FString

 

GetActiveToolName

(
    EToolSide Side
)

Get name of registered ToolBuilder that created active tool for given side, or empty string if no tool is active

Public function Const

UContextObje...

 

GetContextObjectStore()

Public function Virtual

IToolsContex...

 

GetContextQueriesAPI()

Access to APIs, etc

Public function Virtual

IToolsContex...

 

GetContextTransactionsAPI()

Public function

UInteractive...

 

GetPairedGizmoManager()

Public function Virtual Const

bool

 

HasActiveTool

(
    EToolSide Side
)

Check if there is an active Tool on the given Side

Public function Virtual Const

bool

 

HasAnyActiveTool()

Protected function Virtual

void

 

Initialize

(
    IToolsContextQueriesAPI* Queri...,
    IToolsContextTransactionsAPI* ...,
    UInputRouter* InputRouter
)

Initialize the ToolManager with the necessary Context-level state.

Public function Const

bool

 

IsActive()

Public function Virtual

void

 

PostInvalidation()

Request an Invalidation via the Transactions API (ie to cause a repaint, etc)

Public function Virtual

void

 

RegisterToolType

(
    const FString& Identifier,
    UInteractiveToolBuilder* Build...
)

Tool registration and Current Tool state Register a new ToolBuilder

Public function Virtual

void

 

Render

(
    IToolsContextRenderAPI* Render...
)

Render any active Tools.

Public function Virtual

bool

 

RequestSelectionChange

(
    const FSelectedOjectsChangeList& S...
)

Forward an FChange object to the Context

Public function Virtual

bool

 

SelectActiveToolType

(
    EToolSide Side,
    const FString& Identifier
)

Set active ToolBuilder for a ToolSide via string identifier

Protected function Virtual

void

 

Shutdown()

Shutdown the ToolManager.

Public function Virtual

void

 

Tick

(
    float DeltaTime
)

State control (Tick any active Tools. Called by UInteractiveToolsContext

Public function Virtual

void

 

UnregisterToolType

(
    const FString& Identifier
)

Unregisters a ToolBuilder

Overridden from IToolContextTransactionProvider

Name Description

Public function Virtual

void

 

BeginUndoTransaction

(
    const FText& Description
)

Request that the Context open a Transaction, whatever that means to the current Context

Public function Virtual

void

 

EmitObjectChange

(
    UObject* TargetObject,
    TUniquePtr< FToolCommandChange > Ch...,
    const FText& Description
)

Forward an FChange object to the Context

Public function Virtual

void

 

EndUndoTransaction()

Request that the Context close and commit the open Transaction

Typedefs