From a67b33acd04ea4816a5ceab6d5b86f8af4d4928f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 17 Nov 2022 12:18:58 +0100 Subject: [PATCH] libOverride: RNA API: Add option to make all overrides editable in `override_hierarchy_create`. Request from Paul Golter (@paulgolter). --- source/blender/makesrna/intern/rna_ID.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index b2c57846a08..43ffabf24d5 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -720,8 +720,12 @@ static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages) return local_id; } -static ID *rna_ID_override_hierarchy_create( - ID *id, Main *bmain, Scene *scene, ViewLayer *view_layer, ID *id_instance_hint) +static ID *rna_ID_override_hierarchy_create(ID *id, + Main *bmain, + Scene *scene, + ViewLayer *view_layer, + ID *id_instance_hint, + bool do_fully_editable) { if (!ID_IS_OVERRIDABLE_LIBRARY(id)) { return NULL; @@ -735,8 +739,15 @@ static ID *rna_ID_override_hierarchy_create( BPy_BEGIN_ALLOW_THREADS; # endif - BKE_lib_override_library_create( - bmain, scene, view_layer, NULL, id, id, id_instance_hint, &id_root_override, false); + BKE_lib_override_library_create(bmain, + scene, + view_layer, + NULL, + id, + id, + id_instance_hint, + &id_root_override, + do_fully_editable); # ifdef WITH_PYTHON BPy_END_ALLOW_THREADS; @@ -2141,6 +2152,12 @@ static void rna_def_ID(BlenderRNA *brna) "", "Another ID (usually an Object or Collection) used as a hint to decide where to " "instantiate the new overrides"); + RNA_def_boolean(func, + "do_fully_editable", + false, + "", + "Make all library overrides generated by this call fully editable by the user " + "(none will be 'system overrides')"); func = RNA_def_function(srna, "override_template_create", "rna_ID_override_template_create"); RNA_def_function_ui_description(func, "Create an override template for this ID");