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:
authorBastien Montagne <montagne29@wanadoo.fr>2019-09-05 17:41:35 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-09-05 22:31:00 +0300
commit8622849beb964536d39ca2da8a2a0e4db978502f (patch)
treefd9c4a2dd974698006ea64834bc89ea07c060513 /source/blender/makesrna/intern/rna_ID.c
parent23d19c2b0dd3f47339ef07be39d47c41848be39b (diff)
LibOverride: give more remapping control to `BKE_override_library_create_from_id()` too.
Similar change to the one done for tagged IDs overriding some days ago. We do not always want to remap all local usages of a linked data-block to its new local overriding copy.
Diffstat (limited to 'source/blender/makesrna/intern/rna_ID.c')
-rw-r--r--source/blender/makesrna/intern/rna_ID.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 5a4b4a3fa3d..294fdb2e0d8 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -491,13 +491,22 @@ static ID *rna_ID_copy(ID *id, Main *bmain)
return NULL;
}
-static ID *rna_ID_override_create(ID *id, Main *bmain)
+static ID *rna_ID_override_create(ID *id, Main *bmain, bool remap_local_usages)
{
if (!BKE_override_library_is_enabled() || id->lib == NULL) {
return NULL;
}
- return BKE_override_library_create_from_id(bmain, id);
+ if (remap_local_usages) {
+ BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, true);
+ }
+
+ ID *local_id = BKE_override_library_create_from_id(bmain, id, remap_local_usages);
+
+ if (remap_local_usages) {
+ BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
+ }
+ return local_id;
}
static void rna_ID_update_tag(ID *id, Main *bmain, ReportList *reports, int flag)
@@ -1519,6 +1528,12 @@ static void rna_def_ID(BlenderRNA *brna)
RNA_def_function_flag(func, FUNC_USE_MAIN);
parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the ID");
RNA_def_function_return(func, parm);
+ RNA_def_boolean(func,
+ "remap_local_usages",
+ false,
+ "",
+ "Whether local usages of the linked ID should be remapped to the new "
+ "library override of it");
func = RNA_def_function(srna, "user_clear", "rna_ID_user_clear");
RNA_def_function_ui_description(func,