LibOverride: tweak resync detection code at apply phase.
This code checks whether an ID pointer property of an override does not match its linked reference when it is expected to do so. This is a goiod indication that a resync is needed. Previous code would falsy detect overrides of IDs referencing themselves as needing a resync, when this is not effectively the case.
This commit is contained in:
parent
04376c3bac
commit
9bfd4ae222
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue