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 <bastien@blender.org>2022-07-15 13:57:37 +0300
committerBastien Montagne <bastien@blender.org>2022-07-15 15:15:40 +0300
commit914617f8fd01f8e84daf4ae0b8ea750a1bfbdc42 (patch)
tree313c424565765d3d424fbf45bf178163818f19f1 /source/blender
parent523bbf7065547a67e7c23f67f546a5ed6433f809 (diff)
Fix (unreported) LibOverride: invalid behaviors when creating (partial) overrides.
The outliner would tagg all existing local IDs (for remap from linked reference data to newly created overrides) when creating a new override. This would become critical issue in case there is several existing copies of the same override hierarchy (leading to several hierarchies using the same override). Further more, BKE override creation code would not systematically properly remapp linked usages to new overrides one whithin the affected override hierarchy, leading to potential undesired remaining usages of linked data.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/lib_override.cc18
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.cc2
2 files changed, 16 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.cc b/source/blender/blenkernel/intern/lib_override.cc
index aa3210b64ad..0c5f59be768 100644
--- a/source/blender/blenkernel/intern/lib_override.cc
+++ b/source/blender/blenkernel/intern/lib_override.cc
@@ -1149,14 +1149,26 @@ static bool lib_override_library_create_do(Main *bmain,
BKE_main_relations_tag_set(bmain, MAINIDRELATIONS_ENTRY_TAGS_PROCESSED, false);
lib_override_hierarchy_dependencies_recursive_tag(&data);
+ /* In case the operation is on an already partially overridden hierarchy, all existing overrides
+ * in that hierarchy need to be tagged for remapping from linked reference ID usages to newly
+ * created overrides ones. */
+ if (id_hierarchy_root_reference->lib != id_root_reference->lib) {
+ BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id_hierarchy_root_reference));
+ BLI_assert(id_hierarchy_root_reference->override_library->reference->lib ==
+ id_root_reference->lib);
+
+ BKE_main_relations_tag_set(bmain, MAINIDRELATIONS_ENTRY_TAGS_PROCESSED, false);
+ data.hierarchy_root_id = id_hierarchy_root_reference;
+ data.id_root = id_hierarchy_root_reference;
+ data.is_override = true;
+ lib_override_overrides_group_tag(&data);
+ }
+
BKE_main_relations_free(bmain);
lib_override_group_tag_data_clear(&data);
bool success = false;
if (id_hierarchy_root_reference->lib != id_root_reference->lib) {
- BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id_hierarchy_root_reference));
- BLI_assert(id_hierarchy_root_reference->override_library->reference->lib ==
- id_root_reference->lib);
success = BKE_lib_override_library_create_from_tag(bmain,
owner_library,
id_root_reference,
diff --git a/source/blender/editors/space_outliner/outliner_tools.cc b/source/blender/editors/space_outliner/outliner_tools.cc
index 7b7182eb106..9d52103a266 100644
--- a/source/blender/editors/space_outliner/outliner_tools.cc
+++ b/source/blender/editors/space_outliner/outliner_tools.cc
@@ -875,7 +875,7 @@ static void id_override_library_create_fn(bContext *C,
/* For now, remap all local usages of linked ID to local override one here. */
ID *id_iter;
FOREACH_MAIN_ID_BEGIN (bmain, id_iter) {
- if (ID_IS_LINKED(id_iter)) {
+ if (ID_IS_LINKED(id_iter) || ID_IS_OVERRIDE_LIBRARY(id_iter)) {
id_iter->tag &= ~LIB_TAG_DOIT;
}
else {