Navigation
API > API/Plugins > API/Plugins/ModelingComponents
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.
| Name | UGeometrySelectionManager |
| Type | class |
| Header File | /Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/Selection/GeometrySelectionManager.h |
| Include Path | #include "Selection/GeometrySelectionManager.h" |
Syntax
UCLASS (MinimalAPI)
class UGeometrySelectionManager : public UObject
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UGeometrySelectionManager
Structs
| Name | Remarks |
|---|---|
| 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. |
| FSavedSelection | Tracks saved selection state. Useful when the selection is temporarily cleared (e.g., for a tool) |
Enums
Public
| Name | Remarks |
|---|---|
| EMeshTopologyMode | Configuration EMeshTopologyMode determines what level of mesh element will be selected |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| EGeometryElementType | UE::Geometry::EGeometryElementType | Selection/GeometrySelectionManager.h | |
| EGeometryTopologyType | UE::Geometry::EGeometryTopologyType | Selection/GeometrySelectionManager.h | |
| FGeometrySelection | UE::Geometry::FGeometrySelection | Selection/GeometrySelectionManager.h | |
| FGeometrySelectionBounds | UE::Geometry::FGeometrySelectionBounds | Selection/GeometrySelectionManager.h | |
| FGeometrySelectionEditor | UE::Geometry::FGeometrySelectionEditor | Selection/GeometrySelectionManager.h | |
| FGeometrySelectionElements | UE::Geometry::FGeometrySelectionElements | Selection/GeometrySelectionManager.h | |
| FGeometrySelectionUpdateConfig | UE::Geometry::FGeometrySelectionUpdateConfig | Selection/GeometrySelectionManager.h | |
| FGeometrySelectionUpdateResult | UE::Geometry::FGeometrySelectionUpdateResult | Selection/GeometrySelectionManager.h | |
| FModelingSelectionInteraction_SelectionModified | TMulticastDelegate_NoParams< void > | Selection/GeometrySelectionManager.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| HoverOverSelectedSetIds | TStaticArray< FString, 3 > | Selection/GeometrySelectionManager.h | |
| HoverOverUnselectedSetIds | TStaticArray< FString, 3 > | Selection/GeometrySelectionManager.h | |
| SelectedSetIds | TStaticArray< FString, 3 > | Selection/GeometrySelectionManager.h | |
| UnselectedSetIds | TStaticArray< FString, 3 > | Selection/GeometrySelectionManager.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| OnSelectionModified | FModelingSelectionInteraction_SelectionModified | OnSelectionModified is broadcast if the selection is modified via the above functions. | Selection/GeometrySelectionManager.h |
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| CachedSelectableRenderElements | TArray< FGeometrySelectionElements > | Selection/GeometrySelectionManager.h | ||
| RenderCachesDirtyFlags | EEnumerateRenderCachesDirtyFlags | Selection/GeometrySelectionManager.h | ||
| SavedSelection | FSavedSelection | Selection/GeometrySelectionManager.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void AccumulateSelectionUpdate_Raycast
(
const FRay3d& WorldRay, |
Update the tracked selection change via a single Raycast, using the active UpdateConfig mode passed to BeginTrackedSelectionChange | Selection/GeometrySelectionManager.h | |
bool AddActiveTarget
(
FGeometryIdentifier Target |
Add a target to the active target set, if a valid IGeometrySelectorFactory can be found | Selection/GeometrySelectionManager.h | |
virtual void ApplyChange
(
IGeometrySelectionChange* Change |
Undo/Redo | Selection/GeometrySelectionManager.h | |
virtual bool BeginTrackedSelectionChange
(
FGeometrySelectionUpdateConfig UpdateConfig, |
Begin a tracked selection change. | Selection/GeometrySelectionManager.h | |
virtual bool BeginTransformation() |
Begin a transformation of element selections in active Targets. | Selection/GeometrySelectionManager.h | |
virtual bool CanBeginTrackedSelectionChange () |
Support for more complex selection changes that might (eg) occur over multiple frames, or be computed externally. | Selection/GeometrySelectionManager.h | |
bool CanExecuteSelectionCommand
(
UGeometrySelectionEditCommand* Command |
Command Execution | Selection/GeometrySelectionManager.h | |
void ClearActiveTargets () |
Empty the active selection target set | Selection/GeometrySelectionManager.h | |
virtual void ClearSelection
(
bool bSaveSelectionBeforeClear |
Selection Updates Clear any active element selections. | Selection/GeometrySelectionManager.h | |
virtual void ClearSelectionPreview() |
Resets the active preview selection and invalidates its associated cached render elements. | Selection/GeometrySelectionManager.h | |
virtual void DebugPrintSelection() |
Debugging stuff Print information about the active selection using UE_LOG | Selection/GeometrySelectionManager.h | |
virtual void DebugRender
(
IToolsContextRenderAPI* RenderAPI |
Visualize the active selection using PDI drawing | Selection/GeometrySelectionManager.h | |
virtual void DiscardSavedSelection() |
Discard the saved selection, if there is one. | Selection/GeometrySelectionManager.h | |
void DisconnectPreviewGeometry() |
Disconnect and cleanup for PreviewGeometry object. | Selection/GeometrySelectionManager.h | |
virtual void EndTrackedSelectionChange () |
Close an active tracked selection change. | Selection/GeometrySelectionManager.h | |
virtual void EndTransformation() |
End the current active transformation, and emit changes/transactions | Selection/GeometrySelectionManager.h | |
void ExecuteSelectionCommand
(
UGeometrySelectionEditCommand* Command |
Execute the selection command for all the current selections | Selection/GeometrySelectionManager.h | |
virtual void GetActiveSelectionInfo
(
EGeometryTopologyType& TopologyTypeOut, |
Get available information about the active selection/state | Selection/GeometrySelectionManager.h | |
bool GetAnyCurrentTargetsLockable() |
Selection/GeometrySelectionManager.h | ||
bool GetAnyCurrentTargetsLocked() |
Selection/GeometrySelectionManager.h | ||
bool GetHitBackFaces() |
Selection/GeometrySelectionManager.h | ||
virtual EMeshTopologyMode GetMeshTopologyMode() |
Selection/GeometrySelectionManager.h | ||
virtual bool GetSelectionBounds
(
FGeometrySelectionBounds& BoundsOut |
Selection/GeometrySelectionManager.h | ||
virtual EGeometryElementType GetSelectionElementType() |
Selection/GeometrySelectionManager.h | ||
virtual bool GetSelectionForComponent
(
UPrimitiveComponent* Component, |
Get the active element selection for the given Component, if it exists | Selection/GeometrySelectionManager.h | |
virtual EGeometryTopologyType GetSelectionTopologyType() |
Selection/GeometrySelectionManager.h | ||
virtual void GetSelectionWorldFrame
(
UE::Geometry::FFrame3d& SelectionFrame |
Selection/GeometrySelectionManager.h | ||
virtual void GetTargetWorldFrame
(
UE::Geometry::FFrame3d& SelectionFrame |
Selection/GeometrySelectionManager.h | ||
UInteractiveToolsContext * GetToolsContext() |
Selection/GeometrySelectionManager.h | ||
IToolsContextTransactionsAPI * GetTransactionsAPI() |
Selection/GeometrySelectionManager.h | ||
bool HasActiveTargets() |
Target Management / Queries TODO: be able to update active target set w/o losing current selections? | Selection/GeometrySelectionManager.h | |
virtual bool HasBeenShutDown() |
Selection/GeometrySelectionManager.h | ||
virtual bool HasSavedSelection() |
Selection/GeometrySelectionManager.h | ||
virtual bool HasSelection() |
Selection queries | Selection/GeometrySelectionManager.h | |
virtual bool HasSelectionForComponent
(
UPrimitiveComponent* Component |
Selection/GeometrySelectionManager.h | ||
virtual void Initialize
(
UInteractiveToolsContext* ToolsContextIn, |
Setup/Teardown | Selection/GeometrySelectionManager.h | |
virtual bool IsInActiveTransformation() |
Selection/GeometrySelectionManager.h | ||
virtual bool IsInTrackedSelectionChange() |
Selection/GeometrySelectionManager.h | ||
void MarkRenderCachesDirty
(
bool bMarkSelectableDirty |
Invalidates all cached selection elements by default. | Selection/GeometrySelectionManager.h | |
virtual 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 | Selection/GeometrySelectionManager.h | |
virtual void RegisterSelectorFactory
(
TUniquePtr< IGeometrySelectorFactory > Factory |
Selection/GeometrySelectionManager.h | ||
void RemoveSets
(
const TArrayView< FString >& SetIdentifiers |
Removes Triangle, Line, and Point sets with the given SetIdentifier prefix Full Identifier strings are in the format: SetIdentifier_Triangles, SetIdentifier_Lines, and SetIdentifier_Points | Selection/GeometrySelectionManager.h | |
virtual bool RestoreSavedSelection () |
Attempt to restore (and then discard) the most recent saved selection. | Selection/GeometrySelectionManager.h | |
virtual void RevertChange
(
IGeometrySelectionChange* Change |
Selection/GeometrySelectionManager.h | ||
void SetCurrentTargetsLockState
(
bool bLocked |
Selection/GeometrySelectionManager.h | ||
void SetHitBackFaces
(
bool bInHitBackFaces |
Selection Filters. | Selection/GeometrySelectionManager.h | |
virtual void SetMeshSelectionTypeAndMode
(
EGeometryElementType NewElementType, |
Switch the selection mode and type, optionally converting any existing selection to the new type and mode. | Selection/GeometrySelectionManager.h | |
virtual void SetMeshTopologyMode
(
EMeshTopologyMode SelectionMode |
Selection/GeometrySelectionManager.h | ||
void SetSelectionColors
(
FLinearColor UnselectedCol, |
Set the colors to be used during mesh element selection for: Unselected elements, Hover over selection, Hover over non-selection, and Selected elements | Selection/GeometrySelectionManager.h | |
virtual void SetSelectionElementType
(
EGeometryElementType ElementType |
Selection/GeometrySelectionManager.h | ||
virtual bool SetSelectionForComponent
(
UPrimitiveComponent* Component, |
Directly set the current Selection for the specified Component to NewSelection. | Selection/GeometrySelectionManager.h | |
virtual void Shutdown() |
Selection/GeometrySelectionManager.h | ||
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. | Selection/GeometrySelectionManager.h | |
virtual void UnregisterSelectorFactories() |
Selection/GeometrySelectionManager.h | ||
virtual bool UpdateSelectionPreviewViaRaycast
(
const FRay3d& WorldRay |
Hover/Preview support | Selection/GeometrySelectionManager.h | |
virtual void UpdateSelectionViaConvex
(
const FConvexVolume& ConvexVolume, |
Use the given ConvexVolume to update the active element selection based on UpdateConfig. | Selection/GeometrySelectionManager.h | |
virtual void UpdateSelectionViaRaycast
(
const FRay3d& WorldRay, |
Use the given WorldRay to update the active element selection based on UpdateConfig. | Selection/GeometrySelectionManager.h | |
virtual void UpdateTransformation
(
TFunctionRef< FVector3d(int32 VertexID, const FVector3d&, const FTransform&)> PositionTransformFun... |
Update the active transformations with the given PositionTransformFunc. | Selection/GeometrySelectionManager.h | |
bool ValidateSelectionState() |
Attempt to validate the current selection state; can be called to detect if e.g. selected objects have been deleted from under the selection manager. | Selection/GeometrySelectionManager.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void ClearActivePreview() |
Selection/GeometrySelectionManager.h | ||
void CreateOrUpdateAllSets
(
const FGeometrySelectionElements& Elements, |
Calls the CreateOrUpdate function for Triangle, Line, and Point sets to build sets for PreviewGeometry | Selection/GeometrySelectionManager.h | |
TSharedPtr< FGeometrySelectionTarget > GetCachedTarget
(
FGeometryIdentifier Identifier, |
Selection/GeometrySelectionManager.h | ||
UE::Geometry::FGeometrySelectionHitQueryConfig GetCurrentSelectionQueryConfig() |
Selection/GeometrySelectionManager.h | ||
TArray< FGeometryIdentifier > GetCurrentTargetIdentifiers() |
Selection/GeometrySelectionManager.h | ||
void OnTargetGeometryModified
(
IGeometrySelector* Selector |
Selection/GeometrySelectionManager.h | ||
void ProcessActiveSelections
(
TFunctionRef< void(FGeometrySelectionHandle)> ProcessFunc |
Apply ProcessFunc to active selections via handles, perhaps should be public? | Selection/GeometrySelectionManager.h | |
void RebuildSelectionRenderCaches() |
Selection/GeometrySelectionManager.h | ||
void ResetTargetCache() |
Selection/GeometrySelectionManager.h | ||
virtual void SaveCurrentSelection () |
Save the active selection. | Selection/GeometrySelectionManager.h | |
void SetMeshTopologyModeInternal
(
EMeshTopologyMode NewTopologyMode |
Selection/GeometrySelectionManager.h | ||
void SetSelectionElementTypeInternal
(
EGeometryElementType NewElementType |
Selection/GeometrySelectionManager.h | ||
void SetTargetLockStateOnUndoRedo
(
FGeometryIdentifier TargetIdentifier, |
Selection/GeometrySelectionManager.h | ||
void SetTargetsOnUndoRedo
(
TArray< FGeometryIdentifier > NewTargets |
Selection/GeometrySelectionManager.h | ||
void SleepOrShutdownTarget
(
TSharedPtr< FGeometrySelectionTarget > Target, |
Selection/GeometrySelectionManager.h | ||
void UpdateSelectionRenderCacheOnTargetChange() |
Selection/GeometrySelectionManager.h |