Navigation
API > API/Plugins > API/Plugins/ModelingComponents
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 | UInteractiveToolActivity |
| Type | class |
| Header File | /Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/InteractiveToolActivity.h |
| Include Path | #include "InteractiveToolActivity.h" |
Syntax
UCLASS (MinimalAPI)
class UInteractiveToolActivity : public UInteractionMechanic
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UInteractionMechanic → UInteractiveToolActivity
Derived Classes
UInteractiveToolActivity derived class hierarchy
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~UInteractiveToolActivity() |
Note about the below: we didn't really need to repeat Setup(), Tick(), and Render() here since these are staying the same as UInteractionMechanic and get inherited. | InteractiveToolActivity.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual bool CanAccept () |
If true, calling End with EToolShutdownType::Accept will result in a valid completion of the activity. | InteractiveToolActivity.h | |
virtual bool CanStart() |
Check whether a Start() call will result in a success. | InteractiveToolActivity.h | |
virtual EToolActivityEndResult End
(
EToolShutdownType |
Force an end to the activity. | InteractiveToolActivity.h | |
virtual bool HasAccept() |
Similar to a tool, this determines whether the activity prefers an accept/cancel option to be displayed (if true) vs a "complete". | InteractiveToolActivity.h | |
virtual bool IsRunning() |
Check whether the activity is running (though the tool can just check the result of Start() itself). | InteractiveToolActivity.h | |
virtual void Shutdown
(
EToolShutdownType ShutdownType |
Should be called during a tool's Shutdown() | InteractiveToolActivity.h | |
virtual EToolActivityStartResult Start() |
Attempt to start the activity. | InteractiveToolActivity.h |
Overridden from UInteractionMechanic
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void Render
(
IToolsContextRenderAPI* RenderAPI |
If the activity is running, should be called from the tool's Render() | InteractiveToolActivity.h | |
virtual void Setup
(
UInteractiveTool* ParentToolIn |
Should be called during a tool's Setup(). Does not start the activity. | InteractiveToolActivity.h | |
virtual void Tick
(
float DeltaTime |
If the activity is running, should be called from the tool's OnTick() | InteractiveToolActivity.h |