Added a PrefabDocument for Prefab to simplify working with Prefabs during conversion to spawnables.
The new PrefabDocument handles the Prefab and the Instance. This reduces the number of times the Instance has to be reloaded from the Prefab and keeps the entity ids stable between steps. The intention is for all the PrefabDocument to conceptually manipulate the Prefab DOM, although behind the scenes it will manipulate the Instance for now. The Instance should only be directly used in case the PrefabDocument doesn't provide the functionality yet. Signed-off-by: AMZN-koppersr <82230785+AMZN-koppersr@users.noreply.github.com>
This commit is contained in:
@@ -237,7 +237,7 @@ namespace AZ::Prefab
|
||||
|
||||
bool PrefabBuilderComponent::ProcessPrefab(
|
||||
const AZ::PlatformTagSet& platformTags, const char* filePath, AZ::IO::PathView tempDirPath, const AZ::Uuid& sourceFileUuid,
|
||||
AzToolsFramework::Prefab::PrefabDom& mutableRootDom, AZStd::vector<AssetBuilderSDK::JobProduct>& jobProducts)
|
||||
AzToolsFramework::Prefab::PrefabDom&& rootDom, AZStd::vector<AssetBuilderSDK::JobProduct>& jobProducts)
|
||||
{
|
||||
AzToolsFramework::Prefab::PrefabConversionUtils::PrefabProcessorContext context(sourceFileUuid);
|
||||
AZStd::string rootPrefabName;
|
||||
@@ -247,7 +247,9 @@ namespace AZ::Prefab
|
||||
filePath);
|
||||
return false;
|
||||
}
|
||||
context.AddPrefab(AZStd::move(rootPrefabName), AZStd::move(mutableRootDom));
|
||||
AzToolsFramework::Prefab::PrefabConversionUtils::PrefabDocument rootDocument(AZStd::move(rootPrefabName));
|
||||
rootDocument.SetPrefabDom(AZStd::move(rootDom));
|
||||
context.AddPrefab(AZStd::move(rootDocument));
|
||||
|
||||
context.SetPlatformTags(AZStd::move(platformTags));
|
||||
|
||||
@@ -319,8 +321,8 @@ namespace AZ::Prefab
|
||||
});
|
||||
|
||||
if (ProcessPrefab(
|
||||
platformTags, request.m_fullPath.c_str(), request.m_tempDirPath.c_str(), request.m_sourceFileUUID, mutableRootDom,
|
||||
response.m_outputProducts))
|
||||
platformTags, request.m_fullPath.c_str(), request.m_tempDirPath.c_str(), request.m_sourceFileUUID,
|
||||
AZStd::move(mutableRootDom), response.m_outputProducts))
|
||||
{
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace AZ::Prefab
|
||||
const AzToolsFramework::Prefab::PrefabDom& genericDocument);
|
||||
bool ProcessPrefab(
|
||||
const AZ::PlatformTagSet& platformTags, const char* filePath, AZ::IO::PathView tempDirPath, const AZ::Uuid& sourceFileUuid,
|
||||
AzToolsFramework::Prefab::PrefabDom& mutableRootDom,
|
||||
AzToolsFramework::Prefab::PrefabDom&& rootDom,
|
||||
AZStd::vector<AssetBuilderSDK::JobProduct>& jobProducts);
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user