UInteractiveToolActivity

A tool activity is a sort of "sub-tool" used to break apart functionality in tools that provide support for different multi-interaction subtasks.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

ModelingComponents

Header

/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/InteractiveToolActivity.h

Include

#include "InteractiveToolActivity.h"

Syntax

UCLASS()
class UInteractiveToolActivity : public UInteractionMechanic

Remarks

A tool activity is a sort of "sub-tool" used to break apart functionality in tools that provide support for different multi-interaction subtasks. It is meant to limit the sprawl of switch statements in the base tool, to allow subtasks to be designed similar to how a tool might be designed, and to ease extendability.

An activity has the following expectations:

  • Setup() is called in host tool setup and Shutdown() is called in host tool Shutdown()

  • Start() is called to start the activity (such as when user clicks a button).

  • If the activity returns a result of EStartResult::ActivityRunning on Start(), it will expect Render() and Tick() calls from the host until either (a)- the host calls End() on the activity, or (b)- the activity reaches a stopping point itself and calls NotifyActivitySelfEnded() on the host. The activity should not require Render() and Tick() if it is not running. Compared to a UInteractionMechanic, a tool activity:

  • Expects that it is the main consumer of input, i.e. takes over the tool. Mechanics, by contrast, are currently often used together with other mechanics, or to support main tool functionality.

  • Should not require the hosting tool to have specific knowledge about it or be heavily involved. Mechanics, by contrast, currently often require tools to use various mechanic-specific getters/setters during the tool.

Passing data back and forth can be done either by letting a tool activity use a specific context object that the tool can prep in the context store, or by requiring the host to implement specific interfaces (that the activity can check for in Setup()).

Destructors

Name Description

Public function Virtual

~UInteractiveToolActivity()

Since these are staying the same as UInteractionMechanic and get inherited.

Functions

Name Description

Public function Virtual Const

bool

 

CanAccept()

If true, calling End with EToolShutdownType::Accept will result in a valid completion of the activity.

Public function Virtual Const

bool

 

CanStart()

Check whether a Start() call will result in a success.

Public function Virtual

EToolActivit...

 

End

(
    EToolShutdownType
)

Force an end to the activity.

Public function Virtual Const

bool

 

IsRunning()

Check whether the activity is running (though the tool can just check the result of Start() itself).

Public function Virtual

void

 

Shutdown

(
    EToolShutdownType ShutdownType
)

Should be called during a tool's Shutdown()Should be called during a tool's Shutdown()

Public function Virtual

EToolActivit...

 

Start()

Attempt to start the activity.

Overridden from UInteractionMechanic

Name Description

Public function Virtual

void

 

Render

(
    IToolsContextRenderAPI* Render...
)

If the activity is running, should be called from the tool's Render()

Public function Virtual

void

 

Setup

(
    UInteractiveTool* ParentToolIn
)

Should be called during a tool's Setup().

Public function Virtual

void

 

Tick

(
    float DeltaTime
)

If the activity is running, should be called from the tool's OnTick()