Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_ID.c')
-rw-r--r--source/blender/makesrna/intern/rna_ID.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 2818f251085..43b65b087bf 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -608,9 +608,29 @@ static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages)
if (remap_local_usages) {
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
}
+
+ WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
+
return local_id;
}
+static ID *rna_ID_override_hierarchy_create(
+ ID *id, Main *bmain, Scene *scene, ViewLayer *view_layer, ID *id_reference)
+{
+ if (!ID_IS_OVERRIDABLE_LIBRARY(id)) {
+ return NULL;
+ }
+
+ BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
+
+ ID *id_root_override = NULL;
+ BKE_lib_override_library_create(bmain, scene, view_layer, id, id_reference, &id_root_override);
+
+ WM_main_add_notifier(NC_ID | NA_ADDED, NULL);
+
+ return id_root_override;
+}
+
static void rna_ID_override_template_create(ID *id, ReportList *reports)
{
if (!U.experimental.use_override_templates) {
@@ -1760,6 +1780,30 @@ static void rna_def_ID(BlenderRNA *brna)
"Whether local usages of the linked ID should be remapped to the new "
"library override of it");
+ func = RNA_def_function(srna, "override_hierarchy_create", "rna_ID_override_hierarchy_create");
+ RNA_def_function_ui_description(
+ func,
+ "Create an overridden local copy of this linked data-block, and most of its dependencies "
+ "when it is a Collection or and Object");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the root ID");
+ RNA_def_function_return(func, parm);
+ parm = RNA_def_pointer(
+ func, "scene", "Scene", "", "In which scene the new overrides should be instantiated");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func,
+ "view_layer",
+ "ViewLayer",
+ "",
+ "In which view layer the new overrides should be instantiated");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_pointer(func,
+ "reference",
+ "ID",
+ "",
+ "Another ID (usually an Object or Collection) used to decide where to "
+ "instantiate the new 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");
RNA_def_function_flag(func, FUNC_USE_REPORTS);