Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-03-12 14:31:25 +0300
committerBastien Montagne <bastien@blender.org>2021-03-12 14:31:25 +0300
commit74557ca4f7cfe14090d6ca245e03e651b4b2524f (patch)
tree72633e2f71ae235e54f60520b06de513a6bc5347 /source/blender/makesrna/intern/rna_access_compare_override.c
parentfe2ceef729a1a1013f7a8466318a12343a6a0e15 (diff)
LibOverride: Add a new operation to Outliner to enforce resync of hierarchies.
This is basically done by ignoring override operations from old override affecting ID pointer properties, when the new (destination) one is not NULL. Fix T86501: New object added to overridden collection doesn't show up in linking file on Resync. This is more of a work-around actually, since there is no real way to fix the issue in a fully automated and consistent way, it is caused by older blender files being saved with 'broken' overrides. WARNING: This cannot ensure that some purposedly edited/overridden ID pointer properties won't be lost in the process.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access_compare_override.c')
-rw-r--r--source/blender/makesrna/intern/rna_access_compare_override.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c
index 6a8152d1139..28d4cc4d075 100644
--- a/source/blender/makesrna/intern/rna_access_compare_override.c
+++ b/source/blender/makesrna/intern/rna_access_compare_override.c
@@ -1123,7 +1123,8 @@ void RNA_struct_override_apply(Main *bmain,
PointerRNA *ptr_dst,
PointerRNA *ptr_src,
PointerRNA *ptr_storage,
- IDOverrideLibrary *override)
+ IDOverrideLibrary *override,
+ const eRNAOverrideApplyFlag flag)
{
#ifdef DEBUG_OVERRIDE_TIMEIT
TIMEIT_START_AVERAGED(RNA_struct_override_apply);
@@ -1187,6 +1188,39 @@ void RNA_struct_override_apply(Main *bmain,
}
}
+ /* Workaround for older broken overrides, we then assume that non-matching ID pointers
+ * override operations that replace a non-NULL value are 'mistakes', and ignore (do not
+ * apply) them. */
+ if ((flag & RNA_OVERRIDE_APPLY_FLAG_IGNORE_ID_POINTERS) != 0 &&
+ op->rna_prop_type == PROP_POINTER &&
+ (((IDOverrideLibraryPropertyOperation *)op->operations.first)->flag &
+ IDOVERRIDE_LIBRARY_FLAG_IDPOINTER_MATCH_REFERENCE) == 0) {
+ BLI_assert(ptr_src->owner_id ==
+ rna_property_override_property_real_id_owner(bmain, &data_src, NULL, NULL));
+ BLI_assert(ptr_dst->owner_id ==
+ rna_property_override_property_real_id_owner(bmain, &data_dst, NULL, NULL));
+
+ PointerRNA prop_ptr_dst = RNA_property_pointer_get(&data_dst, prop_dst);
+ if (prop_ptr_dst.type != NULL && RNA_struct_is_ID(prop_ptr_dst.type)) {
+#ifndef NDEBUG
+ PointerRNA prop_ptr_src = RNA_property_pointer_get(&data_src, prop_src);
+ BLI_assert(prop_ptr_src.type == NULL || RNA_struct_is_ID(prop_ptr_src.type));
+#endif
+ ID *id_dst = rna_property_override_property_real_id_owner(
+ bmain, &prop_ptr_dst, NULL, NULL);
+
+ if (id_dst != NULL) {
+ CLOG_INFO(&LOG,
+ 3,
+ "%s: Ignoring local override on ID pointer property '%s', as requested by "
+ "RNA_OVERRIDE_APPLY_FLAG_IGNORE_ID_POINTERS flag",
+ ptr_dst->owner_id->name,
+ op->rna_path);
+ continue;
+ }
+ }
+ }
+
rna_property_override_apply_ex(bmain,
&data_dst,
&data_src,