Choose your operating system:
Windows
macOS
Linux
Module |
|
Header |
/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/InteractiveToolActivity.h |
Include |
#include "InteractiveToolActivity.h" |
UCLASS()
class UInteractiveToolActivity : public UInteractionMechanic
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()).
Name | Description | |
---|---|---|
|
~UInteractiveToolActivity() |
Since these are staying the same as UInteractionMechanic and get inherited. |
Name | Description | ||
---|---|---|---|
|
CanAccept() |
If true, calling End with EToolShutdownType::Accept will result in a valid completion of the activity. |
|
|
CanStart() |
Check whether a Start() call will result in a success. |
|
|
EToolActivit... |
End |
Force an end to the activity. |
|
IsRunning() |
Check whether the activity is running (though the tool can just check the result of Start() itself). |
|
|
Shutdown ( |
Should be called during a tool's Shutdown()Should be called during a tool's Shutdown() |
|
|
EToolActivit... |
Start() |
Attempt to start the activity. |
Name | Description | ||
---|---|---|---|
|
Render ( |
If the activity is running, should be called from the tool's Render() |
|
|
Setup ( |
Should be called during a tool's Setup(). |
|
|
Tick ( |
If the activity is running, should be called from the tool's OnTick() |