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

#include <UiEditorEntityContext.h>

Inherits UiEntityContext, AZ::Data::AssetBus::MultiHandler, UiEditorEntityContextRequestBus::Handler, AzToolsFramework::EditorEntityContextPickingRequestBus::Handler, AzFramework::AssetCatalogEventBus::Handler, and AzFramework::SliceInstantiationResultBus::MultiHandler.

Classes

struct  InstantiatingEditorSliceParams
 

Public Member Functions

 UiEditorEntityContext (EditorWindow *editorWindow)
 
bool HandleLoadedRootSliceEntity (AZ::Entity *rootEntity, bool remapIds, AZ::SliceComponent::EntityIdToEntityIdMap *idRemapTable=nullptr)
 
void InitUiContext () override
 Initialize the entity context and instantiate the root slice.
 
void DestroyUiContext () override
 Destroy the Entity Context.
 
bool SaveToStreamForGame (AZ::IO::GenericStream &stream, AZ::DataStream::StreamType streamType) override
 
bool SaveCanvasEntityToStreamForGame (AZ::Entity *canvasEntity, AZ::IO::GenericStream &stream, AZ::DataStream::StreamType streamType) override
 
AZ::SliceComponent * GetUiRootSlice () override
 
AZ::Entity * CreateUiEntity (const char *name) override
 
void AddUiEntity (AZ::Entity *entity) override
 
void AddUiEntities (const AzFramework::EntityList &entities) override
 
bool CloneUiEntities (const AZStd::vector< AZ::EntityId > &sourceEntities, AzFramework::EntityList &resultEntities) override
 
bool DestroyUiEntity (AZ::EntityId entityId) override
 
bool SupportsViewportEntityIdPicking () override
 
AZ::SliceComponent::SliceInstanceAddress CloneEditorSliceInstance (AZ::SliceComponent::SliceInstanceAddress sourceInstance) override
 
AzFramework::SliceInstantiationTicket InstantiateEditorSlice (const AZ::Data::Asset< AZ::Data::AssetData > &sliceAsset, AZ::Vector2 viewportPosition) override
 
AzFramework::SliceInstantiationTicket InstantiateEditorSliceAtChildIndex (const AZ::Data::Asset< AZ::Data::AssetData > &sliceAsset, AZ::Vector2 viewportPosition, int childIndex) override
 
void RestoreSliceEntity (AZ::Entity *entity, const AZ::SliceComponent::EntityRestoreInfo &info) override
 
void QueueSliceReplacement (const char *targetPath, const AZStd::unordered_map< AZ::EntityId, AZ::EntityId > &selectedToAssetMap, const AZStd::unordered_set< AZ::EntityId > &entitiesInSelection, AZ::Entity *commonParent, AZ::Entity *insertBefore) override
 
void DeleteElements (AzToolsFramework::EntityIdList elements) override
 
bool HasPendingRequests () override
 
bool IsInstantiatingSlices () override
 
void DetachSliceEntities (const AzToolsFramework::EntityIdList &entities) override
 
void OnSlicePreInstantiate (const AZ::Data::AssetId &sliceAssetId, const AZ::SliceComponent::SliceInstanceAddress &sliceAddress) override
 
void OnSliceInstantiated (const AZ::Data::AssetId &sliceAssetId, const AZ::SliceComponent::SliceInstanceAddress &sliceAddress) override
 
void OnSliceInstantiationFailed (const AZ::Data::AssetId &sliceAssetId) override
 
void OnCatalogAssetAdded (const AZ::Data::AssetId &assetId) override
 
void ResetContext () override
 
AZStd::string GetErrorMessage () const
 
virtual void InitUiContext ()=0
 Initialize the entity context and instantiate the root slice.
 
virtual void DestroyUiContext ()=0
 Destroy the Entity Context.
 
virtual bool SaveToStreamForGame (AZ::IO::GenericStream &stream, AZ::DataStream::StreamType streamType)=0
 
virtual bool SaveCanvasEntityToStreamForGame (AZ::Entity *canvasEntity, AZ::IO::GenericStream &stream, AZ::DataStream::StreamType streamType)=0
 

Protected Types

using InstantiatingSlicePair = AZStd::pair< AZ::Data::Asset< AZ::Data::AssetData >, InstantiatingEditorSliceParams >
 

Protected Member Functions

void OnAssetReady (AZ::Data::Asset< AZ::Data::AssetData > asset) override
 
void OnAssetReloaded (AZ::Data::Asset< AZ::Data::AssetData > asset) override
 
void OnContextEntitiesAdded (const AzFramework::EntityList &entities) override
 
bool ValidateEntitiesAreValidForContext (const AzFramework::EntityList &entities) override
 
void SetupUiEntity (AZ::Entity *entity)
 
void InitializeEntities (const AzFramework::EntityList &entities)
 

Protected Attributes

AZStd::vector< InstantiatingSlicePair > m_instantiatingSlices
 

Detailed Description

The UIEditorEntityContext extends the UiEditorContext to add functionality only needed when a UI canvas is loaded in the UI Editor.

Member Function Documentation

◆ DestroyUiContext()

void UiEditorEntityContext::DestroyUiContext ( )
overridevirtual

Destroy the Entity Context.

Implements UiEntityContext.

◆ InitUiContext()

void UiEditorEntityContext::InitUiContext ( )
overridevirtual

Initialize the entity context and instantiate the root slice.

Implements UiEntityContext.

◆ SaveCanvasEntityToStreamForGame()

bool UiEditorEntityContext::SaveCanvasEntityToStreamForGame ( AZ::Entity *  canvasEntity,
AZ::IO::GenericStream &  stream,
AZ::DataStream::StreamType  streamType 
)
overridevirtual

Saves the given canvas entity to the specified buffer. If necessary the entity undergoes conversion for game: editor -> game components.

Returns
true if successfully saved. Failure is only possible if serialization data is corrupt. This is needed because the canvas entity is not part of the root slice. It is here in the entity context because that allows us to get to the ToolsFramework functionality.

Implements UiEntityContext.

◆ SaveToStreamForGame()

bool UiEditorEntityContext::SaveToStreamForGame ( AZ::IO::GenericStream &  stream,
AZ::DataStream::StreamType  streamType 
)
overridevirtual

Saves the context's slice root to the specified buffer. If necessary entities undergo conversion for game: editor -> game components.

Returns
true if successfully saved. Failure is only possible if serialization data is corrupt.

Implements UiEntityContext.


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