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:
@@ -77,6 +77,16 @@ namespace AZ
|
||||
const AZStd::shared_ptr<PassTemplate> GetPassTemplate(const Name& name) const;
|
||||
const AZStd::vector<Pass*>& GetPassesForTemplate(const Name& templateName) const;
|
||||
|
||||
//! Removes a PassTemplate by name, only if the following two conditions are met:
|
||||
//! 1- The template was NOT created from an Asset. This means the template will be erasable
|
||||
//! only if it was created at runtime with C++.
|
||||
//! 2- The are no instantiated Passes referencing such template.
|
||||
//! If the template exists but both conditions are not met then the function will assert.
|
||||
//! If a template with the given name doesn't exist the function does nothing.
|
||||
//! This function should be used judiciously, and under rare circumstances. For example,
|
||||
//! Applications that iteratively create and need to delete templates at runtime.
|
||||
void RemovePassTemplate(const Name& name);
|
||||
|
||||
//! Removes a pass from both it's associated template (if it has one) and from the pass name mapping
|
||||
void RemovePassFromLibrary(Pass* pass);
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ namespace AZ
|
||||
bool HasPassesForTemplateName(const Name& templateName) const override;
|
||||
bool AddPassTemplate(const Name& name, const AZStd::shared_ptr<PassTemplate>& passTemplate) override;
|
||||
const AZStd::shared_ptr<PassTemplate> GetPassTemplate(const Name& name) const override;
|
||||
void RemovePassTemplate(const Name& name) override;
|
||||
void RemovePassFromLibrary(Pass* pass) override;
|
||||
void RegisterPass(Pass* pass) override;
|
||||
void UnregisterPass(Pass* pass) override;
|
||||
|
||||
@@ -199,6 +199,9 @@ namespace AZ
|
||||
//! Retrieves a PassTemplate from the library
|
||||
virtual const AZStd::shared_ptr<PassTemplate> GetPassTemplate(const Name& name) const = 0;
|
||||
|
||||
//! See remarks in PassLibrary.h for the function with this name.
|
||||
virtual void RemovePassTemplate(const Name& name) = 0;
|
||||
|
||||
//! Removes all references to the given pass from the pass library
|
||||
virtual void RemovePassFromLibrary(Pass* pass) = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user