LibOverride: Fix some cleanup of unused override operations.

Handling of pointer replacements in collection items lead to validating
all operations for a given property, when some might actually be no more
valid and would need to be cleaned up.

Related to T81059, found while investigating it.
This commit is contained in:
Bastien Montagne 2020-09-25 11:50:16 +02:00
parent 4a224451d1
commit f057e92ae2
1 changed files with 17 additions and 11 deletions

View File

@ -1306,8 +1306,6 @@ static int rna_property_override_diff_propptr(Main *bmain,
/* If not yet overridden, or if we are handling sub-items (inside a collection)... */
if (op != NULL) {
BKE_lib_override_library_operations_tag(op, IDOVERRIDE_LIBRARY_TAG_UNUSED, false);
if (created || op->rna_prop_type == 0) {
op->rna_prop_type = property_type;
}
@ -1317,19 +1315,27 @@ static int rna_property_override_diff_propptr(Main *bmain,
if (created || rna_itemname_a != NULL || rna_itemname_b != NULL ||
rna_itemindex_a != -1 || rna_itemindex_b != -1) {
BKE_lib_override_library_property_operation_get(op,
IDOVERRIDE_LIBRARY_OP_REPLACE,
rna_itemname_b,
rna_itemname_a,
rna_itemindex_b,
rna_itemindex_a,
true,
NULL,
&created);
IDOverrideLibraryPropertyOperation *opop;
opop = BKE_lib_override_library_property_operation_get(op,
IDOVERRIDE_LIBRARY_OP_REPLACE,
rna_itemname_b,
rna_itemname_a,
rna_itemindex_b,
rna_itemindex_a,
true,
NULL,
&created);
/* Do not use BKE_lib_override_library_operations_tag here, we do not want to validate
* as used all of its operations. */
op->tag &= ~IDOVERRIDE_LIBRARY_TAG_UNUSED;
opop->tag &= ~IDOVERRIDE_LIBRARY_TAG_UNUSED;
if (r_override_changed) {
*r_override_changed = created;
}
}
else {
BKE_lib_override_library_operations_tag(op, IDOVERRIDE_LIBRARY_TAG_UNUSED, false);
}
}
}