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::SliceEditorEntityOwnershipService Class Reference

Inherits AzFramework::SliceEntityOwnershipService, SliceEditorEntityOwnershipServiceRequestBus::Handler, and AzFramework::SliceInstantiationResultBus::MultiHandler.

Public Types

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

Public Member Functions

 AZ_CLASS_ALLOCATOR (SliceEditorEntityOwnershipService, AZ::SystemAllocator)
 
 SliceEditorEntityOwnershipService (const AzFramework::EntityContextId &entityContextId, AZ::SerializeContext *serializeContext)
 
void StartPlayInEditor (EntityIdToEntityIdMap &m_editorToRuntimeIdMap, EntityIdToEntityIdMap &m_runtimeToEditorIdMap)
 
void StopPlayInEditor (EntityIdToEntityIdMap &m_editorToRuntimeIdMap, EntityIdToEntityIdMap &m_runtimeToEditorIdMap)
 
bool SaveToStreamForEditor (AZ::IO::GenericStream &stream, const EntityList &entitiesInLayers, AZ::SliceComponent::SliceReferenceToInstancePtrs &instancesInLayers)
 
bool SaveToStreamForGame (AZ::IO::GenericStream &stream, AZ::DataStream::StreamType streamType)
 
void AssociateToRootMetadataEntity (const EntityList &entities)
 
bool LoadFromStreamWithLayers (AZ::IO::GenericStream &stream, QString levelPakFile)
 
void OnAssetReady (AZ::Data::Asset< AZ::Data::AssetData > asset) override
 
void OnAssetReloaded (AZ::Data::Asset< AZ::Data::AssetData > asset) override
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 

Protected Member Functions

void HandleNewMetadataEntitiesCreated (AZ::SliceComponent &slice) override
 

Member Function Documentation

◆ AssociateToRootMetadataEntity()

void AzToolsFramework::SliceEditorEntityOwnershipService::AssociateToRootMetadataEntity ( const EntityList &  entities)

If the entities do not belong to a slice, associate them to the root slice metdata info component.

Parameters
entities

◆ LoadFromStreamWithLayers()

bool AzToolsFramework::SliceEditorEntityOwnershipService::LoadFromStreamWithLayers ( AZ::IO::GenericStream &  stream,
QString  levelPakFile 
)

Loads the root slice of EntityOwnershipService from the specified stream, and loads any layers referenced in the level.

Parameters
streamThe stream to load from.
levelPakFileThe path to the level's pak file, which is used to find the layers.
Returns
true if successfully loaded.

◆ SaveToStreamForEditor()

bool AzToolsFramework::SliceEditorEntityOwnershipService::SaveToStreamForEditor ( AZ::IO::GenericStream &  stream,
const EntityList &  entitiesInLayers,
AZ::SliceComponent::SliceReferenceToInstancePtrs &  instancesInLayers 
)

Saves the root slice of the entity ownership service to the specified buffer. Entities are saved as-is (with editor components).

Parameters
streamThe stream to save the editor entity ownership service to.
entitiesInLayersA list of entities that were saved into layers. These won't be saved to the editor entity ownership service stream.
instancesInLayersThe map of slice references to their instances that were saved into layers. These won't be saved to the editor entity ownership service stream.
Returns
true if successfully saved. Failure is only possible if serialization data is corrupt.

◆ SaveToStreamForGame()

bool AzToolsFramework::SliceEditorEntityOwnershipService::SaveToStreamForGame ( AZ::IO::GenericStream &  stream,
AZ::DataStream::StreamType  streamType 
)

Saves the root slice of entity ownership serive to the specified buffer. Entities undergo conversion for game: editor -> game components.

Parameters
streamThe stream to save the entity ownership service to.
streamType
Returns
true if successfully saved. Failure is only possible if serialization data is corrupt.

◆ StartPlayInEditor()

void AzToolsFramework::SliceEditorEntityOwnershipService::StartPlayInEditor ( EntityIdToEntityIdMap &  m_editorToRuntimeIdMap,
EntityIdToEntityIdMap &  m_runtimeToEditorIdMap 
)

Switches to game mode in the editor.

Parameters
m_editorToRuntimeIdMapThe entityId map of editor entities to game entities.
m_runtimeToEditorIdMapThe entityId map of game entities to editor entities.

◆ StopPlayInEditor()

void AzToolsFramework::SliceEditorEntityOwnershipService::StopPlayInEditor ( EntityIdToEntityIdMap &  m_editorToRuntimeIdMap,
EntityIdToEntityIdMap &  m_runtimeToEditorIdMap 
)

Stops the game mode in the editor.

Parameters
m_editorToRuntimeIdMapThe entityId map of editor entities to game entities.
m_runtimeToEditorIdMapThe entityId map of game entities to editor entities.

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