LibOverride: Fix diffing code not always cleaning unused operations.

In RNA collections cases, the cleaning code was buggy and could end up
never cleaning actually unused liboverride operations, resulting in
sometimes tens of garbage operations on e.g. Collection's objects list.

This was a fairly severe bug, since it could lead to very broken
overrides of collections in some cases when things start to get broken
in the production file, amplifying greatly initially small issues.
This commit is contained in:
Bastien Montagne
2023-07-08 15:55:13 +02:00
parent df0d6d0022
commit 784d09a87c
2 changed files with 4 additions and 1 deletions

View File

@@ -823,7 +823,9 @@ bool RNA_struct_override_matches(Main *bmain,
op ? op->operations.first : nullptr);
if (op != nullptr) {
BKE_lib_override_library_operations_tag(op, LIBOVERRIDE_PROP_OP_TAG_UNUSED, false);
/* Do not use #BKE_lib_override_library_operations_tag here, in collection case some of the
* operations may still be unused. */
op->tag &= ~LIBOVERRIDE_PROP_OP_TAG_UNUSED;
}
if ((do_restore || do_tag_for_restore) &&

View File

@@ -1455,6 +1455,7 @@ static int rna_property_override_diff_propptr(Main *bmain,
rna_itemindex_a,
true,
NULL);
opop->tag &= ~LIBOVERRIDE_PROP_OP_TAG_UNUSED;
BLI_assert(opop != NULL);
}