Open 3D Engine AzToolsFramework API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzToolsFramework::EditorVertexSelectionBase< Vertex > Class Template Referenceabstract

#include <EditorVertexSelection.h>

Inherits AzFramework::EntityDebugDisplayEventBus::Handler, and AzFramework::ViewportDebugDisplayEventBus::Handler.

Inherited by AzToolsFramework::EditorVertexSelectionFixed< Vertex >, and AzToolsFramework::EditorVertexSelectionVariable< Vertex >.

Public Member Functions

 EditorVertexSelectionBase (EditorVertexSelectionBase &&)=default
 
EditorVertexSelectionBaseoperator= (EditorVertexSelectionBase &&)=default
 
void Create (const AZ::EntityComponentIdPair &entityComponentIdPair, ManipulatorManagerId managerId, AZStd::unique_ptr< HoverSelection > hoverSelection, TranslationManipulators::Dimensions dimensions, TranslationManipulatorConfiguratorFn translationManipulatorConfigurator)
 Setup and configure the EditorVertexSelection for operation.
 
void CreateTranslationManipulator (const AZ::EntityComponentIdPair &entityComponentIdPair, ManipulatorManagerId managerId, const Vertex &vertex, size_t index)
 Create a translation manipulator for a given vertex.
 
void Destroy ()
 Destroy all manipulators associated with the vertex selection.
 
void SetVertexPositionsUpdatedCallback (const AZStd::function< void()> &callback)
 Set custom callback for when vertex positions are updated.
 
void RefreshLocal ()
 Update manipulators based on local changes to vertex positions.
 
void RefreshTranslationManipulator ()
 
void RefreshSpace (const AZ::Transform &worldFromLocal, const AZ::Vector3 &nonUniformScale=AZ::Vector3::CreateOne())
 Update manipulators based on changes to the entity's transform and non-uniform scale.
 
void SetBoundsDirty ()
 Set bounds dirty (need recalculating) for all owned manipulators (selection, translation, hover).
 
virtual bool HandleMouse (const ViewportInteraction::MouseInteractionEvent &mouseInteraction)
 How should the EditorVertexSelection respond to mouse input.
 
void SnapVerticesToSurface (const ViewportInteraction::MouseInteractionEvent &mouseInteraction)
 
AZStd::vector< ActionOverrideActionOverrides () const
 
void BeginBatchMovement ()
 
void EndBatchMovement ()
 
void SetSelectedPosition (const AZ::Vector3 &localPosition)
 Set the position of the TranslationManipulators (if active).
 
AZ::EntityId GetEntityId () const
 

Protected Types

enum class  State { Selecting , Translating }
 The state we are in when editing vertices.
 

Protected Member Functions

virtual void SetupSelectionManipulator (const AZStd::shared_ptr< SelectionManipulator > &selectionManipulator, const AZ::EntityComponentIdPair &entityComponentIdPair, ManipulatorManagerId managerId, size_t index)=0
 Internal interface for EditorVertexSelection.
 
virtual void PrepareActions ()=0
 
void SelectionManipulatorSelectCallback (size_t index, const ViewportInteraction::MouseInteraction &interaction, const AZ::EntityComponentIdPair &entityComponentIdPair, ManipulatorManagerId managerId)
 Default behavior when clicking on a selection manipulator (representing a vertex).
 
void ClearSelected ()
 Destroy the translation manipulator and deselect all vertices.
 
AZ::ComponentId GetComponentId () const
 
const AZ::EntityComponentIdPair & GetEntityComponentIdPair () const
 
ManipulatorManagerId GetManipulatorManagerId () const
 
TranslationManipulators::Dimensions Dimensions () const
 Is the translation vertex manipulator in 2D or 3D.
 
TranslationManipulatorConfiguratorFn ConfiguratorFn () const
 How to configure the translation manipulator (view and axes).
 
void SetState (State state)
 

Protected Attributes

AZStd::unique_ptr< HoverSelectionm_hoverSelection
 Interface to hover selection, representing bounds that can be selected.
 
AZStd::shared_ptr< IndexedTranslationManipulator< Vertex > > m_translationManipulator
 Manipulator when vertex is selected to translate it.
 
AZStd::vector< AZStd::shared_ptr< SelectionManipulator > > m_selectionManipulators
 Manipulators for each vertex when entity is selected.
 
AZStd::array< AZStd::vector< ActionOverride >, 2 > m_actionOverrides
 Available actions corresponding to each mode.
 

Detailed Description

template<typename Vertex>
class AzToolsFramework::EditorVertexSelectionBase< Vertex >

EditorVertexSelection provides an interface for a collection of manipulators to expose editing of vertices in a container/collection. EditorVertexSelection is templated on the type of Vertex (Vector2/Vector3) stored in the container. EditorVertexSelectionBase provides common behavior shared across Fixed and Variable selections.

Member Function Documentation

◆ ActionOverrides()

template<typename Vertex >
AZStd::vector< ActionOverride > AzToolsFramework::EditorVertexSelectionBase< Vertex >::ActionOverrides ( ) const

The Actions provided by the EditorVertexSelection while it is active. e.g. Vertex deletion, duplication etc.

◆ BeginBatchMovement()

template<typename Vertex >
void AzToolsFramework::EditorVertexSelectionBase< Vertex >::BeginBatchMovement ( )

Let the EditorVertexSelection know a batch movement is about to begin so it can avoid certain unnecessary updates.

◆ EndBatchMovement()

template<typename Vertex >
void AzToolsFramework::EditorVertexSelectionBase< Vertex >::EndBatchMovement ( )

Let the EditorVertexSelection know a batch movement has ended so it can return to its normal state.

◆ RefreshTranslationManipulator()

template<typename Vertex >
void AzToolsFramework::EditorVertexSelectionBase< Vertex >::RefreshTranslationManipulator ( )

Update the translation manipulator to be correctly positioned based on the current selection (recenter it).

◆ SetupSelectionManipulator()

template<typename Vertex >
virtual void AzToolsFramework::EditorVertexSelectionBase< Vertex >::SetupSelectionManipulator ( const AZStd::shared_ptr< SelectionManipulator > &  selectionManipulator,
const AZ::EntityComponentIdPair &  entityComponentIdPair,
ManipulatorManagerId  managerId,
size_t  index 
)
protectedpure virtual

Internal interface for EditorVertexSelection.

Implemented in AzToolsFramework::EditorVertexSelectionVariable< Vertex >.

◆ SnapVerticesToSurface()

template<typename Vertex >
void AzToolsFramework::EditorVertexSelectionBase< Vertex >::SnapVerticesToSurface ( const ViewportInteraction::MouseInteractionEvent mouseInteraction)

Snap the selected vertices to the terrain. Note: With a multi-selection the manipulator will be translated to the picked terrain position with all vertices moved relative to it.

Member Data Documentation

◆ m_hoverSelection

template<typename Vertex >
AZStd::unique_ptr<HoverSelection> AzToolsFramework::EditorVertexSelectionBase< Vertex >::m_hoverSelection
protected
Initial value:
=
nullptr

Interface to hover selection, representing bounds that can be selected.

◆ m_translationManipulator

template<typename Vertex >
AZStd::shared_ptr<IndexedTranslationManipulator<Vertex> > AzToolsFramework::EditorVertexSelectionBase< Vertex >::m_translationManipulator
protected
Initial value:
=
nullptr

Manipulator when vertex is selected to translate it.


The documentation for this class was generated from the following file: