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::Prefab::PrefabPublicRequests Class Referenceabstract

#include <PrefabPublicRequestBus.h>

Inherits AZ::EBusTraits.

Public Types

using Bus = AZ::EBus< PrefabPublicRequests >
 

Public Member Functions

virtual CreatePrefabResult CreatePrefabInMemory (const EntityIdList &entityIds, AZStd::string_view filePath)=0
 
virtual InstantiatePrefabResult InstantiatePrefab (AZStd::string_view filePath, AZ::EntityId parent, const AZ::Vector3 &position)=0
 
virtual PrefabOperationResult DeleteEntitiesAndAllDescendantsInInstance (const EntityIdList &entityIds)=0
 
virtual PrefabOperationResult DetachPrefab (const AZ::EntityId &containerEntityId)=0
 
virtual DuplicatePrefabResult DuplicateEntitiesInInstance (const EntityIdList &entityIds)=0
 
virtual AZStd::string GetOwningInstancePrefabPath (AZ::EntityId entityId) const =0
 
virtual CreateSpawnableResult CreateInMemorySpawnableAsset (AZStd::string_view prefabFilePath, AZStd::string_view spawnableName)=0
 
virtual PrefabOperationResult RemoveInMemorySpawnableAsset (AZStd::string_view spawnableName)=0
 
virtual bool HasInMemorySpawnableAsset (AZStd::string_view spawnableName) const =0
 
virtual AZ::Data::AssetId GetInMemorySpawnableAssetId (AZStd::string_view spawnableName) const =0
 
virtual void RemoveAllInMemorySpawnableAssets ()=0
 

Static Public Attributes

static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single
 

Detailed Description

The primary purpose of this bus is to facilitate writing automated tests for prefabs. It calls PrefabPublicInterface internally to talk to the prefab system. If you would like to integrate prefabs into your system, please call PrefabPublicInterface directly for better performance.

Member Function Documentation

◆ CreateInMemorySpawnableAsset()

virtual CreateSpawnableResult AzToolsFramework::Prefab::PrefabPublicRequests::CreateInMemorySpawnableAsset ( AZStd::string_view  prefabFilePath,
AZStd::string_view  spawnableName 
)
pure virtual

Convert a prefab on given file path with given name to in-memory spawnable asset. Returns the asset id of the produced spawnable if creation succeeded; on failure, it comes with an error message detailing the cause of the error.

◆ CreatePrefabInMemory()

virtual CreatePrefabResult AzToolsFramework::Prefab::PrefabPublicRequests::CreatePrefabInMemory ( const EntityIdList &  entityIds,
AZStd::string_view  filePath 
)
pure virtual

Create a prefab out of the entities provided, at the path provided, and keep it in memory. Automatically detects descendants of entities, and discerns between entities and child instances. Return an outcome object with an container entity id of the prefab created if creation succeeded; on failure, it comes with an error message detailing the cause of the error.

◆ DeleteEntitiesAndAllDescendantsInInstance()

virtual PrefabOperationResult AzToolsFramework::Prefab::PrefabPublicRequests::DeleteEntitiesAndAllDescendantsInInstance ( const EntityIdList &  entityIds)
pure virtual

Deletes all entities and their descendants from the owning instance. Bails if the entities don't all belong to the same instance. Return an outcome object; on failure, it comes with an error message detailing the cause of the error.

◆ DetachPrefab()

virtual PrefabOperationResult AzToolsFramework::Prefab::PrefabPublicRequests::DetachPrefab ( const AZ::EntityId &  containerEntityId)
pure virtual

If the entity id is a container entity id, detaches the prefab instance corresponding to it. This includes converting the container entity into a regular entity and putting it under the parent prefab, removing the link between this instance and the parent, removing links between this instance and its nested instances, and adding entities directly owned by this instance under the parent instance. Bails if the entity is not a container entity or belongs to the level prefab instance. Return an outcome object; on failure, it comes with an error message detailing the cause of the error.

◆ DuplicateEntitiesInInstance()

virtual DuplicatePrefabResult AzToolsFramework::Prefab::PrefabPublicRequests::DuplicateEntitiesInInstance ( const EntityIdList &  entityIds)
pure virtual

Duplicates all entities in the owning instance. Bails if the entities don't all belong to the same instance. Return an outcome object with a list of ids of given entities' duplicates if duplication succeeded; on failure, it comes with an error message detailing the cause of the error.

◆ GetInMemorySpawnableAssetId()

virtual AZ::Data::AssetId AzToolsFramework::Prefab::PrefabPublicRequests::GetInMemorySpawnableAssetId ( AZStd::string_view  spawnableName) const
pure virtual

Return an asset id of a spawnalbe with given name. Invalid asset id will be returned if the spawnable doesn't exist.

◆ GetOwningInstancePrefabPath()

virtual AZStd::string AzToolsFramework::Prefab::PrefabPublicRequests::GetOwningInstancePrefabPath ( AZ::EntityId  entityId) const
pure virtual

Get the file path to the prefab file for the prefab instance owning the entity provided. Returns the path to the prefab, or an empty path if the entity is owned by the level.

◆ HasInMemorySpawnableAsset()

virtual bool AzToolsFramework::Prefab::PrefabPublicRequests::HasInMemorySpawnableAsset ( AZStd::string_view  spawnableName) const
pure virtual

Return whether an in-memory spawnable with given name exists or not.

◆ InstantiatePrefab()

virtual InstantiatePrefabResult AzToolsFramework::Prefab::PrefabPublicRequests::InstantiatePrefab ( AZStd::string_view  filePath,
AZ::EntityId  parent,
const AZ::Vector3 &  position 
)
pure virtual

Instantiate a prefab from a prefab file. Return an outcome object with an container entity id of the prefab instantiated if instantiation succeeded; on failure, it comes with an error message detailing the cause of the error.

◆ RemoveAllInMemorySpawnableAssets()

virtual void AzToolsFramework::Prefab::PrefabPublicRequests::RemoveAllInMemorySpawnableAssets ( )
pure virtual

Remove all the in-memory spawnable assets.

◆ RemoveInMemorySpawnableAsset()

virtual PrefabOperationResult AzToolsFramework::Prefab::PrefabPublicRequests::RemoveInMemorySpawnableAsset ( AZStd::string_view  spawnableName)
pure virtual

Remove in-memory spawnable asset with given name. Return an outcome object; on failure, it comes with an error message detailing the cause of the error.


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