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::ContainerEntitySystemComponent Class Referencefinal

#include <ContainerEntitySystemComponent.h>

Inherits AZ::Component, AzToolsFramework::ContainerEntityInterface, and EditorEntityContextNotificationBus::Handler.

Public Member Functions

 AZ_COMPONENT (ContainerEntitySystemComponent, "{74349759-B36B-44A6-B89F-F45D7111DD11}")
 
void Activate () override
 
void Deactivate () override
 
ContainerEntityOperationResult RegisterEntityAsContainer (AZ::EntityId entityId) override
 
ContainerEntityOperationResult UnregisterEntityAsContainer (AZ::EntityId entityId) override
 
bool IsContainer (AZ::EntityId entityId) const override
 Returns whether the entity id provided is registered as a container.
 
ContainerEntityOperationResult SetContainerOpen (AZ::EntityId entityId, bool open) override
 
bool IsContainerOpen (AZ::EntityId entityId) const override
 
AZ::EntityId FindHighestSelectableEntity (AZ::EntityId entityId) const override
 
void RefreshAllContainerEntities (AzFramework::EntityContextId entityContextId) const override
 
ContainerEntityOperationResult Clear (AzFramework::EntityContextId entityContextId) override
 
bool IsUnderClosedContainerEntity (AZ::EntityId entityId) const override
 Returns true if one of the ancestors of entityId is a closed container entity.
 
void OnEntityStreamLoadSuccess () override
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 
static void GetProvidedServices (AZ::ComponentDescriptor::DependencyArrayType &provided)
 

Detailed Description

System Component to track Container Entity registration and open state. An entity registered as Container is just like a regular entity when open. If its state is changed to closed, all descendants of the entity will be treated as part of the entity itself. Selecting any descendant will result in the container being selected, and descendants will be hidden until the container is opened.

Member Function Documentation

◆ Clear()

ContainerEntityOperationResult AzToolsFramework::ContainerEntitySystemComponent::Clear ( AzFramework::EntityContextId  entityContextId)
overridevirtual

Clears all open state information for Container Entities for the EntityContextId provided. Used when context is switched, for example in the case of a new root prefab being loaded in place of an old one.

Note
Clear is meant to be called when no container is registered for the context provided.
Returns
An error message if any container was registered for the context, success otherwise.

Implements AzToolsFramework::ContainerEntityInterface.

◆ FindHighestSelectableEntity()

AZ::EntityId AzToolsFramework::ContainerEntitySystemComponent::FindHighestSelectableEntity ( AZ::EntityId  entityId) const
overridevirtual

Detects if one of the ancestors of entityId is a closed container entity.

Returns
The highest closed entity container id if any, or entityId otherwise.

Implements AzToolsFramework::ContainerEntityInterface.

◆ IsContainer()

bool AzToolsFramework::ContainerEntitySystemComponent::IsContainer ( AZ::EntityId  entityId) const
overridevirtual

Returns whether the entity id provided is registered as a container.

Implements AzToolsFramework::ContainerEntityInterface.

◆ IsContainerOpen()

bool AzToolsFramework::ContainerEntitySystemComponent::IsContainerOpen ( AZ::EntityId  entityId) const
overridevirtual

If the entity id provided is registered as a container, it returns whether it's open.

Note
the default value for non-containers is true, so this function can be called without verifying whether the entityId is registered as a container beforehand, since the container's open behavior is exactly the same as the one of a regular entity.
Returns
False if the entityId is registered as a container, and its state is closed. True otherwise.

Implements AzToolsFramework::ContainerEntityInterface.

◆ IsUnderClosedContainerEntity()

bool AzToolsFramework::ContainerEntitySystemComponent::IsUnderClosedContainerEntity ( AZ::EntityId  entityId) const
overridevirtual

Returns true if one of the ancestors of entityId is a closed container entity.

Implements AzToolsFramework::ContainerEntityInterface.

◆ RefreshAllContainerEntities()

void AzToolsFramework::ContainerEntitySystemComponent::RefreshAllContainerEntities ( AzFramework::EntityContextId  entityContextId) const
overridevirtual

Triggers the OnContainerEntityStatusChanged notifications for all registered containers, allowing listeners to update correctly.

Implements AzToolsFramework::ContainerEntityInterface.

◆ RegisterEntityAsContainer()

ContainerEntityOperationResult AzToolsFramework::ContainerEntitySystemComponent::RegisterEntityAsContainer ( AZ::EntityId  entityId)
overridevirtual

Registers the entity as a container. The container will be closed by default.

Parameters
entityIdThe entityId that will be registered as a container.

Implements AzToolsFramework::ContainerEntityInterface.

◆ SetContainerOpen()

ContainerEntityOperationResult AzToolsFramework::ContainerEntitySystemComponent::SetContainerOpen ( AZ::EntityId  entityId,
bool  open 
)
overridevirtual

Sets the open state of the container entity provided.

Parameters
entityIdThe entityId whose open state will be set.
openTrue if the container should be opened, false if it should be closed.
Returns
An error message if the operation was invalid, success otherwise.

Implements AzToolsFramework::ContainerEntityInterface.

◆ UnregisterEntityAsContainer()

ContainerEntityOperationResult AzToolsFramework::ContainerEntitySystemComponent::UnregisterEntityAsContainer ( AZ::EntityId  entityId)
overridevirtual

Unregisters the entity as a container. The system will retain the closed state in case the entity is registered again later, but if queried the entity will no longer behave as a container.

Parameters
entityIdThe entityId that will be unregistered as a container.

Implements AzToolsFramework::ContainerEntityInterface.


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