Python API: implement ViewLayer.aovs.remove

Implement ViewLayer.aovs.remove by adding a new RNA function to call
the internal BKE_view_layer_remove_aov.

Resolves #99259

Pull Request: https://projects.blender.org/blender/blender/pulls/105646
This commit is contained in:
Nischay-Raj
2023-03-13 17:29:19 +01:00
committed by Brecht Van Lommel
parent d3cfb2e20e
commit 08fd5747d2
2 changed files with 9 additions and 2 deletions

View File

@@ -2514,8 +2514,9 @@ ViewLayerAOV *BKE_view_layer_add_aov(ViewLayer *view_layer)
void BKE_view_layer_remove_aov(ViewLayer *view_layer, ViewLayerAOV *aov)
{
BLI_assert(BLI_findindex(&view_layer->aovs, aov) != -1);
BLI_assert(aov != nullptr);
if (aov == nullptr || BLI_findindex(&view_layer->aovs, aov) == -1) {
return;
}
if (view_layer->active_aov == aov) {
if (aov->next) {
viewlayer_aov_active_set(view_layer, aov->next);

View File

@@ -4294,6 +4294,12 @@ static void rna_def_view_layer_aovs(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "add", "BKE_view_layer_add_aov");
parm = RNA_def_pointer(func, "aov", "AOV", "", "Newly created AOV");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "remove", "BKE_view_layer_remove_aov");
parm = RNA_def_pointer(func, "aov", "AOV", "", "AOV to remove");
RNA_def_function_ui_description(func, "Remove an AOV");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_view_layer_aov(BlenderRNA *brna)