Navigation
API > API/Runtime > API/Runtime/InteractiveToolsFramework
TODO: Do we need more control over factory order to prioritize which gets used if we can make multiple qualifying targets? It should theoretically not matter, but in practice, one target or another could be more efficient for certain tasks. This is probably only worth thinking about once we encounter it. NOTE FOR IMPLEMENTING CACHING: Someday we will probably write a tool target manager that caches tool targets and gives prebuilt ones when possible to avoid any extra conversions. When implementing this, note that currently, some targets store converted versions of their source objects without a way to determine whether their stored conversion is out of date. The cached target will then give an incorrect result if the source object has been modified after caching. One way to deal with this is to have subclasses of UToolTarget that give the degree of cacheability- fully cacheable (i.e., detects changes and rebuilds if necessary), cacheable only if changes are made through that tool target (i.e. target manager has to clear it if object may have changed; may choose not to have this option), or not cacheable. The tool target manager converts input objects into tool targets- objects that can expose various interfaces that tools need to operate on them.
Someday, the tool target manager may implement caching of targets.
See the class comment for UToolTarget for more info.
| Name | UToolTargetManager |
| Type | class |
| Header File | /Engine/Source/Runtime/InteractiveToolsFramework/Public/ToolTargetManager.h |
| Include Path | #include "ToolTargetManager.h" |
Syntax
UCLASS (Transient, MinimalAPI)
class UToolTargetManager : public UObject
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UToolTargetManager
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UToolTargetManager() |
ToolTargetManager.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| InputFilterFunction | TFunction< bool(const UObject *)> | ToolTargetManager.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void AddTargetFactory
(
UToolTargetFactory* Factory |
Add a new ToolTargetFactory | ToolTargetManager.h | |
virtual TArray< TObjectPtr< UToolTarget > > BuildAllSelectedTargetable
(
const FToolBuilderState& SceneState, |
Looks through the current selected components and actors and builds all targets that satisfy the requirements. | ToolTargetManager.h | |
virtual UToolTarget * BuildFirstSelectedTargetable
(
const FToolBuilderState& SceneState, |
Looks through the currently selected components and actors and builds a target out of the first encountered element that satisfies the requirements. | ToolTargetManager.h | |
virtual UToolTarget * BuildTarget
(
UObject* SourceObject, |
Uses one of the stored factories to build a tool target out of the given input object that satisfies the given requirements. | ToolTargetManager.h | |
CastToType * BuildTarget
(
UObject* SourceObject, |
Much like BuildTarget, but casts the target to the template argument before returning. | ToolTargetManager.h | |
virtual bool CanBuildTarget
(
UObject* SourceObject, |
Examines stored target factories to see if one can build the requested type of target. | ToolTargetManager.h | |
virtual int32 CountSelectedAndTargetable
(
const FToolBuilderState& SceneState, |
Looks through the currently selected components and actors and counts the number of inputs that could be used to create qualifying tool targets. | ToolTargetManager.h | |
virtual int32 CountSelectedAndTargetableWithPredicate
(
const FToolBuilderState& SceneState, |
Looks through the currently selected components and actors and counts the number of inputs that could be used to create qualifying tool targets with an additional test predicate. | ToolTargetManager.h | |
virtual void EnumerateSelectedAndTargetableComponents
(
const FToolBuilderState& SceneState, |
Looks through the currently selected components and actors and counts the number of inputs that could be used to create qualifying tool targets. | ToolTargetManager.h | |
virtual UToolTargetFactory * FindFirstFactoryByPredicate
(
TFunctionRef< bool(UToolTargetFactory*)> Predicate |
Find the first ToolTargetFactory that passes the Predicate function | ToolTargetManager.h | |
CastToType * FindFirstFactoryByType() |
Find the first ToolTargetFactory of a given type | ToolTargetManager.h | |
virtual void Initialize () |
Initialize the ToolTargetManager. | ToolTargetManager.h | |
bool IsActive() |
ToolTargetManager.h | ||
virtual void RemoveTargetFactoriesByPredicate
(
TFunctionRef< bool(UToolTargetFactory*)> Predicate |
Remove existing ToolTargetFactories by predicate | ToolTargetManager.h | |
| Additional filter function that will be applied in CanBuildTarget and BuildTarget. | ToolTargetManager.h | ||
virtual void Shutdown () |
Shutdown the ToolTargetManager. | ToolTargetManager.h |