Added "RemovePassTemplate" method. (#5039)

* Added "RemovePassTemplate" method.

Signed-off-by: garrieta <garrieta@amazon.com>

* RemovePassTemplate only allows to remove PassTemplates
created with the Runtime API. It now asserts if there are Passes
referencing the PassTemplate that should be removed.

Signed-off-by: garrieta <garrieta@amazon.com>
This commit is contained in:
galibzon
2021-10-29 15:41:17 -05:00
committed by GitHub
parent 07353ed4ad
commit 0807cb7f3e
5 changed files with 32 additions and 0 deletions
@@ -236,6 +236,19 @@ namespace AZ
return true;
}
void PassLibrary::RemovePassTemplate(const Name& name)
{
auto itr = m_templateEntries.find(name);
if (itr != m_templateEntries.end())
{
AZ_Assert(itr->second.m_passes.empty(), "Can not delete PassTemplate '%s' because there are %zu Passes referencing it",
name.GetCStr(), itr->second.m_passes.size());
AZ_Assert(!itr->second.m_mappingAssetId.IsValid(), "Can not delete PassTemplate '%s' because it was created from an asset",
name.GetCStr());
m_templateEntries.erase(itr);
}
}
void PassLibrary::RemovePassFromLibrary(Pass* pass)
{
if (m_isShuttingDown)