From f057e92ae29ba15895ff489ef1ec0de8dc3f4cbc Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 25 Sep 2020 11:50:16 +0200 Subject: 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. --- source/blender/makesrna/intern/rna_rna.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index cab596c10fb..8d87de23b3a 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -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); + } } } -- cgit v1.2.3