Open 3D Engine LyShine Gem 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.
UiCanvasComponent Class Reference

Inherits AZ::Component, UiCanvasBus::Handler, AZ::EntityBus::Handler, UiAnimationBus::Handler, UiInteractableActiveNotificationBus::Handler, IUiAnimationListener, UiEditorCanvasBus::Handler, UiCanvasComponentImplementationBus::Handler, and LyShine::RenderToTextureRequestBus::Handler.

Classes

struct  DebugInfoNumElements
 

Public Member Functions

 AZ_COMPONENT (UiCanvasComponent, LyShine::UiCanvasComponentUuid, AZ::Component)
 
 UiCanvasComponent ()
 Constructor, constructed by the LyShine class.
 
const AZStd::string & GetPathname () override
 
LyShine::CanvasId GetCanvasId () override
 
AZ::u64 GetUniqueCanvasId () override
 
int GetDrawOrder () override
 
void SetDrawOrder (int drawOrder) override
 
bool GetKeepLoadedOnLevelUnload () override
 
void SetKeepLoadedOnLevelUnload (bool keepLoaded) override
 
void RecomputeChangedLayouts () override
 
int GetNumChildElements () override
 
AZ::Entity * GetChildElement (int index) override
 
AZ::EntityId GetChildElementEntityId (int index) override
 
LyShine::EntityArray GetChildElements () override
 
AZStd::vector< AZ::EntityId > GetChildElementEntityIds () override
 
AZ::Entity * CreateChildElement (const LyShine::NameType &name) override
 
AZ::Entity * FindElementById (LyShine::ElementId id) override
 
AZ::Entity * FindElementByName (const LyShine::NameType &name) override
 
void FindElementsByName (const LyShine::NameType &name, LyShine::EntityArray &result) override
 
AZ::EntityId FindElementEntityIdByName (const LyShine::NameType &name) override
 
AZ::Entity * FindElementByHierarchicalName (const LyShine::NameType &name) override
 
void FindElements (AZStd::function< bool(const AZ::Entity *)> predicate, LyShine::EntityArray &result) override
 
AZ::Entity * PickElement (AZ::Vector2 point) override
 
LyShine::EntityArray PickElements (const AZ::Vector2 &bound0, const AZ::Vector2 &bound1) override
 
AZ::EntityId FindInteractableToHandleEvent (AZ::Vector2 point) override
 
bool SaveToXml (const AZStd::string &assetIdPathname, const AZStd::string &sourceAssetPathname) override
 
void FixupCreatedEntities (LyShine::EntityArray topLevelEntities, bool makeUniqueNamesAndIds, AZ::Entity *optionalInsertionPoint) override
 
void AddElement (AZ::Entity *element, AZ::Entity *parent, AZ::Entity *insertBefore) override
 
void ReinitializeElements () override
 
AZStd::string SaveToXmlString () override
 
AZStd::string GetUniqueChildName (AZ::EntityId parentEntityId, AZStd::string baseName, const LyShine::EntityArray *includeChildren) override
 
AZ::Entity * CloneElement (AZ::Entity *sourceEntity, AZ::Entity *parentEntity) override
 
AZ::EntityId CloneElementEntityId (AZ::EntityId sourceEntity, AZ::EntityId parentEntity, AZ::EntityId insertBefore) override
 
AZ::Entity * CloneCanvas (const AZ::Vector2 &canvasSize) override
 
void SetCanvasToViewportMatrix (const AZ::Matrix4x4 &matrix) override
 
const AZ::Matrix4x4 & GetCanvasToViewportMatrix () override
 
void GetViewportToCanvasMatrix (AZ::Matrix4x4 &matrix) override
 
AZ::Vector2 GetCanvasSize () override
 
void SetCanvasSize (const AZ::Vector2 &canvasSize) override
 
void SetTargetCanvasSize (bool isInGame, const AZ::Vector2 &targetCanvasSize) override
 
AZ::Vector2 GetDeviceScale () override
 
bool GetIsPixelAligned () override
 
void SetIsPixelAligned (bool isPixelAligned) override
 
bool GetIsTextPixelAligned () override
 
void SetIsTextPixelAligned (bool isTextPixelAligned) override
 
IUiAnimationSystemGetAnimationSystem () override
 
bool GetEnabled () override
 
void SetEnabled (bool enabled) override
 
bool GetIsRenderToTexture () override
 
void SetIsRenderToTexture (bool isRenderToTexture) override
 
const AZ::Data::Asset< AZ::RPI::AttachmentImageAsset > & GetAttachmentImageAsset () override
 
void SetAttachmentImageAsset (const AZ::Data::Asset< AZ::RPI::AttachmentImageAsset > &attachmentImageAsset) override
 
bool GetIsPositionalInputSupported () override
 
void SetIsPositionalInputSupported (bool isSupported) override
 
bool GetIsConsumingAllInputEvents () override
 
void SetIsConsumingAllInputEvents (bool isConsuming) override
 
bool GetIsMultiTouchSupported () override
 
void SetIsMultiTouchSupported (bool isSupported) override
 
bool GetIsNavigationSupported () override
 
void SetIsNavigationSupported (bool isSupported) override
 
float GetNavigationThreshold () override
 
void SetNavigationThreshold (float navigationThreshold) override
 
AZ::u64 GetNavigationRepeatDelay () override
 
void SetNavigationRepeatDelay (AZ::u64 navigationRepeatDelay) override
 
AZ::u64 GetNavigationRepeatPeriod () override
 
void SetNavigationRepeatPeriod (AZ::u64 navigationRepeatPeriod) override
 
AzFramework::LocalUserId GetLocalUserIdInputFilter () override
 
void SetLocalUserIdInputFilter (AzFramework::LocalUserId localUserId) override
 
bool HandleInputEvent (const AzFramework::InputChannel::Snapshot &inputSnapshot, const AZ::Vector2 *viewportPos=nullptr, AzFramework::ModifierKeyMask activeModifierKeys=AzFramework::ModifierKeyMask::None) override
 
bool HandleTextEvent (const AZStd::string &textUTF8) override
 
bool HandleInputPositionalEvent (const AzFramework::InputChannel::Snapshot &inputSnapshot, AZ::Vector2 viewportPos) override
 
AZ::Vector2 GetMousePosition () override
 
AZ::EntityId GetTooltipDisplayElement () override
 
void SetTooltipDisplayElement (AZ::EntityId entityId) override
 
void ForceFocusInteractable (AZ::EntityId interactableId) override
 
void ForceActiveInteractable (AZ::EntityId interactableId, bool shouldStayActive, AZ::Vector2 point) override
 
AZ::EntityId GetHoverInteractable () override
 
void ForceHoverInteractable (AZ::EntityId interactableId) override
 
void ClearAllInteractables () override
 
void ForceEnterInputEventOnInteractable (AZ::EntityId interactableId) override
 
void OnEntityDeactivated (const AZ::EntityId &entityId) override
 
void StartSequence (const AZStd::string &sequenceName) override
 
void PlaySequenceRange (const AZStd::string &sequenceName, float startTime, float endTime) override
 
void StopSequence (const AZStd::string &sequenceName) override
 
void AbortSequence (const AZStd::string &sequenceName) override
 
void PauseSequence (const AZStd::string &sequenceName) override
 
void ResumeSequence (const AZStd::string &sequenceName) override
 
void ResetSequence (const AZStd::string &sequenceName) override
 
float GetSequencePlayingSpeed (const AZStd::string &sequenceName) override
 
void SetSequencePlayingSpeed (const AZStd::string &sequenceName, float speed) override
 
float GetSequencePlayingTime (const AZStd::string &sequenceName) override
 
bool IsSequencePlaying (const AZStd::string &sequenceName) override
 
float GetSequenceLength (const AZStd::string &sequenceName) override
 
void SetSequenceStopBehavior (IUiAnimationSystem::ESequenceStopBehavior stopBehavior) override
 
void ActiveCancelled () override
 
void ActiveChanged (AZ::EntityId m_newActiveInteractable, bool shouldStayActive) override
 
void OnUiAnimationEvent (EUiAnimationEvent uiAnimationEvent, IUiAnimSequence *pAnimSequence) override
 callback on UI animation events
 
void OnUiTrackEvent (AZStd::string eventName, AZStd::string valueName, IUiAnimSequence *pAnimSequence) override
 
bool GetIsSnapEnabled () override
 
void SetIsSnapEnabled (bool enabled) override
 
float GetSnapDistance () override
 
void SetSnapDistance (float distance) override
 
float GetSnapRotationDegrees () override
 
void SetSnapRotationDegrees (float degrees) override
 
AZStd::vector< float > GetHorizontalGuidePositions () override
 
void AddHorizontalGuide (float position) override
 
void RemoveHorizontalGuide (int index) override
 
void SetHorizontalGuidePosition (int index, float position) override
 
AZStd::vector< float > GetVerticalGuidePositions () override
 
void AddVerticalGuide (float position) override
 
void RemoveVerticalGuide (int index) override
 
void SetVerticalGuidePosition (int index, float position) override
 
void RemoveAllGuides () override
 
AZ::Color GetGuideColor () override
 
void SetGuideColor (const AZ::Color &color) override
 
bool GetGuidesAreLocked () override
 
void SetGuidesAreLocked (bool areLocked) override
 
bool CheckForOrphanedElements () override
 
void RecoverOrphanedElements () override
 
void RemoveOrphanedElements () override
 
void UpdateCanvasInEditorViewport (float deltaTime, bool isInGame) override
 
void RenderCanvasInEditorViewport (bool isInGame, AZ::Vector2 viewportSize) override
 
void MarkRenderGraphDirty () override
 
AZ::RHI::AttachmentId UseRenderTarget (const AZ::Name &renderTargetName, AZ::RHI::Size size) override
 
AZ::RHI::AttachmentId UseRenderTargetAsset (const AZ::Data::Asset< AZ::RPI::AttachmentImageAsset > &attachmentImageAsset) override
 
void ReleaseRenderTarget (const AZ::RHI::AttachmentId &attachmentId) override
 
AZ::Data::Instance< AZ::RPI::AttachmentImage > GetRenderTarget (const AZ::RHI::AttachmentId &attachmentId) override
 
void UpdateCanvas (float deltaTime, bool isInGame)
 
void RenderCanvas (bool isInGame, AZ::Vector2 viewportSize, UiRenderer *uiRenderer=nullptr)
 
AZ::Entity * GetRootElement () const
 
LyShine::ElementId GenerateId ()
 
UiCanvasComponentCloneAndInitializeCanvas (UiEntityContext *entityContext, const AZStd::string &assetIdPathname, const AZ::Vector2 *canvasSize=nullptr)
 
void DeactivateElements ()
 Deactivate all elements. Used when queuing a canvas up for deletion.
 
AZ::Vector2 GetTargetCanvasSize ()
 
AZ::SliceComponent::EntityIdToEntityIdMap GetEditorToGameEntityIdMap ()
 Get the mapping from editor EntityId to game EntityId. This will be empty for canvases loaded for editing.
 
void ScheduleElementForTransformRecompute (UiElementComponent *elementComponent)
 
void UnscheduleElementForTransformRecompute (UiElementComponent *elementComponent)
 
void ScheduleElementDestroy (AZ::EntityId entityId)
 Queue an element to be destroyed at end of frame.
 
bool IsRenderGraphDirty ()
 
void GetRenderTargets (LyShine::AttachmentImagesAndDependencies &attachmentImagesAndDependencies)
 
void GetDebugInfoInteractables (AZ::EntityId &activeInteractable, AZ::EntityId &hoverInteractable) const
 
void GetDebugInfoNumElements (DebugInfoNumElements &info) const
 
void GetDebugInfoRenderGraph (LyShineDebug::DebugInfoRenderGraph &info) const
 
void DebugInfoCountChildren (const AZ::EntityId entity, bool parentEnabled, DebugInfoNumElements &info) const
 
void DebugReportDrawCalls (AZ::IO::HandleType fileHandle, LyShineDebug::DebugInfoDrawCallReport &reportInfo, void *context) const
 
void DebugDisplayElemBounds (IDraw2d *draw2d) const
 
void DebugDisplayChildElemBounds (IDraw2d *draw2d, const AZ::EntityId entity) const
 
virtual void OnUiAnimationEvent (EUiAnimationEvent uiAnimationEvent, IUiAnimSequence *pAnimSequence)=0
 callback on UI animation events
 
virtual void OnUiTrackEvent (AZStd::string eventName, AZStd::string valueName, IUiAnimSequence *pAnimSequence)
 

Static Public Member Functions

static void GetProvidedServices (AZ::ComponentDescriptor::DependencyArrayType &provided)
 
static void GetIncompatibleServices (AZ::ComponentDescriptor::DependencyArrayType &incompatible)
 
static void GetRequiredServices (AZ::ComponentDescriptor::DependencyArrayType &required)
 
static void Reflect (AZ::ReflectContext *context)
 
static void Initialize ()
 
static void Shutdown ()
 

Static Public Attributes

static const AZ::Vector2 s_defaultCanvasSize
 
static const AZ::Color s_defaultGuideColor
 

Protected Member Functions

void Init () override
 
void Activate () override
 
void Deactivate () override
 

Additional Inherited Members

- Public Types inherited from IUiAnimationListener
enum  EUiAnimationEvent { eUiAnimationEvent_Started = 0 , eUiAnimationEvent_Stopped , eUiAnimationEvent_Aborted , eUiAnimationEvent_Updated }
 

Member Function Documentation

◆ CloneAndInitializeCanvas()

UiCanvasComponent * UiCanvasComponent::CloneAndInitializeCanvas ( UiEntityContext entityContext,
const AZStd::string &  assetIdPathname,
const AZ::Vector2 *  canvasSize = nullptr 
)

Clone this canvas's entity and return the Canvas component (used when it is loaded from in game or for preview mode etc)

◆ OnUiAnimationEvent()

void UiCanvasComponent::OnUiAnimationEvent ( EUiAnimationEvent  uiAnimationEvent,
IUiAnimSequence pAnimSequence 
)
overridevirtual

callback on UI animation events

Implements IUiAnimationListener.

◆ OnUiTrackEvent()

void UiCanvasComponent::OnUiTrackEvent ( AZStd::string  eventName,
AZStd::string  valueName,
IUiAnimSequence pAnimSequence 
)
overridevirtual

Reimplemented from IUiAnimationListener.


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