libOverride: RNA API: Add option to make all overrides editable in `override_hierarchy_create`.

Request from Paul Golter (@paulgolter).
This commit is contained in:
Bastien Montagne 2022-11-17 12:18:58 +01:00
parent 841460afce
commit a67b33acd0
1 changed files with 21 additions and 4 deletions

View File

@ -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");