#include <PrefabLoader.h>
Inherits AzToolsFramework::Prefab::PrefabLoaderInterface.
|
| AZ_CLASS_ALLOCATOR (PrefabLoader, AZ::SystemAllocator) |
|
| AZ_RTTI (PrefabLoader, "{A302B072-4DC4-4B7E-9188-226F56A3429C}", PrefabLoaderInterface) |
|
TemplateId | LoadTemplateFromFile (AZ::IO::PathView filePath) override |
|
void | ReloadTemplateFromFile (AZ::IO::PathView relativePath) |
|
TemplateId | LoadTemplateFromString (AZStd::string_view content, AZ::IO::PathView originPath=GeneratePath()) override |
|
bool | SaveTemplate (TemplateId templateId) override |
|
bool | SaveTemplateToFile (TemplateId templateId, AZ::IO::PathView absolutePath) override |
|
bool | SaveTemplateToString (TemplateId templateId, AZStd::string &outputJson) override |
|
void | RegisterPrefabLoaderInterface () |
|
void | UnregisterPrefabLoaderInterface () |
|
AZ::IO::Path | GetFullPath (AZ::IO::PathView path) override |
|
AZ::IO::Path | GenerateRelativePath (AZ::IO::PathView path) override |
|
SaveAllPrefabsPreference | GetSaveAllPrefabsPreference () const override |
|
void | SetSaveAllPrefabsPreference (SaveAllPrefabsPreference saveAllPrefabsPreference) override |
|
| 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 void | Reflect (AZ::ReflectContext *context) |
|
static bool | IsValidPrefabPath (AZ::IO::PathView path) |
| Returns if the path is a valid path for a prefab.
|
|
|
static AZ::IO::Path | GeneratePath () |
|
The Prefab Loader helps saving/loading Prefab files.
◆ GenerateRelativePath()
AZ::IO::Path AzToolsFramework::Prefab::PrefabLoader::GenerateRelativePath |
( |
AZ::IO::PathView |
path | ) |
|
|
overridevirtual |
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.
Implements AzToolsFramework::Prefab::PrefabLoaderInterface.
◆ GetFullPath()
AZ::IO::Path AzToolsFramework::Prefab::PrefabLoader::GetFullPath |
( |
AZ::IO::PathView |
path | ) |
|
|
overridevirtual |
◆ GetSaveAllPrefabsPreference()
SaveAllPrefabsPreference AzToolsFramework::Prefab::PrefabLoader::GetSaveAllPrefabsPreference |
( |
| ) |
const |
|
overridevirtual |
◆ LoadTemplateFromFile()
TemplateId AzToolsFramework::Prefab::PrefabLoader::LoadTemplateFromFile |
( |
AZ::IO::PathView |
filePath | ) |
|
|
overridevirtual |
◆ LoadTemplateFromString()
TemplateId AzToolsFramework::Prefab::PrefabLoader::LoadTemplateFromString |
( |
AZStd::string_view |
content, |
|
|
AZ::IO::PathView |
originPath = GeneratePath() |
|
) |
| |
|
overridevirtual |
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
-
content | Json content of the prefab |
originPath | Path 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.
Implements AzToolsFramework::Prefab::PrefabLoaderInterface.
◆ ReloadTemplateFromFile()
void AzToolsFramework::Prefab::PrefabLoader::ReloadTemplateFromFile |
( |
AZ::IO::PathView |
relativePath | ) |
|
Reloads Prefab Template from given file path and updates values that are changed in the source file.
- Parameters
-
relativePath | A Prefab Template relative file path. |
◆ SaveTemplate()
bool AzToolsFramework::Prefab::PrefabLoader::SaveTemplate |
( |
TemplateId |
templateId | ) |
|
|
overridevirtual |
Saves a Prefab Template to the the source path registered with the template. Converts Prefab Template form into .prefab form by collapsing nested Template info into a source path and patches.
- Parameters
-
templateId | Id of the template to be saved |
- Returns
- bool on whether the operation succeeded or not
Implements AzToolsFramework::Prefab::PrefabLoaderInterface.
◆ SaveTemplateToFile()
bool AzToolsFramework::Prefab::PrefabLoader::SaveTemplateToFile |
( |
TemplateId |
templateId, |
|
|
AZ::IO::PathView |
absolutePath |
|
) |
| |
|
overridevirtual |
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
-
templateId | Id of the template to be saved |
absolutePath | Absolute path to save the file to |
- Returns
- bool on whether the operation succeeded or not
Implements AzToolsFramework::Prefab::PrefabLoaderInterface.
◆ SaveTemplateToString()
bool AzToolsFramework::Prefab::PrefabLoader::SaveTemplateToString |
( |
TemplateId |
templateId, |
|
|
AZStd::string & |
outputJson |
|
) |
| |
|
overridevirtual |
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
-
templateId | Id of the template to be saved |
outputJson | Will contain the serialized template json on success |
- Returns
- bool on whether the operation succeeded or not
Implements AzToolsFramework::Prefab::PrefabLoaderInterface.
◆ SetSaveAllPrefabsPreference()
void AzToolsFramework::Prefab::PrefabLoader::SetSaveAllPrefabsPreference |
( |
SaveAllPrefabsPreference |
saveAllPrefabsPreference | ) |
|
|
overridevirtual |
The documentation for this class was generated from the following file:
- Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabLoader.h