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

Classes

struct  PrefabOverrideMetadata
 

Public Member Functions

 AZ_CLASS_ALLOCATOR (Link, AZ::SystemAllocator)
 
 AZ_RTTI (Link, "{49230756-7BAA-4456-8DFE-0E18CB887DB5}")
 
 Link (LinkId linkId)
 
 Link (const Link &other)=delete
 
Linkoperator= (const Link &other)=delete
 
 Link (Link &&other) noexcept
 
Linkoperator= (Link &&other) noexcept
 
void SetSourceTemplateId (TemplateId id)
 
void SetTargetTemplateId (TemplateId id)
 
void SetLinkDom (const PrefabDomValue &linkDom)
 
void SetLinkPatches (const PrefabDom &patches)
 
void SetInstanceName (const char *instanceName)
 
bool IsValid () const
 
TemplateId GetSourceTemplateId () const
 
TemplateId GetTargetTemplateId () const
 
LinkId GetId () const
 
void GetLinkPatches (PrefabDomValue &patchesDom, PrefabDomAllocator &allocator) const
 
void GetLinkDom (PrefabDomValue &linkDom, PrefabDomAllocator &allocator) const
 
bool AreOverridesPresent (AZ::Dom::Path path, AZ::Dom::PrefixTreeTraversalFlags prefixTreeTraversalFlags=AZ::Dom::PrefixTreeTraversalFlags::ExcludeParentPaths) const
 
PrefabDomConstReference GetOverridePatchAtExactPath (AZ::Dom::Path path) const
 
AZ::Dom::DomPrefixTree< PrefabOverrideMetadataRemoveOverrides (AZ::Dom::Path path)
 
bool AddOverrides (const AZ::Dom::Path &path, AZ::Dom::DomPrefixTree< PrefabOverrideMetadata > &&subTree)
 
void AddOverrides (const PrefabDomValue &patches)
 
PrefabDomPath GetInstancePath () const
 
const AZStd::string & GetInstanceName () const
 
bool UpdateTarget ()
 
PrefabDomValue & GetLinkedInstanceDom ()
 
void AddLinkIdToInstanceDom (PrefabDomValue &instanceDomValue)
 

Member Function Documentation

◆ AddLinkIdToInstanceDom()

void AzToolsFramework::Prefab::Link::AddLinkIdToInstanceDom ( PrefabDomValue &  instanceDomValue)

Adds a linkId name,value object to the DOM of an instance.

Parameters
instanceDomValueThe DOM value of the instance within the target template DOM.

◆ AddOverrides() [1/2]

bool AzToolsFramework::Prefab::Link::AddOverrides ( const AZ::Dom::Path &  path,
AZ::Dom::DomPrefixTree< PrefabOverrideMetadata > &&  subTree 
)

Adds overrides at the provided path by attaching the provided subtree representing new overrides

Parameters
pathThe path at which new overrides should be added
subTreeThe tree representing the new overrides to be added
Returns
Whether the overrides are successfully added or not.

◆ AddOverrides() [2/2]

void AzToolsFramework::Prefab::Link::AddOverrides ( const PrefabDomValue &  patches)

Adds overrides patches to the tree. It can be used to add patches to tree for an entity.

Parameters
patchesThe override patches that will be added to tree.

◆ AreOverridesPresent()

bool AzToolsFramework::Prefab::Link::AreOverridesPresent ( AZ::Dom::Path  path,
AZ::Dom::PrefixTreeTraversalFlags  prefixTreeTraversalFlags = AZ::Dom::PrefixTreeTraversalFlags::ExcludeParentPaths 
) const

Checks whether overrides are present by querying the patches tree with the provided path

Parameters
pathThe path to query the overrides tree with.
prefixTreeTraversalFlagsThe traversal flags for the prefix tree. The default is to exclude parent paths because we usually check for overrides on one or more components/properties within an entity.
Returns
true if overrides are present at the provided path.

◆ GetLinkDom()

void AzToolsFramework::Prefab::Link::GetLinkDom ( PrefabDomValue &  linkDom,
PrefabDomAllocator &  allocator 
) const

Populates the link DOM provided with 'Source' and 'Patches' fields. 'Patches' are fetched from 'm_linkPatchesTree'.

Parameters
[out]linkDomThe DOM to populate with source and patches information.
allocatorThe allocator to use for memory allocations of patches.

◆ GetLinkedInstanceDom()

PrefabDomValue & AzToolsFramework::Prefab::Link::GetLinkedInstanceDom ( )

Get the DOM of the instance that the link points to.

Returns
The DOM of the linked instance

◆ GetLinkPatches()

void AzToolsFramework::Prefab::Link::GetLinkPatches ( PrefabDomValue &  patchesDom,
PrefabDomAllocator &  allocator 
) const

Populates the patches DOM provided with the patches fetched from 'm_linkPatchesTree'

Parameters
[out]patchesDomThe DOM to populate with patches
allocatorThe allocator to use for memory allocations of patches.

◆ GetOverridePatchAtExactPath()

PrefabDomConstReference AzToolsFramework::Prefab::Link::GetOverridePatchAtExactPath ( AZ::Dom::Path  path) const

Gets an override patch at the exact provided path

Parameters
pathThe path to get override for.
Returns
an override patch if an override is present at the exact provided path.

◆ RemoveOverrides()

AZ::Dom::DomPrefixTree< PrefabOverrideMetadata > AzToolsFramework::Prefab::Link::RemoveOverrides ( AZ::Dom::Path  path)

Removes overrides at the provided path and all the nodes under it from the override tree

Parameters
pathThe path at which the overrides should be removed from
Returns
The sub-tree representing the removed overrides.

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