Prefab Serialization | Remove "Source" parameter from prefab source file (#1387)
* When loading a template to memory, store the current Source (potentially overriding what was stored to disk) * Before storing the prefab disk, remove the Source parameter from the Dom (as it's no longer necessary to save it).
This commit is contained in:
@@ -151,6 +151,10 @@ namespace AzToolsFramework
|
||||
return InvalidTemplateId;
|
||||
}
|
||||
|
||||
// Add or replace the Source parameter in the dom
|
||||
PrefabDomPath sourcePath = PrefabDomPath((AZStd::string("/") + PrefabDomUtils::SourceName).c_str());
|
||||
sourcePath.Set(readPrefabFileResult.GetValue(), relativePath.Native().c_str());
|
||||
|
||||
// Create new Template with the Prefab DOM.
|
||||
TemplateId newTemplateId = m_prefabSystemComponentInterface->AddTemplate(relativePath, readPrefabFileResult.TakeValue());
|
||||
if (newTemplateId == InvalidTemplateId)
|
||||
|
||||
@@ -207,6 +207,10 @@ namespace AzToolsFramework
|
||||
instanceValue->CopyFrom(linkDom, m_prefabDom.GetAllocator());
|
||||
}
|
||||
|
||||
// Remove Source parameter from the dom. It will be added on file load, and should not be stored to disk.
|
||||
PrefabDomPath sourcePath = PrefabDomPath((AZStd::string("/") + PrefabDomUtils::SourceName).c_str());
|
||||
sourcePath.Erase(output);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user