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

Inherits AzFramework::PrefabEntityOwnershipService, AzToolsFramework::PrefabEditorEntityOwnershipInterface, and AzFramework::SliceEntityRequestBus::MultiHandler.

Public Types

using OnEntitiesAddedCallback = AzFramework::OnEntitiesAddedCallback
 
using OnEntitiesRemovedCallback = AzFramework::OnEntitiesRemovedCallback
 
using ValidateEntitiesCallback = AzFramework::ValidateEntitiesCallback
 

Public Member Functions

 PrefabEditorEntityOwnershipService (const AzFramework::EntityContextId &entityContextId, AZ::SerializeContext *serializeContext)
 
void Initialize () override
 Initializes all assets/entities/components required for managing entities.
 
bool IsInitialized () override
 Returns true if the entity ownership service is initialized.
 
void Destroy () override
 Destroys all the assets/entities/components created for managing entities.
 
void Reset () override
 Resets the assets/entities/components without fully destroying them for managing entities.
 
void AddEntity (AZ::Entity *entity) override
 
void AddEntities (const EntityList &entities) override
 
bool DestroyEntity (AZ::Entity *entity) override
 
bool DestroyEntityById (const AZ::EntityId entityId) override
 
void GetNonPrefabEntities (EntityList &entities) override
 
bool GetAllEntities (EntityList &entities) override
 
void InstantiateAllPrefabs () override
 
void HandleEntitiesAdded (const EntityList &entities) override
 
bool LoadFromStream (AZ::IO::GenericStream &stream, bool remapIds, EntityIdToEntityIdMap *idRemapTable=nullptr, const AZ::ObjectStream::FilterDescriptor &filterDesc=AZ::ObjectStream::FilterDescriptor()) override
 
void SetEntitiesAddedCallback (OnEntitiesAddedCallback onEntitiesAddedCallback) override
 
void SetEntitiesRemovedCallback (OnEntitiesRemovedCallback onEntitiesRemovedCallback) override
 
void SetValidateEntitiesCallback (ValidateEntitiesCallback validateEntitiesCallback) override
 
void HandleEntityBeingDestroyed (const AZ::EntityId &entityId) override
 
bool LoadFromStream (AZ::IO::GenericStream &stream, AZStd::string_view filename) override
 
bool SaveToStream (AZ::IO::GenericStream &stream, AZStd::string_view filename) override
 
void StartPlayInEditor () override
 
void StopPlayInEditor () override
 
void CreateNewLevelPrefab (AZStd::string_view filename, const AZStd::string &templateFilename) override
 
bool IsRootPrefabAssigned () const override
 
Prefab::InstanceOptionalReference GetInstanceReferenceFromRootAliasPath (Prefab::RootAliasPath rootAliasPath) const override
 
bool GetInstancesInRootAliasPath (Prefab::RootAliasPath rootAliasPath, const AZStd::function< bool(const Prefab::InstanceOptionalReference)> &callback) const override
 
void RegisterGameModeEventHandler (AZ::Event< GameModeState >::Handler &handler) override
 

Protected Member Functions

AZ::SliceComponent::SliceInstanceAddress GetOwningSlice () override
 

Member Function Documentation

◆ CreateNewLevelPrefab()

void AzToolsFramework::PrefabEditorEntityOwnershipService::CreateNewLevelPrefab ( AZStd::string_view  filename,
const AZStd::string &  templateFilename 
)
overridevirtual

◆ GetAllEntities()

bool AzToolsFramework::PrefabEditorEntityOwnershipService::GetAllEntities ( EntityList &  entities)
override

Gets all entities, including those that are owned by prefabs in the entity ownership service.

Parameters
entityListThe entity list to add the entities to.
Returns
bool whether fetching entities was successful.

◆ GetInstanceReferenceFromRootAliasPath()

Prefab::InstanceOptionalReference AzToolsFramework::PrefabEditorEntityOwnershipService::GetInstanceReferenceFromRootAliasPath ( Prefab::RootAliasPath  rootAliasPath) const
overridevirtual

Returns the reference to the instance corresponding to the RootAliasPath provided.

Parameters
rootAliasPathThe RootAliasPath to be queried.
Returns
A reference to the instance if valid, AZStd::nullopt otherwise.

Implements AzToolsFramework::PrefabEditorEntityOwnershipInterface.

◆ GetInstancesInRootAliasPath()

bool AzToolsFramework::PrefabEditorEntityOwnershipService::GetInstancesInRootAliasPath ( Prefab::RootAliasPath  rootAliasPath,
const AZStd::function< bool(const Prefab::InstanceOptionalReference)> &  callback 
) const
overridevirtual

Allows to iterate through all instances referenced in the path, from the root down.

Parameters
rootAliasPathThe RootAliasPath to iterate through. If invalid, callback will not be called.
callbackThe function to call on each instance. If it returns true, it prevents the rest of the path from being called.
Returns
True if the iteration was halted by a callback returning true, false otherwise. Also returns false if the path is invalid.

Implements AzToolsFramework::PrefabEditorEntityOwnershipInterface.

◆ GetNonPrefabEntities()

void AzToolsFramework::PrefabEditorEntityOwnershipService::GetNonPrefabEntities ( EntityList &  entities)
override

Gets the entities in entity ownership service that do not belong to a prefab.

Parameters
entityListThe entity list to add the entities to.

◆ InstantiateAllPrefabs()

void AzToolsFramework::PrefabEditorEntityOwnershipService::InstantiateAllPrefabs ( )
override

Instantiates all the prefabs that are in the entity ownership service.

◆ IsRootPrefabAssigned()

bool AzToolsFramework::PrefabEditorEntityOwnershipService::IsRootPrefabAssigned ( ) const
overridevirtual

Returns whether the system has a root instance assigned.

Returns
True if a root prefab is assigned, false otherwise.

Implements AzToolsFramework::PrefabEditorEntityOwnershipInterface.

◆ LoadFromStream()

bool AzToolsFramework::PrefabEditorEntityOwnershipService::LoadFromStream ( AZ::IO::GenericStream &  stream,
AZStd::string_view  filename 
)
overridevirtual

◆ RegisterGameModeEventHandler()

void AzToolsFramework::PrefabEditorEntityOwnershipService::RegisterGameModeEventHandler ( AZ::Event< GameModeState >::Handler &  handler)
inlineoverridevirtual

◆ SaveToStream()

bool AzToolsFramework::PrefabEditorEntityOwnershipService::SaveToStream ( AZ::IO::GenericStream &  stream,
AZStd::string_view  filename 
)
overridevirtual

◆ StartPlayInEditor()

void AzToolsFramework::PrefabEditorEntityOwnershipService::StartPlayInEditor ( )
overridevirtual

◆ StopPlayInEditor()

void AzToolsFramework::PrefabEditorEntityOwnershipService::StopPlayInEditor ( )
overridevirtual

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