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.
UiElementComponent Class Reference

Inherits AZ::Component, UiElementBus::Handler, UiEditorBus::Handler, AZ::SliceEntityHierarchyRequestBus::Handler, AZ::EntityBus::Handler, and AZStd::intrusive_slist_node< UiElementComponent >.

Public Types

typedef LyShine::EntityIdMap EntityIdMap
 

Public Member Functions

 AZ_COMPONENT (UiElementComponent, LyShine::UiElementComponentUuid, AZ::Component, AZ::SliceEntityHierarchyInterface)
 
 UiElementComponent ()
 Construct an uninitialized element component.
 
void RenderElement (LyShine::IRenderGraph *renderGraph, bool isInGame) override
 
LyShine::ElementId GetElementId () override
 
LyShine::NameType GetName () override
 
AZ::EntityId GetCanvasEntityId () override
 
AZ::Entity * GetParent () override
 
AZ::EntityId GetParentEntityId () override
 
int GetNumChildElements () override
 
AZ::Entity * GetChildElement (int index) override
 
AZ::EntityId GetChildEntityId (int index) override
 
UiElementInterfaceGetChildElementInterface (int index) override
 
int GetIndexOfChild (const AZ::Entity *child) override
 
int GetIndexOfChildByEntityId (AZ::EntityId childId) override
 
LyShine::EntityArray GetChildElements () override
 
AZStd::vector< AZ::EntityId > GetChildEntityIds () override
 
AZ::Entity * CreateChildElement (const LyShine::NameType &name) override
 
void DestroyElement () override
 
void DestroyElementOnFrameEnd () override
 
void Reparent (AZ::Entity *newParent, AZ::Entity *insertBefore=nullptr) override
 
void ReparentByEntityId (AZ::EntityId newParent, AZ::EntityId insertBefore) override
 
void AddToParentAtIndex (AZ::Entity *newParent, int index=-1) override
 
void RemoveFromParent () override
 
AZ::Entity * FindFrontmostChildContainingPoint (AZ::Vector2 point, bool isInGame) override
 
LyShine::EntityArray FindAllChildrenIntersectingRect (const AZ::Vector2 &bound0, const AZ::Vector2 &bound1, bool isInGame) override
 
AZ::EntityId FindInteractableToHandleEvent (AZ::Vector2 point) override
 
AZ::EntityId FindParentInteractableSupportingDrag (AZ::Vector2 point) override
 
AZ::Entity * FindChildByName (const LyShine::NameType &name) override
 
AZ::Entity * FindDescendantByName (const LyShine::NameType &name) override
 
AZ::EntityId FindChildEntityIdByName (const LyShine::NameType &name) override
 
AZ::EntityId FindDescendantEntityIdByName (const LyShine::NameType &name) override
 
AZ::Entity * FindChildByEntityId (AZ::EntityId id) override
 
AZ::Entity * FindDescendantById (LyShine::ElementId id) override
 
void FindDescendantElements (AZStd::function< bool(const AZ::Entity *)> predicate, LyShine::EntityArray &result) override
 
void CallOnDescendantElements (AZStd::function< void(const AZ::EntityId)> callFunction) override
 
bool IsAncestor (AZ::EntityId id) override
 
bool IsEnabled () override
 
void SetIsEnabled (bool isEnabled) override
 
bool GetAreElementAndAncestorsEnabled () override
 
bool IsRenderEnabled () override
 
void SetIsRenderEnabled (bool isRenderEnabled) override
 
bool GetIsVisible () override
 The UiElementComponent implements the editor interface in order to store the state with the element on save.
 
void SetIsVisible (bool isVisible) override
 
bool GetIsSelectable () override
 
void SetIsSelectable (bool isSelectable) override
 
bool GetIsSelected () override
 
void SetIsSelected (bool isSelected) override
 
bool GetIsExpanded () override
 
void SetIsExpanded (bool isExpanded) override
 
bool AreAllAncestorsVisible () override
 
void OnEntityActivated (const AZ::EntityId &) override
 
void OnEntityDeactivated (const AZ::EntityId &) override
 
void AddChild (AZ::Entity *child, AZ::Entity *insertBefore=nullptr)
 
void RemoveChild (AZ::Entity *child)
 
void RemoveChild (AZ::EntityId child)
 
void SetCanvas (UiCanvasComponent *canvas, LyShine::ElementId elementId)
 Only to be used by UiCanvasComponent when creating the root element.
 
bool FixupPostLoad (AZ::Entity *entity, UiCanvasComponent *canvas, AZ::Entity *parent, bool makeNewElementIds)
 Only to be used by UiCanvasComponent when loading, cloning etc.
 
UiTransform2dComponentGetTransform2dComponent () const
 Get the cached UiTransform2dComponent pointer (for optimization)
 
UiElementComponentGetParentElementComponent () const
 Get the cached UiElementComponent pointer for the parent (for optimization)
 
UiElementComponentGetChildElementComponent (int index) const
 Get the cached UiElementComponent pointer for the child (for optimization)
 
UiCanvasComponentGetCanvasComponent () const
 Get the cached UiCanvasComponent pointer for the canvas this element belongs to (for optimization)
 
bool IsFullyInitialized () const
 
bool AreChildPointersValid () const
 
AZ::EntityId GetSliceEntityParentId () override
 
AZStd::vector< AZ::EntityId > GetSliceEntityChildren () override
 

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 bool MoveEntityAndDescendantsToListAndReplaceWithEntityId (AZ::SerializeContext &context, AZ::SerializeContext::DataElementNode &elementNode, int index, AZStd::vector< AZ::SerializeContext::DataElementNode > &entities)
 

Protected Member Functions

void Activate () override
 
void Deactivate () override
 

Friends

class UiCanvasComponent
 

Member Function Documentation

◆ MoveEntityAndDescendantsToListAndReplaceWithEntityId()

static bool UiElementComponent::MoveEntityAndDescendantsToListAndReplaceWithEntityId ( AZ::SerializeContext &  context,
AZ::SerializeContext::DataElementNode &  elementNode,
int  index,
AZStd::vector< AZ::SerializeContext::DataElementNode > &  entities 
)
static

Helper function used during conversion of old format canvas files. Called from UiCanvasFileObject::VersionConverter and PrefabFileObject::VersionConverter. In the old format child entities were referenced by Entity* rather than EntityId so each entity had all of its children nested under it in the file. In the newer format, that was introduced when slice support was added, the entities are owned by the root slice and referenced by entity id. An index of -1 is used when this is called on the root element of the canvas, otherwise index is the index of the child entity withing the children container.


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