Open 3D Engine LyShine Gem API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
UiTransformInterface Class Referenceabstract

Inherits AZ::ComponentBus.

Classes

struct  Rect
 Struct that stores the bounds of an axis-aligned rectangle. More...
 
struct  RectPoints
 Struct that stores the 4 points of a (transformed) rectangle and provides access either as an array or via access functions. More...
 

Public Types

enum class  Recompute { RectOnly , TransformOnly , ViewportTransformOnly , RectAndTransform }
 Enum used as a parameter to SetRecomputeFlags. More...
 
enum class  ScaleToDeviceMode {
  None , UniformScaleToFit , UniformScaleToFill , UniformScaleToFitX ,
  UniformScaleToFitY , NonUniformScale , ScaleXOnly , ScaleYOnly
}
 
using RectPointsArray = AZStd::vector< UiTransformInterface::RectPoints >
 

Public Member Functions

virtual float GetZRotation ()=0
 Get the rotation about the Z axis.
 
virtual void SetZRotation (float rotation)=0
 Set the rotation about the Z axis.
 
virtual AZ::Vector2 GetScale ()=0
 Get the scale.
 
virtual void SetScale (AZ::Vector2 scale)=0
 Set the scale.
 
virtual float GetScaleX ()=0
 Get the scale X.
 
virtual void SetScaleX (float scale)=0
 Set the scale X.
 
virtual float GetScaleY ()=0
 Get the scale Y.
 
virtual void SetScaleY (float scale)=0
 Set the scale Y.
 
virtual AZ::Vector2 GetPivot ()=0
 Get the pivot point for the element.
 
virtual void SetPivot (AZ::Vector2 pivot)=0
 Set the pivot point for the element.
 
virtual float GetPivotX ()=0
 Get the pivot point for the element.
 
virtual void SetPivotX (float pivot)=0
 Set the pivot point for the element.
 
virtual float GetPivotY ()=0
 Get the pivot point for the element.
 
virtual void SetPivotY (float pivot)=0
 Set the pivot point for the element.
 
virtual ScaleToDeviceMode GetScaleToDeviceMode ()=0
 
virtual void SetScaleToDeviceMode (ScaleToDeviceMode scaleToDeviceMode)=0
 
virtual bool GetIsFlooringOffsets ()=0
 Get whether the element's offsets should be floored when changed.
 
virtual void SetIsFlooringOffsets (bool isFlooringOffsets)=0
 Set whether the element's offsets should be floored when changed.
 
virtual void GetViewportSpacePoints (RectPoints &points)=0
 Get the four points defining the rectangle of this element, in viewport space pixel coords.
 
virtual AZ::Vector2 GetViewportSpacePivot ()=0
 Get the pivot for this element in viewport space.
 
virtual void GetTransformToViewport (AZ::Matrix4x4 &mat)=0
 Get the transform matrix to transform from canvas (noScaleRotate) space to viewport space.
 
virtual void GetTransformFromViewport (AZ::Matrix4x4 &mat)=0
 Get the transform matrix to transform from viewport space to canvas (noScaleRotate) space.
 
virtual void RotateAndScalePoints (RectPoints &points)=0
 Apply the "to viewport" transform to the given points.
 
virtual void GetCanvasSpacePoints (RectPoints &points)=0
 Get the four points defining the rectangle of this element, in canvas space coords.
 
virtual AZ::Vector2 GetCanvasSpacePivot ()=0
 Get the pivot for this element in canvas space.
 
virtual void GetTransformToCanvasSpace (AZ::Matrix4x4 &mat)=0
 Get the transform matrix to transform from canvasNoScaleRotate space to canvas space.
 
virtual void GetTransformFromCanvasSpace (AZ::Matrix4x4 &mat)=0
 Get the transform matrix to transform from canvas space to canvasNoScaleRotate space.
 
virtual void GetCanvasSpaceRectNoScaleRotate (Rect &rect)=0
 Get the axis-aligned rect for the element without accounting for rotation or scale.
 
virtual void GetCanvasSpacePointsNoScaleRotate (RectPoints &points)=0
 Get the rect points for the element without accounting for rotation or scale.
 
virtual AZ::Vector2 GetCanvasSpaceSizeNoScaleRotate ()=0
 Get the size for the element without accounting for rotation or scale.
 
virtual AZ::Vector2 GetCanvasSpacePivotNoScaleRotate ()=0
 Get the pivot for the element without accounting for rotation or scale.
 
virtual void GetLocalTransform (AZ::Matrix4x4 &mat)=0
 Get the transform matrix to apply this element's rotation and scale about pivot.
 
virtual void GetLocalInverseTransform (AZ::Matrix4x4 &mat)=0
 Get the transform matrix to apply the inverse of this element's rotation and scale about pivot.
 
virtual bool HasScaleOrRotation ()=0
 Test whether this transform component has any scale or rotation.
 
virtual AZ::Vector2 GetViewportPosition ()=0
 Get the position for this element in viewport space (same as GetViewportSpacePivot)
 
virtual void SetViewportPosition (const AZ::Vector2 &position)=0
 Set the position for this element in viewport space.
 
virtual AZ::Vector2 GetCanvasPosition ()=0
 Get the position for this element in canvas space (same as GetCanvasSpacePivot)
 
virtual void SetCanvasPosition (const AZ::Vector2 &position)=0
 Set the position for this element in canvas space.
 
virtual AZ::Vector2 GetLocalPosition ()=0
 Get the position for this element relative to the center of the element's anchors.
 
virtual void SetLocalPosition (const AZ::Vector2 &position)=0
 Set the position for this element relative to the center of the element's anchors.
 
virtual float GetLocalPositionX ()=0
 Get the X position for this element relative to the center of the element's anchors.
 
virtual void SetLocalPositionX (float position)=0
 Set the X position for this element relative to the center of the element's anchors.
 
virtual float GetLocalPositionY ()=0
 Get the Y position for this element relative to the center of the element's anchors.
 
virtual void SetLocalPositionY (float position)=0
 Set the Y position for this element relative to the center of the element's anchors.
 
virtual void MoveViewportPositionBy (const AZ::Vector2 &offset)=0
 Move this element in viewport space.
 
virtual void MoveCanvasPositionBy (const AZ::Vector2 &offset)=0
 Move this element in canvas space.
 
virtual void MoveLocalPositionBy (const AZ::Vector2 &offset)=0
 Move this element relative to the center of the element's anchors.
 
virtual bool IsPointInRect (AZ::Vector2 point)=0
 Test if the given point (in viewport space) is in the rectangle of this element.
 
virtual bool BoundsAreOverlappingRect (const AZ::Vector2 &bound0, const AZ::Vector2 &bound1)=0
 Test if the given rect (in viewport space) is in the rectangle of this element.
 
virtual void SetRecomputeFlags (Recompute recompute)=0
 Set the required dirty flags for the cached transforms and rect on this element and all its children.
 
virtual bool HasCanvasSpaceRectChanged ()=0
 
virtual bool HasCanvasSpaceSizeChanged ()=0
 
virtual bool HasCanvasSpaceRectChangedByInitialization ()=0
 Get whether the canvas space rect was changed due to initialization.
 
virtual void NotifyAndResetCanvasSpaceRectChange ()=0
 Send notification of canvas space rect change and reset to unchanged.
 

Static Public Attributes

static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single
 Only one component on a entity can implement the events.
 

Member Enumeration Documentation

◆ Recompute

Enum used as a parameter to SetRecomputeFlags.

Enumerator
RectOnly 

Only the rect (offsets or anchors for example) changed (this may affect transform if local scale or rotation)

TransformOnly 

Only the transform changed (canvas and viewport transforms must be recomputed)

ViewportTransformOnly 

Only the viewport transform changed (viewport transform must be recomputed)

RectAndTransform 

Both rect and transform changed (all cached data must be recomputed)

◆ ScaleToDeviceMode

Enum used as a parameter to SetScaleToDeviceMode The value determines how an element is scaled when the canvas reference size and actual size are different The comments below reference the canvas's "deviceScale". The deviceScale is target (actual) canvas size divided the reference canvas size

Enumerator
None 

Default, this element is not affected by device resolution changes.

UniformScaleToFit 

Apply a uniform scale which is the minimum of deviceScale.x and deviceScale.y.

UniformScaleToFill 

Apply a uniform scale which is the maximum of deviceScale.x and deviceScale.y.

UniformScaleToFitX 

Apply a uniform scale of deviceScale.x.

UniformScaleToFitY 

Apply a uniform scale of deviceScale.y.

NonUniformScale 

Apply a non-uniform scale which is simply deviceScale.

ScaleXOnly 

Scale the element only in the X dimension by deviceScale.x.

ScaleYOnly 

Scale the element only in the Y dimension by deviceScale.y.

Member Function Documentation

◆ GetScaleToDeviceMode()

virtual ScaleToDeviceMode UiTransformInterface::GetScaleToDeviceMode ( )
pure virtual

Get how the element and all its children will be scaled to allow for the difference between the authored canvas size and the actual viewport size.

◆ HasCanvasSpaceRectChanged()

virtual bool UiTransformInterface::HasCanvasSpaceRectChanged ( )
pure virtual

Get whether the canvas space rect has changed since the last call to NotifyAndResetCanvasSpaceRectChange. May trigger a recompute of the rect if the recompute flag is dirty

◆ HasCanvasSpaceSizeChanged()

virtual bool UiTransformInterface::HasCanvasSpaceSizeChanged ( )
pure virtual

Get whether the canvas space size has changed since the last call to NotifyAndResetCanvasSpaceRectChange. May trigger a recompute of the rect if the recompute flag is dirty

◆ SetScaleToDeviceMode()

virtual void UiTransformInterface::SetScaleToDeviceMode ( ScaleToDeviceMode  scaleToDeviceMode)
pure virtual

Set how the element and all its children will be scaled to allow for the difference between the authored canvas size and the actual viewport size.


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