Navigation
API > API/Plugins > API/Plugins/ModelingComponents > API/Plugins/ModelingComponents/Selection
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UGeometrySelectionManager
References
| Module | ModelingComponents |
| Header | /Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/Selection/GeometrySelectionManager.h |
| Include | #include "Selection/GeometrySelectionManager.h" |
Syntax
UCLASS&40;&41;
class UGeometrySelectionManager : public UObject
Remarks
UGeometrySelectionManager provides the infrastructure for "Element Selection", ie geometric sub-elements of some geometry object like a Triangle Mesh. The Manager is designed to work with a relatively vague concept of "element", so it doesn't explicitly reference triangles/etc, and the selectable-elements and how-elements-are-selected concepts are provided by abstract-interfaces that allow various implememtations.
The "Geometry Objects", eg like a DynamicMeshComponent, Gameplay Volume, etc, are referred to as "Active Targets" in the Manager. External code provides and updates the set of Active Targets, eg for example tracking the active Actor Selection in the Editor.
For a given Target, a tuple (Selector, Selection, SelectionEditor) is created and maintained. The FGeometrySelection is ultimately a basic list of integers and does not have any knowledge of what it is a selection of, and is not intended to be directly edited. Instead the SelectionEditor provides that functionality. This separation allows "selection editing" to be customized, eg to enforce invariants or constraints that might apply to certain kinds of selections.
The IGeometrySelector provides the core implementation of what "selection" means for a given Target, eg like a mesh Component, or mesh object like a UDynamicMesh. The Selector is created by a registered Factory, allowing client code to provide custom implementations for different Target Types. Updates to the Selection are done via the Selector, as well as queries about (eg) renderable selection geometry. 3D Transforms are also applied via the Selector, as only it has the knowledge about what can be transformed and how it can be applied.
The GeometrySelectionManager provides high-level interfaces for this system, for example external code (eg such as something that creates a Gizmo for the active selection) only needs to interact with SelectionManager, calling functions like ::BeginTransformation() / ::UpdateTransformation() / ::EndTransformation(). The SelectionManager also handles Transactions/FChanges for the active Targets and Selections.
Variables
| Type | Name | Description | |
|---|---|---|---|
| FGeometrySelection | ActivePreviewSelection | 3D geometry for active hover/preview highlight note: currently only supporting single target here, will need to be refactored to handle multiple targets... | |
| TMap< FGeometryIdentifier, TSharedPtr< FGeometrySelectionTarget > > | ActiveTargetMap | Map from external Identifiers to active Selection Targets | |
| TArray< TSharedPtr< FGeometrySelectionTarget > > | ActiveTargetReferences | Set of active Selection Targets updated by SynchronizeActiveTargets / etc. | |
| UE::Geometry::FGeometrySelectionDelta | ActiveTrackedDelta | ||
| FGeometrySelection | ActiveTrackedSelection | ||
| FGeometrySelectionUpdateConfig | ActiveTrackedUpdateConfig | ||
| TArray< IGeometrySelectionTransformer * > | ActiveTransformations | TransformationsSet of existing transformer objects, collected from active IGeometrySelector::InitializeTransformation(). | |
| bool | bInTrackedSelectionChange | Support for complex selection changes that are driven externally | |
| bool | bSelectionModifiedDuringTrackedChange | ||
| bool | bSelectionRenderCachesDirty | ||
| FGeometrySelectionElements | CachedPreviewRenderElements | ||
| TArray< FGeometrySelectionElements > | CachedSelectionRenderElements | 3D geometry for element selections of each ActiveTarget is cached to improve rendering performance | |
| TArray< TUniquePtr< IGeometrySelectorFactory > > | Factories | Set of registered IGeometrySelector factories | |
| UE::Geometry::FGeometrySelectionDelta | InitialTrackedDelta | ||
| EMeshTopologyMode | MeshTopologyMode | ||
| FModelingSelectionInteraction_SelectionModified | OnSelectionModified | OnSelectionModified is broadcast if the selection is modified via the above functions. | |
| TObjectPtr< UGeometrySelectionEditCommandArguments > | SelectionArguments | This is set to current selection during CanExecuteSelectionCommand/ExecuteSelectionCommand, to keep the UObject alive Not expected to be used outside that context | |
| EGeometryElementType | SelectionElementType | ||
| TMap< FGeometryIdentifier, TSharedPtr< FGeometrySelectionTarget > > | TargetCache | Support for cached FGeometrySelectionTarget / IGeometrySelectors. | |
| TObjectPtr< UInteractiveToolsContext > | ToolsContext | ||
| IToolsContextTransactionsAPI * | TransactionsAPI | ||
| TArray< FGeometryIdentifier > | UnlockedTargets |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AccumulateSelectionUpdate_Raycast
(
const FRay3d& WorldRay, |
Update the tracked selection change via a single Raycast, using the active UpdateConfig mode passed to BeginTrackedSelectionChange | |
| bool | AddActiveTarget
(
FGeometryIdentifier Target |
Add a target to the active target set, if a valid IGeometrySelectorFactory can be found | |
| void | ApplyChange
(
IGeometrySelectionChange* Change |
Undo/Redo | |
| bool | BeginTrackedSelectionChange
(
FGeometrySelectionUpdateConfig UpdateConfig, |
Begin a tracked selection change. | |
| bool | Begin a transformation of element selections in active Targets. | ||
| bool | Support for more complex selection changes that might (eg) occur over multiple frames, or be computed externally. | ||
| bool | CanExecuteSelectionCommand
(
UGeometrySelectionEditCommand* Command |
Command Execution | |
| void | |||
| void | Empty the active selection target set | ||
| void | Selection Updates Clear any active element selections. | ||
| void | |||
| void | Debugging stuffPrint information about the active selection using UE_LOG | ||
| void | DebugRender
(
IToolsContextRenderAPI* RenderAPI |
Visualize the active selection using PDI drawing | |
| void | Close an active tracked selection change. | ||
| void | End the current active transformation, and emit changes/transactions | ||
| void | ExecuteSelectionCommand
(
UGeometrySelectionEditCommand* Command |
Execute the selection command for all the current selections | |
| void | GetActiveSelectionInfo
(
EGeometryTopologyType& TopologyTypeOut, |
Get avaialble information about the active selection/state | |
| bool | |||
| bool | |||
| TSharedPtr< FGeometrySelectionTarget > | GetCachedTarget
(
FGeometryIdentifier Identifier, |
||
| UE::Geometry::FGeometrySelectionHitQueryConfig | |||
| TArray< FGeometryIdentifier > | |||
| EMeshTopologyMode | |||
| bool | GetSelectionBounds
(
FGeometrySelectionBounds& BoundsOut |
||
| EGeometryElementType | |||
| bool | GetSelectionForComponent
(
UPrimitiveComponent* Component, |
Get the active element selection for the given Component, if it exists | |
| EGeometryTopologyType | |||
| void | GetSelectionWorldFrame
(
UE::Geometry::FFrame3d& SelectionFrame |
||
| UInteractiveToolsContext * | |||
| IToolsContextTransactionsAPI * | |||
| bool | Target Management / Queries TODO: be able to update active target set w/o losing current selections? | ||
| bool | |||
| bool | HasSelection () |
Selection queries | |
| bool | HasSelectionForComponent
(
UPrimitiveComponent* Component |
||
| void | Initialize
(
UInteractiveToolsContext* ToolsContextIn, |
Setup/Teardown | |
| bool | |||
| bool | |||
| void | OnTargetGeometryModified
(
IGeometrySelector* Selector |
||
| void | ProcessActiveSelections
(
TFunctionRef< void(FGeometrySelectionHandle)> ProcessFunc |
Apply ProcessFunc to active selections via handles, perhaps should be public? | |
| bool | RayHitTest
(
const FRay3d& WorldRay, |
Test if a World-space ray "hits" the current active target set, which can be used to (eg) determine if a higher-level user interaction for selection should "Capture" the click | |
| void | |||
| void | RegisterSelectorFactory
(
TUniquePtr< IGeometrySelectorFactory > Factory |
||
| void | |||
| void | RevertChange
(
IGeometrySelectionChange* Change |
||
| void | SetCurrentTargetsLockState
(
bool bLocked |
||
| void | SetMeshTopologyMode
(
EMeshTopologyMode SelectionMode |
||
| void | SetMeshTopologyModeInternal
(
EMeshTopologyMode NewTopologyMode |
||
| void | SetSelectionElementType
(
EGeometryElementType ElementType |
||
| void | SetSelectionElementTypeInternal
(
EGeometryElementType NewElementType |
||
| bool | SetSelectionForComponent
(
UPrimitiveComponent* Component, |
Directly set the current Selection for the specified Component to NewSelection. | |
| void | SetTargetLockStateOnUndoRedo
(
FGeometryIdentifier TargetIdentifier, |
||
| void | SetTargetsOnUndoRedo
(
TArray< FGeometryIdentifier > NewTargets |
||
| void | Shutdown () |
||
| void | SleepOrShutdownTarget
(
TSharedPtr< FGeometrySelectionTarget > Target, |
||
| void | SynchronizeActiveTargets
(
const TArray< FGeometryIdentifier >& DesiredActiveSet, |
Update the current active target set based on DesiredActiveSet, assuming that a valid IGeometrySelectorFactory can be found for each identifier. | |
| bool | UpdateSelectionPreviewViaRaycast
(
const FRay3d& WorldRay |
Hover/Preview support | |
| void | |||
| void | UpdateSelectionViaConvex
(
const FConvexVolume& ConvexVolume, |
Use the given ConvexVolume to update the active element selection based on UpdateConfig. | |
| void | UpdateSelectionViaRaycast
(
const FRay3d& WorldRay, |
Use the given WorldRay to update the active element selection based on UpdateConfig. | |
| void | UpdateTransformation
(
TFunctionRef< FVector3d(int32VertexID, const FVector3d&, const FTransform&)> PositionTransformFunc |
Update the active transformations with the given PositionTransformFunc. |
Classes
| Type | Name | Description | |
|---|---|---|---|
| FGeometrySelectionTarget | FGeometrySelectionTarget is the set of information tracked for a given "Active Target", which is (eg) a Mesh Component or other external object that "owns" selectable Geometry. |
Enums
| Type | Name | Description | |
|---|---|---|---|
| EMeshTopologyMode | ConfigurationEMeshTopologyMode determines what level of mesh element will be selected |