Inherits AzToolsFramework::Prefab::PrefabPublicInterface.
|
| AZ_CLASS_ALLOCATOR (PrefabPublicHandler, AZ::SystemAllocator) |
|
| AZ_RTTI (PrefabPublicHandler, "{35802943-6B60-430F-9DED-075E3A576A25}", PrefabPublicInterface) |
|
void | RegisterPrefabPublicHandlerInterface () |
|
void | UnregisterPrefabPublicHandlerInterface () |
|
CreatePrefabResult | CreatePrefabInDisk (const EntityIdList &entityIds, AZ::IO::PathView filePath) override |
|
CreatePrefabResult | CreatePrefabAndSaveToDisk (const EntityIdList &entityIds, AZ::IO::PathView filePath) override |
|
CreatePrefabResult | CreatePrefabInMemory (const EntityIdList &entityIds, AZ::IO::PathView filePath) override |
|
InstantiatePrefabResult | InstantiatePrefab (AZStd::string_view filePath, AZ::EntityId parentId, const AZ::Transform &transform) override |
|
InstantiatePrefabResult | InstantiatePrefab (AZStd::string_view filePath, AZ::EntityId parentId, const AZ::Vector3 &position) override |
|
PrefabOperationResult | SavePrefab (AZ::IO::Path filePath) override |
|
PrefabEntityResult | CreateEntity (AZ::EntityId parentId, const AZ::Vector3 &position) override |
|
PrefabOperationResult | GenerateUndoNodesForEntityChangeAndUpdateCache (AZ::EntityId entityId, UndoSystem::URSequencePoint *parentUndoBatch) override |
|
bool | IsOwnedByPrefabInstance (AZ::EntityId entityId) const override |
|
bool | IsOwnedByProceduralPrefabInstance (AZ::EntityId entityId) const override |
|
bool | IsInstanceContainerEntity (AZ::EntityId entityId) const override |
|
bool | IsLevelInstanceContainerEntity (AZ::EntityId entityId) const override |
|
bool | EntitiesBelongToSameInstance (const EntityIdList &entityIds) const |
|
AZ::EntityId | GetInstanceContainerEntityId (AZ::EntityId entityId) const override |
|
AZ::EntityId | GetLevelInstanceContainerEntityId () const override |
|
AZ::IO::Path | GetOwningInstancePrefabPath (AZ::EntityId entityId) const override |
|
PrefabRequestResult | HasUnsavedChanges (AZ::IO::Path prefabFilePath) const override |
|
PrefabOperationResult | DeleteEntitiesAndAllDescendantsInInstance (const EntityIdList &entityIds) override |
|
DuplicatePrefabResult | DuplicateEntitiesInInstance (const EntityIdList &entityIds) override |
|
PrefabOperationResult | DetachPrefab (const AZ::EntityId &containerEntityId) override |
|
PrefabOperationResult | DetachPrefabAndRemoveContainerEntity (const AZ::EntityId &containerEntityId) override |
|
| AZ_RTTI (PrefabPublicInterface, "{931AAE9D-C775-4818-9070-A2DA69489CBE}") |
|
◆ CreateEntity()
PrefabEntityResult AzToolsFramework::Prefab::PrefabPublicHandler::CreateEntity |
( |
AZ::EntityId |
parentId, |
|
|
const AZ::Vector3 & |
position |
|
) |
| |
|
overridevirtual |
Creates a new entity under the entity with id 'parentId' and propagates a change to the template of the owning instance of parentId.
- Parameters
-
parentId | The id of the parent entity to parent the newly added entity under. |
position | The transform position of the entity being added. |
- Returns
- Returns the entityId of the newly created entity, or an error message if the operation failed.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ CreatePrefabAndSaveToDisk()
CreatePrefabResult AzToolsFramework::Prefab::PrefabPublicHandler::CreatePrefabAndSaveToDisk |
( |
const EntityIdList & |
entityIds, |
|
|
AZ::IO::PathView |
filePath |
|
) |
| |
|
overridevirtual |
Create a prefab out of the entities provided, at the path provided, and save it in disk immediately. Automatically detects descendants of entities, and discerns between entities and child instances. Note: It calls CreatePrefabInMemory internally and then saves the new template in disk.
- Parameters
-
entityIds | The entities that should form the new prefab (along with their descendants). |
filePath | The absolute path for the new prefab file. |
- Returns
- An outcome object with an entityId of the new prefab's container entity; on failure, it comes with an error message detailing the cause of the error.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ CreatePrefabInDisk()
CreatePrefabResult AzToolsFramework::Prefab::PrefabPublicHandler::CreatePrefabInDisk |
( |
const EntityIdList & |
entityIds, |
|
|
AZ::IO::PathView |
filePath |
|
) |
| |
|
overridevirtual |
◆ CreatePrefabInMemory()
CreatePrefabResult AzToolsFramework::Prefab::PrefabPublicHandler::CreatePrefabInMemory |
( |
const EntityIdList & |
entityIds, |
|
|
AZ::IO::PathView |
filePath |
|
) |
| |
|
overridevirtual |
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. Note: The newly created prefab template cannot be undo/redo. Undo will not remove the templace in system.
- Parameters
-
entityIds | The entities that should form the new prefab (along with their descendants). |
filePath | The absolute path for the new prefab file. |
- Returns
- An outcome object with an entityId of the new prefab's container entity; on failure, it comes with an error message detailing the cause of the error.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ DeleteEntitiesAndAllDescendantsInInstance()
PrefabOperationResult AzToolsFramework::Prefab::PrefabPublicHandler::DeleteEntitiesAndAllDescendantsInInstance |
( |
const EntityIdList & |
entityIds | ) |
|
|
overridevirtual |
Deletes all entities and their descendants from the owning instance. Bails if the entities don't all belong to the same instance.
- Parameters
-
entities | The entities to delete. Their descendants will be discovered by this function. |
- Returns
- An outcome object; on failure, it comes with an error message detailing the cause of the error.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ DetachPrefab()
PrefabOperationResult AzToolsFramework::Prefab::PrefabPublicHandler::DetachPrefab |
( |
const AZ::EntityId & |
containerEntityId | ) |
|
|
overridevirtual |
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. Note that this function retains the container entities, unlike the below function DetachPrefabAndRemoveContainerEntity.
- Parameters
-
containerEntityId | The container entity id of the instance to detach. |
- Returns
- An outcome object; on failure, it comes with an error message detailing the cause of the error.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ DetachPrefabAndRemoveContainerEntity()
PrefabOperationResult AzToolsFramework::Prefab::PrefabPublicHandler::DetachPrefabAndRemoveContainerEntity |
( |
const AZ::EntityId & |
containerEntityId | ) |
|
|
overridevirtual |
Does the same thing as DetachPrefab, but also removes the container entity representing the prefab instance. This re-parents anything that used to be a child of the container entity to the container entity's parent. This operation is essentially the reverse of what happens when you create a prefab (which creates a new container entity and re-parents the entities under it. Note that the previous API only had "DetachPrefab", which kept the container entities, and by way of introducing as little risk a possible in an API change, the old function retains its original behavior and name.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ DuplicateEntitiesInInstance()
DuplicatePrefabResult AzToolsFramework::Prefab::PrefabPublicHandler::DuplicateEntitiesInInstance |
( |
const EntityIdList & |
entityIds | ) |
|
|
overridevirtual |
Duplicates all entities in the owning instance. Bails if the entities don't all belong to the same instance.
- Parameters
-
entities | The entities to duplicate. |
- Returns
- An outcome object with a list of ids of target entities' duplicates if duplication succeeded; on failure, it comes with an error message detailing the cause of the error.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ EntitiesBelongToSameInstance()
bool AzToolsFramework::Prefab::PrefabPublicHandler::EntitiesBelongToSameInstance |
( |
const EntityIdList & |
entityIds | ) |
const |
|
virtual |
Detects if a list of entities are under the same instance. The instance of a container entity is special cased to be the parent instance of its instance.
- Parameters
-
entityIds | The list of entities to query. |
- Returns
- True if all entities in the list have the same instance, false otherwise.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ GenerateUndoNodesForEntityChangeAndUpdateCache()
PrefabOperationResult AzToolsFramework::Prefab::PrefabPublicHandler::GenerateUndoNodesForEntityChangeAndUpdateCache |
( |
AZ::EntityId |
entityId, |
|
|
UndoSystem::URSequencePoint * |
parentUndoBatch |
|
) |
| |
|
overridevirtual |
Store the changes between the current entity state and its last cached state into undo/redo commands. These changes are stored as patches to the owning prefab instance template, as appropriate. The function also triggers the redo() of the nodes it creates, triggering propagation on the next tick.
- Parameters
-
entityId | The entity to patch. |
parentUndoBatch | The undo batch the undo nodes should be parented to. |
- Returns
- Returns Success if the node was generated correctly, or an error message otherwise.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ GetInstanceContainerEntityId()
AZ::EntityId AzToolsFramework::Prefab::PrefabPublicHandler::GetInstanceContainerEntityId |
( |
AZ::EntityId |
entityId | ) |
const |
|
overridevirtual |
Gets the entity id for the instance container of the owning instance.
- Parameters
-
entityId | The id of the entity to query. |
- Returns
- The entity id of the instance container owning the queried entity.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ GetLevelInstanceContainerEntityId()
AZ::EntityId AzToolsFramework::Prefab::PrefabPublicHandler::GetLevelInstanceContainerEntityId |
( |
| ) |
const |
|
overridevirtual |
◆ GetOwningInstancePrefabPath()
AZ::IO::Path AzToolsFramework::Prefab::PrefabPublicHandler::GetOwningInstancePrefabPath |
( |
AZ::EntityId |
entityId | ) |
const |
|
overridevirtual |
Get the file path to the prefab file for the prefab instance owning the entity provided.
- Parameters
-
entityId | The id for the entity being queried. |
- Returns
- Returns the path to the prefab, or an empty path if the entity is owned by the level.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ HasUnsavedChanges()
PrefabRequestResult AzToolsFramework::Prefab::PrefabPublicHandler::HasUnsavedChanges |
( |
AZ::IO::Path |
prefabFilePath | ) |
const |
|
overridevirtual |
Gets whether the prefab has unsaved changes.
- Parameters
-
filePath | The path to the prefab to query. |
- Returns
- Returns true if the prefab has unsaved changes, false otherwise. If path is invalid, returns an error message.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ InstantiatePrefab() [1/2]
InstantiatePrefabResult AzToolsFramework::Prefab::PrefabPublicHandler::InstantiatePrefab |
( |
AZStd::string_view |
filePath, |
|
|
AZ::EntityId |
parentId, |
|
|
const AZ::Transform & |
transform |
|
) |
| |
|
overridevirtual |
Instantiate a prefab from a prefab file.
- Parameters
-
filePath | The path to the prefab file to instantiate. |
parentId | The entity id the prefab should be a child of in the transform hierarchy. |
transform | The transform in world space the prefab should be instantiated in. |
- Returns
- An outcome object with an entityId of the new prefab's container entity; on failure, it comes with an error message detailing the cause of the error.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ InstantiatePrefab() [2/2]
InstantiatePrefabResult AzToolsFramework::Prefab::PrefabPublicHandler::InstantiatePrefab |
( |
AZStd::string_view |
filePath, |
|
|
AZ::EntityId |
parentId, |
|
|
const AZ::Vector3 & |
position |
|
) |
| |
|
overridevirtual |
Instantiate a prefab from a prefab file.
- Parameters
-
filePath | The path to the prefab file to instantiate. |
parentId | The entity id the prefab should be a child of in the transform hierarchy. |
position | The position in world space the prefab should be instantiated in. |
- Returns
- An outcome object with an entityId of the new prefab's container entity; on failure, it comes with an error message detailing the cause of the error.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ IsInstanceContainerEntity()
bool AzToolsFramework::Prefab::PrefabPublicHandler::IsInstanceContainerEntity |
( |
AZ::EntityId |
entityId | ) |
const |
|
overridevirtual |
Detects if an entity is the container entity for its owning prefab instance.
- Parameters
-
entityId | The entity to query. |
- Returns
- True if the entity is the container entity for its owning prefab instance, false otherwise.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ IsLevelInstanceContainerEntity()
bool AzToolsFramework::Prefab::PrefabPublicHandler::IsLevelInstanceContainerEntity |
( |
AZ::EntityId |
entityId | ) |
const |
|
overridevirtual |
Detects if an entity is the container entity for the level prefab instance.
- Parameters
-
entityId | The entity to query. |
- Returns
- True if the entity is the container entity for the level prefab instance, false otherwise.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ IsOwnedByPrefabInstance()
bool AzToolsFramework::Prefab::PrefabPublicHandler::IsOwnedByPrefabInstance |
( |
AZ::EntityId |
entityId | ) |
const |
|
overridevirtual |
◆ IsOwnedByProceduralPrefabInstance()
bool AzToolsFramework::Prefab::PrefabPublicHandler::IsOwnedByProceduralPrefabInstance |
( |
AZ::EntityId |
entityId | ) |
const |
|
overridevirtual |
Detects if an entity is owned by a procedural prefab.
- Parameters
-
entityId | The entity to query. |
- Returns
- True if the entity is owned by a procedural prefab instance, false otherwise.
Implements AzToolsFramework::Prefab::PrefabPublicInterface.
◆ SavePrefab()
PrefabOperationResult AzToolsFramework::Prefab::PrefabPublicHandler::SavePrefab |
( |
AZ::IO::Path |
filePath | ) |
|
|
overridevirtual |
The documentation for this class was generated from the following file:
- Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h