From 1c0ffa1e1816a59167850c27edf8cadad3daaf6a Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 12 Jul 2023 17:05:10 +0200 Subject: [PATCH] Fix mistake in recent change to liboverride cleanup of invalid operations. Issue introduced by own 784d09a87c, would end up cleaning too many, including valid liboverride operations. --- .../makesrna/intern/rna_access_compare_override.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/blender/makesrna/intern/rna_access_compare_override.cc b/source/blender/makesrna/intern/rna_access_compare_override.cc index cd6d6d92e76..b90f6d3d1f9 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.cc +++ b/source/blender/makesrna/intern/rna_access_compare_override.cc @@ -824,9 +824,16 @@ bool RNA_struct_override_matches(Main *bmain, op ? op->operations.first : nullptr); if (op != nullptr) { - /* 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; + /* Only set all operations from this property as used (via + * #BKE_lib_override_library_operations_tag) if the property itself is still tagged as + * unused. + * + * In case the property itself is already tagged as used, in means lower-level diffing code + * took care of this property (as is needed for e.g. collections of items, since then some + * operations may be valid, while others may need to be purged). */ + if (op->tag & LIBOVERRIDE_PROP_OP_TAG_UNUSED) { + BKE_lib_override_library_operations_tag(op, LIBOVERRIDE_PROP_OP_TAG_UNUSED, false); + } } if ((do_restore || do_tag_for_restore) &&