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::PrefabLoaderInterface Class Referenceabstract

#include <PrefabLoaderInterface.h>

Inherited by AzToolsFramework::Prefab::PrefabLoader.

Public Member Functions

 AZ_RTTI (PrefabLoaderInterface, "{C7B26070-B1BE-470C-BE5A-45B0CF112E68}")
 
virtual TemplateId LoadTemplateFromFile (AZ::IO::PathView filePath)=0
 
virtual TemplateId LoadTemplateFromString (AZStd::string_view content, AZ::IO::PathView originPath=GeneratePath())=0
 
virtual bool SaveTemplate (TemplateId templateId)=0
 
virtual bool SaveTemplateToFile (TemplateId templateId, AZ::IO::PathView absolutePath)=0
 
virtual bool SaveTemplateToString (TemplateId templateId, AZStd::string &outputJson)=0
 
virtual AZ::IO::Path GetFullPath (AZ::IO::PathView path)=0
 
virtual AZ::IO::Path GenerateRelativePath (AZ::IO::PathView path)=0
 
virtual SaveAllPrefabsPreference GetSaveAllPrefabsPreference () const =0
 
virtual void SetSaveAllPrefabsPreference (SaveAllPrefabsPreference saveAllPrefabsPreference)=0
 

Static Protected Member Functions

static AZ::IO::Path GeneratePath ()
 

Detailed Description

PrefabLoaderInterface Interface for saving/loading Prefab files.

Member Function Documentation

◆ GenerateRelativePath()

virtual AZ::IO::Path AzToolsFramework::Prefab::PrefabLoaderInterface::GenerateRelativePath ( AZ::IO::PathView  path)
pure virtual

Converts path into a path that's relative to the highest-priority containing folder of all the folders registered with the engine. This path will be the path that appears in the .prefab file. The path will always use the '/' separator.

Implemented in AzToolsFramework::Prefab::PrefabLoader.

◆ GetFullPath()

virtual AZ::IO::Path AzToolsFramework::Prefab::PrefabLoaderInterface::GetFullPath ( AZ::IO::PathView  path)
pure virtual

Converts path into full absolute path. This will be used by loading/save IO operations. The path will always have the correct separator for the current OS

Implemented in AzToolsFramework::Prefab::PrefabLoader.

◆ LoadTemplateFromFile()

virtual TemplateId AzToolsFramework::Prefab::PrefabLoaderInterface::LoadTemplateFromFile ( AZ::IO::PathView  filePath)
pure virtual

Load Prefab Template from given file path to memory and return the id of loaded Template. Converts Prefab Asset form into Prefab Template form by expanding source path and patch info into fully formed nested template info.

Parameters
filePathA Prefab Template file path.
Returns
A unique id of Template on filePath loaded. Return invalid template id if loading Template on filePath failed.

Implemented in AzToolsFramework::Prefab::PrefabLoader.

◆ LoadTemplateFromString()

virtual TemplateId AzToolsFramework::Prefab::PrefabLoaderInterface::LoadTemplateFromString ( AZStd::string_view  content,
AZ::IO::PathView  originPath = GeneratePath() 
)
pure virtual

Load Prefab Template from given content string to memory and return the id of loaded Template. Converts .prefab form into Prefab Template form by expanding source path and patch info into fully formed nested template info.

Parameters
contentJson content of the prefab
originPathPath that will be used for the prefab in case of saved into a file.
Returns
A unique id of Template on filePath loaded. Return invalid template id if loading Template on filePath failed.

Implemented in AzToolsFramework::Prefab::PrefabLoader.

◆ SaveTemplate()

virtual bool AzToolsFramework::Prefab::PrefabLoaderInterface::SaveTemplate ( TemplateId  templateId)
pure virtual

Saves a Prefab Template to the the source path registered with the template. Converts Prefab Template form into Prefab Asset form by collapsing nested Template info into a source path and patches.

Parameters
templateIdId of the template to be saved
Returns
bool on whether the operation succeeded or not

Implemented in AzToolsFramework::Prefab::PrefabLoader.

◆ SaveTemplateToFile()

virtual bool AzToolsFramework::Prefab::PrefabLoaderInterface::SaveTemplateToFile ( TemplateId  templateId,
AZ::IO::PathView  absolutePath 
)
pure virtual

Saves a Prefab Template to the provided absolute source path, which needs to match the relative path in the template. Converts Prefab Template form into .prefab form by collapsing nested Template info into a source path and patches.

Parameters
templateIdId of the template to be saved
absolutePathAbsolute path to save the file to
Returns
bool on whether the operation succeeded or not

Implemented in AzToolsFramework::Prefab::PrefabLoader.

◆ SaveTemplateToString()

virtual bool AzToolsFramework::Prefab::PrefabLoaderInterface::SaveTemplateToString ( TemplateId  templateId,
AZStd::string &  outputJson 
)
pure virtual

Saves a Prefab Template into the provided output string. Converts Prefab Template form into .prefab form by collapsing nested Template info into a source path and patches.

Parameters
templateIdId of the template to be saved
outputJsonWill contain the serialized template json on success
Returns
bool on whether the operation succeeded or not

Implemented in AzToolsFramework::Prefab::PrefabLoader.


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