LibOverride: Fix persistent override property in some RNA pointer cases.

When the override property over a non-ID RNA pointer is not needed
anymore, remove it.

This case is a bit special, because the match does (potentially) detect
differences within the RNA structures pointed to by the property, yet
there should be no override rule for the property itself.
An override rule may have been created in a previous diffing if one of
the RNA pointers was null.

Note that while fairly rare, this is not a corner-case, as it affects at
least one (very common) RNA pointer: the 'animation_data' one.

This left-over rule (created when the liboverride is animated, while the
linked reference data would have no anim data, and becoming useless once
both have anim data) was harmless so far, but would become a problem
with up-coming changes related to #110067.
This commit is contained in:
Bastien Montagne
2023-08-07 18:43:11 +02:00
parent d9ec3985a3
commit 9e7e0a01b2

View File

@@ -1624,6 +1624,18 @@ static void rna_property_override_diff_propptr(Main *bmain,
&ptrdiff_ctx.rnadiff_ctx.report_flag);
ptrdiff_ctx.rnadiff_ctx.comparison = !match;
/* Regardless of whether the data from both pointers matches or not, a potentially existing
* operation on current extended rna path should be removed. This is done by tagging said
* operation as unused, while clearing the property tag (see also
* #RNA_struct_override_matches handling of #LIBOVERRIDE_PROP_OP_TAG_UNUSED). Note that a
* property with no operations will also be cleared by
* #BKE_lib_override_library_id_unused_cleanup. */
IDOverrideLibraryProperty *op = BKE_lib_override_library_property_find(liboverride,
extended_rna_path);
if (op != nullptr) {
op->tag &= ~LIBOVERRIDE_PROP_OP_TAG_UNUSED;
}
if (!ELEM(extended_rna_path, extended_rna_path_buffer, rna_path)) {
MEM_freeN(extended_rna_path);
}