[Bf-blender-cvs] [837653d7352] master: LibOverride: Fix bad handling of 'store' callback in IDProps case.

Bastien Montagne noreply at git.blender.org
Fri Oct 4 12:27:20 CEST 2019


Commit: 837653d735249a65ccdd7467625041493a14cc8a
Author: Bastien Montagne
Date:   Thu Oct 3 20:09:33 2019 +0200
Branches: master
https://developer.blender.org/rB837653d735249a65ccdd7467625041493a14cc8a

LibOverride: Fix bad handling of 'store' callback in IDProps case.

We need same kind of default handling for IDProps as we already have for
the diff callback.

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

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

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

diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c
index b061c72157e..df1554ac7bc 100644
--- a/source/blender/makesrna/intern/rna_access_compare_override.c
+++ b/source/blender/makesrna/intern/rna_access_compare_override.c
@@ -400,9 +400,39 @@ static bool rna_property_override_operation_store(Main *bmain,
     return changed;
   }
 
-  BLI_assert(prop_local->override_store == prop_reference->override_store &&
-             (!ptr_storage || prop_local->override_store == prop_storage->override_store) &&
-             prop_local->override_store != NULL);
+  RNAPropOverrideStore override_store = NULL;
+  /* Special case for IDProps, we use default callback then. */
+  if (prop_local->magic != RNA_MAGIC) {
+    override_store = rna_property_override_store_default;
+    if (prop_reference->magic == RNA_MAGIC && prop_reference->override_store != override_store) {
+      override_store = NULL;
+    }
+  }
+  else if (prop_reference->magic != RNA_MAGIC) {
+    override_store = rna_property_override_store_default;
+    if (prop_local->override_store != override_store) {
+      override_store = NULL;
+    }
+  }
+  else if (prop_local->override_store == prop_reference->override_store) {
+    override_store = prop_local->override_store;
+  }
+
+  if (ptr_storage != NULL && prop_storage->magic == RNA_MAGIC &&
+      prop_storage->override_store != override_store) {
+    override_store = NULL;
+  }
+
+  if (override_store == NULL) {
+#ifndef NDEBUG
+    printf("'%s' gives unmatching or NULL RNA store callbacks, should not happen (%d vs. %d).\n",
+           op->rna_path,
+           prop_local->magic == RNA_MAGIC,
+           prop_reference->magic == RNA_MAGIC);
+#endif
+    BLI_assert(0);
+    return changed;
+  }
 
   for (IDOverrideLibraryPropertyOperation *opop = op->operations.first; opop; opop = opop->next) {
     /* Only needed for diff operations. */
@@ -413,17 +443,17 @@ static bool rna_property_override_operation_store(Main *bmain,
       continue;
     }
 
-    if (prop_local->override_store(bmain,
-                                   ptr_local,
-                                   ptr_reference,
-                                   ptr_storage,
-                                   prop_local,
-                                   prop_reference,
-                                   prop_storage,
-                                   len_local,
-                                   len_reference,
-                                   len_storage,
-                                   opop)) {
+    if (override_store(bmain,
+                       ptr_local,
+                       ptr_reference,
+                       ptr_storage,
+                       prop_local,
+                       prop_reference,
+                       prop_storage,
+                       len_local,
+                       len_reference,
+                       len_storage,
+                       opop)) {
       changed = true;
     }
   }



More information about the Bf-blender-cvs mailing list