[Bf-blender-cvs] [f057e92ae29] master: LibOverride: Fix some cleanup of unused override operations.

Bastien Montagne noreply at git.blender.org
Fri Sep 25 11:52:28 CEST 2020


Commit: f057e92ae29ba15895ff489ef1ec0de8dc3f4cbc
Author: Bastien Montagne
Date:   Fri Sep 25 11:50:16 2020 +0200
Branches: master
https://developer.blender.org/rBf057e92ae29ba15895ff489ef1ec0de8dc3f4cbc

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.

===================================================================

M	source/blender/makesrna/intern/rna_rna.c

===================================================================

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);
+          }
         }
       }



More information about the Bf-blender-cvs mailing list