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_access_compare_override.c')
-rw-r--r--source/blender/makesrna/intern/rna_access_compare_override.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c
index 3912c873fd0..2c552970c82 100644
--- a/source/blender/makesrna/intern/rna_access_compare_override.c
+++ b/source/blender/makesrna/intern/rna_access_compare_override.c
@@ -1096,6 +1096,7 @@ static void rna_property_override_check_resync(Main *bmain,
PointerRNA *ptr_item_dst,
PointerRNA *ptr_item_src)
{
+ ID *id_owner = rna_property_override_property_real_id_owner(bmain, ptr_dst, NULL, NULL);
ID *id_src = rna_property_override_property_real_id_owner(bmain, ptr_item_src, NULL, NULL);
ID *id_dst = rna_property_override_property_real_id_owner(bmain, ptr_item_dst, NULL, NULL);
@@ -1109,9 +1110,18 @@ static void rna_property_override_check_resync(Main *bmain,
* remapped to its new local override. In that case overrides and linked data
* are always properly matching. */
id_src != id_dst &&
- /* If one of the pointers is NULL and not the other, or if linked reference ID
- * of `id_src` is not `id_dst`, we are in a non-matching case. */
- (ELEM(NULL, id_src, id_dst) || id_src->override_library->reference != id_dst)) {
+ /* If one of the pointers is NULL and not the other, we are in a non-matching case. */
+ (ELEM(NULL, id_src, id_dst) ||
+ /* If `id_dst` is not from same lib as id_src, and linked reference ID of `id_src` is not
+ * `id_dst`, we are in a non-matching case. */
+ (id_dst->lib != id_src->lib && id_src->override_library->reference != id_dst) ||
+ /* If `id_dst` is from same lib as id_src, and is not same as `id_owner`, we are in a
+ * non-matching case.
+ *
+ * NOTE: Here we are testing if `id_owner` is referencing itself, in that case the new
+ * override copy generated by `BKE_lib_override_library_update` will already have its
+ * self-references updated to itself, instead of still pointing to its linked source. */
+ (id_dst->lib == id_src->lib && id_dst != id_owner))) {
ptr_dst->owner_id->tag |= LIB_TAG_LIB_OVERRIDE_NEED_RESYNC;
CLOG_INFO(&LOG, 3, "Local override %s detected as needing resync", ptr_dst->owner_id->name);
}