Changed parameter names to reflect the recursive nature of functions and some more changes
Signed-off-by: srikappa-amzn <srikappa@amazon.com>
This commit is contained in:
@@ -370,7 +370,7 @@ namespace AzToolsFramework
|
||||
PrefabDom& PrefabSystemComponent::FindTemplateDom(TemplateId templateId)
|
||||
{
|
||||
AZStd::optional<AZStd::reference_wrapper<Template>> findTemplateResult = FindTemplate(templateId);
|
||||
AZ_Assert(findTemplateResult.has_value(),
|
||||
AZ_Assert(false,
|
||||
"PrefabSystemComponent::FindTemplateDom - Unable to retrieve Prefab template with id: '%llu'. "
|
||||
"Template could not be found", templateId);
|
||||
|
||||
@@ -754,17 +754,17 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
bool PrefabSystemComponent::AreDirtyTemplatesPresent(TemplateId templateId)
|
||||
bool PrefabSystemComponent::AreDirtyTemplatesPresent(TemplateId rootTemplateId)
|
||||
{
|
||||
TemplateReference prefabTemplate = FindTemplate(templateId);
|
||||
TemplateReference prefabTemplate = FindTemplate(rootTemplateId);
|
||||
|
||||
if (!prefabTemplate.has_value())
|
||||
{
|
||||
AZ_Assert(false, "Template with id %llu is not found", templateId);
|
||||
AZ_Assert(false, "Template with id %llu is not found", rootTemplateId);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsTemplateDirty(templateId))
|
||||
if (IsTemplateDirty(rootTemplateId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -782,9 +782,9 @@ namespace AzToolsFramework
|
||||
return false;
|
||||
}
|
||||
|
||||
void PrefabSystemComponent::SaveAllDirtyTemplates(TemplateId templateId)
|
||||
void PrefabSystemComponent::SaveAllDirtyTemplates(TemplateId rootTemplateId)
|
||||
{
|
||||
AZStd::set<AZ::IO::PathView> dirtyTemplatePaths = GetDirtyTemplatePaths(templateId);
|
||||
AZStd::set<AZ::IO::PathView> dirtyTemplatePaths = GetDirtyTemplatePaths(rootTemplateId);
|
||||
|
||||
for (AZ::IO::PathView dirtyTemplatePath : dirtyTemplatePaths)
|
||||
{
|
||||
@@ -800,26 +800,27 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
AZStd::set<AZ::IO::PathView> PrefabSystemComponent::GetDirtyTemplatePaths(TemplateId templateId)
|
||||
AZStd::set<AZ::IO::PathView> PrefabSystemComponent::GetDirtyTemplatePaths(TemplateId rootTemplateId)
|
||||
{
|
||||
AZStd::vector<AZ::IO::PathView> dirtyTemplatePathVector;
|
||||
GetDirtyTemplatePathsHelper(templateId, dirtyTemplatePathVector);
|
||||
GetDirtyTemplatePathsHelper(rootTemplateId, dirtyTemplatePathVector);
|
||||
AZStd::set<AZ::IO::PathView> dirtyTemplatePaths;
|
||||
dirtyTemplatePaths.insert(dirtyTemplatePathVector.begin(), dirtyTemplatePathVector.end());
|
||||
return AZStd::move(dirtyTemplatePaths);
|
||||
}
|
||||
|
||||
void PrefabSystemComponent::GetDirtyTemplatePathsHelper(TemplateId templateId, AZStd::vector<AZ::IO::PathView>& dirtyTemplatePaths)
|
||||
void PrefabSystemComponent::GetDirtyTemplatePathsHelper(
|
||||
TemplateId rootTemplateId, AZStd::vector<AZ::IO::PathView>& dirtyTemplatePaths)
|
||||
{
|
||||
TemplateReference prefabTemplate = FindTemplate(templateId);
|
||||
TemplateReference prefabTemplate = FindTemplate(rootTemplateId);
|
||||
|
||||
if (!prefabTemplate.has_value())
|
||||
{
|
||||
AZ_Assert(false, "Template with id %llu is not found", templateId);
|
||||
AZ_Assert(false, "Template with id %llu is not found", rootTemplateId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsTemplateDirty(templateId))
|
||||
if (IsTemplateDirty(rootTemplateId))
|
||||
{
|
||||
dirtyTemplatePaths.emplace_back(prefabTemplate->get().GetFilePath());
|
||||
}
|
||||
|
||||
@@ -183,11 +183,11 @@ namespace AzToolsFramework
|
||||
*/
|
||||
void SetTemplateDirtyFlag(const TemplateId& templateId, bool dirty) override;
|
||||
|
||||
bool AreDirtyTemplatesPresent(TemplateId templateId) override;
|
||||
bool AreDirtyTemplatesPresent(TemplateId rootTemplateId) override;
|
||||
|
||||
void SaveAllDirtyTemplates(TemplateId templateId) override;
|
||||
void SaveAllDirtyTemplates(TemplateId rootTemplateId) override;
|
||||
|
||||
AZStd::set<AZ::IO::PathView> GetDirtyTemplatePaths(TemplateId parentTemplateId) override;
|
||||
AZStd::set<AZ::IO::PathView> GetDirtyTemplatePaths(TemplateId rootTemplateId) override;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -342,7 +342,7 @@ namespace AzToolsFramework
|
||||
bool RemoveLinkFromTargetTemplate(const LinkId& linkId, const Link& link);
|
||||
|
||||
// Helper function for GetDirtyTemplatePaths(). It uses vector to speed up iteration times.
|
||||
void GetDirtyTemplatePathsHelper(TemplateId parentTemplateId, AZStd::vector<AZ::IO::PathView>& dirtyTemplatePaths);
|
||||
void GetDirtyTemplatePathsHelper(TemplateId rootTemplateId, AZStd::vector<AZ::IO::PathView>& dirtyTemplatePaths);
|
||||
|
||||
// A container for mapping Templates to the Links they may propagate changes to.
|
||||
AZStd::unordered_map<TemplateId, AZStd::unordered_set<LinkId>> m_templateToLinkIdsMap;
|
||||
|
||||
+6
-6
@@ -52,17 +52,17 @@ namespace AzToolsFramework
|
||||
virtual void SetTemplateDirtyFlag(const TemplateId& templateId, bool dirty) = 0;
|
||||
|
||||
//! Recursive function to check if the template is dirty or if any dirty templates are presents in the links of the template.
|
||||
//! @param templateId The id of the template provided as the beginning template to check the outgoing links.
|
||||
virtual bool AreDirtyTemplatesPresent(TemplateId templateId) = 0;
|
||||
//! @param rootTemplateId The id of the template provided as the beginning template to check the outgoing links.
|
||||
virtual bool AreDirtyTemplatesPresent(TemplateId rootTemplateId) = 0;
|
||||
|
||||
//! Recursive function to save if the template is dirty and save all the dirty templates in the links of the template.
|
||||
//! @param templateId The id of the template provided as the beginning template to check the outgoing links.
|
||||
virtual void SaveAllDirtyTemplates(TemplateId templateId) = 0;
|
||||
//! @param rootTemplateId The id of the template provided as the beginning template to check the outgoing links.
|
||||
virtual void SaveAllDirtyTemplates(TemplateId rootTemplateId) = 0;
|
||||
|
||||
//! Recursive function that fetches the set of dirty templates given a starting template to check for outgoing links.
|
||||
//! @param templateId The id of the template provided as the beginning template to check the outgoing links.
|
||||
//! @param rootTemplateId The id of the template provided as the beginning template to check the outgoing links.
|
||||
//! @return The set of dirty template paths populated.
|
||||
virtual AZStd::set<AZ::IO::PathView> GetDirtyTemplatePaths(TemplateId parentTemplateId) = 0;
|
||||
virtual AZStd::set<AZ::IO::PathView> GetDirtyTemplatePaths(TemplateId rootTemplateId) = 0;
|
||||
|
||||
virtual PrefabDom& FindTemplateDom(TemplateId templateId) = 0;
|
||||
virtual void UpdatePrefabTemplate(TemplateId templateId, const PrefabDom& updatedDom) = 0;
|
||||
|
||||
Reference in New Issue
Block a user