diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-10-03 21:09:33 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-10-04 13:27:10 +0300 |
commit | 837653d735249a65ccdd7467625041493a14cc8a (patch) | |
tree | ae2dceec773491d80fc73b3335ce97f5c290bff6 /source/blender | |
parent | 03bf290eae99a0026b39b6e8351bd0d0eed3bc7e (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_access_compare_override.c | 58 |
1 files changed, 44 insertions, 14 deletions
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; } } |