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::BaseManipulator Class Referenceabstract

The base class for manipulators, providing interfaces for users of manipulators to talk to. More...

#include <BaseManipulator.h>

Inherits AZStd::enable_shared_from_this< BaseManipulator >.

Inherited by AzToolsFramework::AngularManipulator, AzToolsFramework::LineSegmentSelectionManipulator, AzToolsFramework::LinearManipulator, AzToolsFramework::MultiLinearManipulator, AzToolsFramework::PaintBrushManipulator, AzToolsFramework::PlanarManipulator, AzToolsFramework::SelectionManipulator, AzToolsFramework::SplineSelectionManipulator, and AzToolsFramework::SurfaceManipulator.

Public Types

using UniqueEntityIds = AZStd::unordered_set< AZ::EntityId >
 
using UniqueEntityComponentIds = AZStd::unordered_set< AZ::EntityComponentIdPair >
 

Public Member Functions

AZ_CLASS_ALLOCATOR_DECL BaseManipulator (const BaseManipulator &)=delete
 
BaseManipulatoroperator= (const BaseManipulator &)=delete
 
bool OnLeftMouseDown (const ViewportInteraction::MouseInteraction &interaction, float rayIntersectionDistance)
 
void OnLeftMouseUp (const ViewportInteraction::MouseInteraction &interaction)
 
bool OnRightMouseDown (const ViewportInteraction::MouseInteraction &interaction, float rayIntersectionDistance)
 
void OnRightMouseUp (const ViewportInteraction::MouseInteraction &interaction)
 
void OnMouseMove (const ViewportInteraction::MouseInteraction &interaction)
 
void OnMouseWheel (const ViewportInteraction::MouseInteraction &interaction)
 
bool OnMouseOver (ManipulatorId manipulatorId, const ViewportInteraction::MouseInteraction &interaction)
 
void Register (ManipulatorManagerId managerId)
 
void Unregister ()
 Unregister itself from the manipulator manager it was registered with.
 
void SetBoundsDirty ()
 Bounds will need to be recalculated next time we render.
 
bool Registered () const
 Is this manipulator currently registered with a manipulator manager.
 
bool PerformingAction () const
 Is the manipulator in the middle of an action (between mouse down and mouse up).
 
bool MouseOver () const
 Is the mouse currently over the manipulator (intersecting manipulator bound).
 
ManipulatorId GetManipulatorId () const
 The unique id of this manipulator.
 
ManipulatorManagerId GetManipulatorManagerId () const
 The unique id of the manager this manipulator was registered with.
 
const UniqueEntityComponentIds & EntityComponentIdPairs () const
 Returns all EntityComponentIdPairs associated with this manipulator.
 
void AddEntityComponentIdPair (const AZ::EntityComponentIdPair &entityComponentIdPair)
 Add an entity and component the manipulator is responsible for.
 
UniqueEntityComponentIds::iterator RemoveEntityId (AZ::EntityId entityId)
 
UniqueEntityComponentIds::iterator RemoveEntityComponentIdPair (const AZ::EntityComponentIdPair &entityComponentIdPair)
 Remove a specific component (via a EntityComponentIdPair) being affected by this manipulator.
 
bool HasEntityId (AZ::EntityId entityId) const
 Is this entity currently being tracked by this manipulator.
 
bool HasEntityComponentIdPair (const AZ::EntityComponentIdPair &entityComponentIdPair) const
 Is this entity component pair currently being tracked by this manipulator.
 
void ForwardMouseOverEvent (const ViewportInteraction::MouseInteraction &interaction)
 

Static Public Attributes

static const AZ::Color s_defaultMouseOverColor
 

Protected Member Functions

 BaseManipulator ()=default
 Protected constructor.
 
void Invalidate ()
 Called when unregistering - users of manipulators should not call it directly.
 
virtual void InvalidateImpl ()
 The implementation to override in a derived class for Invalidate.
 
virtual void OnLeftMouseDownImpl (const ViewportInteraction::MouseInteraction &, float)
 
void AttachLeftMouseDownImpl ()
 
virtual void OnRightMouseDownImpl (const ViewportInteraction::MouseInteraction &, float)
 
void AttachRightMouseDownImpl ()
 
virtual void OnLeftMouseUpImpl (const ViewportInteraction::MouseInteraction &)
 The implementation to override in a derived class for OnLeftMouseUp.
 
virtual void OnRightMouseUpImpl (const ViewportInteraction::MouseInteraction &)
 The implementation to override in a derived class for OnRightMouseUp.
 
virtual void OnMouseMoveImpl (const ViewportInteraction::MouseInteraction &)
 The implementation to override in a derived class for OnMouseMove.
 
virtual void OnMouseOverImpl (ManipulatorId, const ViewportInteraction::MouseInteraction &)
 The implementation to override in a derived class for OnMouseOver.
 
virtual void OnMouseWheelImpl (const ViewportInteraction::MouseInteraction &)
 The implementation to override in a derived class for OnMouseWheel.
 
virtual void SetBoundsDirtyImpl ()
 The implementation to override in a derived class for SetBoundsDirty.
 
virtual void Draw (const ManipulatorManagerState &managerState, AzFramework::DebugDisplayRequests &debugDisplay, const AzFramework::CameraState &cameraState, const ViewportInteraction::MouseInteraction &mouseInteraction)=0
 Rendering for the manipulator - it is recommended drawing be delegated to a ManipulatorView.
 

Friends

class ManipulatorManager
 

Detailed Description

The base class for manipulators, providing interfaces for users of manipulators to talk to.

Member Function Documentation

◆ Draw()

virtual void AzToolsFramework::BaseManipulator::Draw ( const ManipulatorManagerState managerState,
AzFramework::DebugDisplayRequests &  debugDisplay,
const AzFramework::CameraState &  cameraState,
const ViewportInteraction::MouseInteraction mouseInteraction 
)
protectedpure virtual

◆ ForwardMouseOverEvent()

void AzToolsFramework::BaseManipulator::ForwardMouseOverEvent ( const ViewportInteraction::MouseInteraction interaction)

Forward a mouse over event in a case where we need the manipulator to immediately refresh.

Note
Only call this when a mouse over event has just happened.

◆ OnLeftMouseDown()

bool AzToolsFramework::BaseManipulator::OnLeftMouseDown ( const ViewportInteraction::MouseInteraction interaction,
float  rayIntersectionDistance 
)

Callback for the event when the mouse pointer is over this manipulator and the left mouse button is pressed.

Parameters
interactionIt contains various mouse states when the event happens, as well as a ray shooting from the viewing camera through the mouse pointer.
rayIntersectionDistanceThe parameter value in the ray's explicit equation that represents the intersecting point on the target manipulator in world space.
Returns
Return true if OnLeftMouseDownImpl was attached and will be used.

◆ OnLeftMouseDownImpl()

virtual void AzToolsFramework::BaseManipulator::OnLeftMouseDownImpl ( const ViewportInteraction::MouseInteraction ,
float   
)
inlineprotectedvirtual

The implementation to override in a derived class for OnLeftMouseDown. Note: When implementing this function you must also call AttachLeftMouseDownImpl to ensure m_onLeftMouseDownImpl is set to OnLeftMouseDownImpl, otherwise it will not be called

◆ OnLeftMouseUp()

void AzToolsFramework::BaseManipulator::OnLeftMouseUp ( const ViewportInteraction::MouseInteraction interaction)

Callback for the event when this manipulator is active and the left mouse button is released.

Parameters
interactionIt contains various mouse states when the event happens, as well as a ray shooting from the viewing camera through the mouse pointer.

◆ OnMouseMove()

void AzToolsFramework::BaseManipulator::OnMouseMove ( const ViewportInteraction::MouseInteraction interaction)

Callback for the event when this manipulator is active and the mouse is moved.

Parameters
interactionIt contains various mouse states when the event happens, as well as a ray shooting from the viewing camera through the mouse pointer.

◆ OnMouseOver()

bool AzToolsFramework::BaseManipulator::OnMouseOver ( ManipulatorId  manipulatorId,
const ViewportInteraction::MouseInteraction interaction 
)

This function changes the state indicating whether the manipulator is under the mouse pointer. It is called in the event of OnMouseMove and OnMouseWheel only when there is no manipulator currently performing actions.

◆ OnMouseWheel()

void AzToolsFramework::BaseManipulator::OnMouseWheel ( const ViewportInteraction::MouseInteraction interaction)

Callback for the event when this manipulator is active and the mouse wheel is scrolled.

Parameters
interactionIt contains various mouse states when the event happens, as well as a ray shooting from the viewing camera through the mouse pointer.

◆ OnRightMouseDown()

bool AzToolsFramework::BaseManipulator::OnRightMouseDown ( const ViewportInteraction::MouseInteraction interaction,
float  rayIntersectionDistance 
)

Callback for the event when the mouse pointer is over this manipulator and the right mouse button is pressed .

Parameters
interactionIt contains various mouse states when the event happens, as well as a ray shooting from the viewing camera through the mouse pointer.
rayIntersectionDistanceThe parameter value in the ray's explicit equation that represents the intersecting point on the target manipulator in world space.
Returns
Return true if OnRightMouseDownImpl was attached and will be used.

◆ OnRightMouseDownImpl()

virtual void AzToolsFramework::BaseManipulator::OnRightMouseDownImpl ( const ViewportInteraction::MouseInteraction ,
float   
)
inlineprotectedvirtual

The implementation to override in a derived class for OnRightMouseDown. Note: When implementing this function you must also call AttachRightMouseDownImpl to ensure m_onRightMouseDownImpl is set to OnRightMouseDownImpl, otherwise it will not be called

◆ OnRightMouseUp()

void AzToolsFramework::BaseManipulator::OnRightMouseUp ( const ViewportInteraction::MouseInteraction interaction)

Callback for the event when this manipulator is active and the right mouse button is released.

Parameters
interactionIt contains various mouse states when the event happens, as well as a ray shooting from the viewing camera through the mouse pointer.

◆ Register()

void AzToolsFramework::BaseManipulator::Register ( ManipulatorManagerId  managerId)

Register itself to a manipulator manager so that it can receive various mouse events and perform manipulations.

Parameters
managerIdThe id identifying a unique manipulator manager.

◆ RemoveEntityId()

UniqueEntityComponentIds::iterator AzToolsFramework::BaseManipulator::RemoveEntityId ( AZ::EntityId  entityId)

Remove an entity from being affected by this manipulator.

Note
All components on this entity registered with the manipulator will be removed.

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