Commit: ae7909010fba2605af1b7f32b5574df3381d4d3f Author: Mangal Kushwah Date: Mon Aug 22 08:36:04 2022 +0200 Branches: master https://developer.blender.org/rBae7909010fba2605af1b7f32b5574df3381d4d3f
Fix T99259: Python API: ViewLayer.aovs.remove isn't available Imeplemented **ViewLayer.aovs.remove** by Adding a new rna function to call the internal **BKE_view_layer_remove_aov**, removed assert from **BKE_view_layer_remove_aov**. Reviewed By: jbakker Maniphest Tasks: T99259 Differential Revision: https://developer.blender.org/D15341 =================================================================== M source/blender/blenkernel/intern/layer.c M source/blender/makesrna/intern/rna_scene.c =================================================================== diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 4257bccad93..c5e9ec28f7b 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -2432,8 +2432,12 @@ struct ViewLayerAOV *BKE_view_layer_add_aov(struct ViewLayer *view_layer) void BKE_view_layer_remove_aov(ViewLayer *view_layer, ViewLayerAOV *aov) { - BLI_assert(BLI_findindex(&view_layer->aovs, aov) != -1); + if (BLI_findindex(&view_layer->aovs, aov) == -1) { + return; + } + BLI_assert(aov != NULL); + if (view_layer->active_aov == aov) { if (aov->next) { viewlayer_aov_active_set(view_layer, aov->next); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 720b115c73b..628a616fe03 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -4256,6 +4256,13 @@ 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"); + RNA_def_function_ui_description(func, "Remove a AOV"); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS | FUNC_USE_SELF_ID); + parm = RNA_def_pointer(func, "aov", "AOV", "", "AOVs to remove"); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); + RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); } static void rna_def_view_layer_aov(BlenderRNA *brna) _______________________________________________ Bf-blender-cvs mailing list [email protected] List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs
