diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 71a3be24810..aeb6d528cdb 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -393,7 +393,7 @@ bool RNA_struct_idprops_check(StructRNA *srna) return (srna && srna->idproperties); } -static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name) +IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name) { IDProperty *group = RNA_struct_idprops(ptr, 0); diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c index df1554ac7bc..18fbe7886e9 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.c +++ b/source/blender/makesrna/intern/rna_access_compare_override.c @@ -625,6 +625,21 @@ bool RNA_struct_override_matches(Main *bmain, prop_local = rna_ensure_property_realdata(&prop_local, ptr_local); prop_reference = rna_ensure_property_realdata(&prop_reference, ptr_reference); + /* IDProps (custom properties) are even more of a PITA here, we cannot use + * `rna_ensure_property_realdata()` to deal with them, we have to use the path generated from + * `prop_local` (which is valid) to access to the actual reference counterpart... */ + if (prop_local != NULL && prop_local->magic != RNA_MAGIC && prop_local == prop_reference) { + /* We could also use (lower in this code, after rna_path has been computed): + * RNA_path_resolve_property(ptr_reference, rna_path, &some_rna_ptr, &prop_reference); + * But that would be much more costly, and would also fail when ptr_reference + * is not an ID pointer itself, so we'd need to rebuild it from its owner_id, then check that + * generated some_rna_ptr and ptr_reference do point to the same data, etc. + * For now, let's try that simple access, it won't cover all cases but should handle fine + * most basic custom properties situations. */ + prop_reference = (PropertyRNA *)rna_idproperty_find(ptr_reference, + ((IDProperty *)prop_local)->name); + } + if (ELEM(NULL, prop_local, prop_reference)) { continue; } diff --git a/source/blender/makesrna/intern/rna_access_internal.h b/source/blender/makesrna/intern/rna_access_internal.h index 28ec504e376..c7995746d08 100644 --- a/source/blender/makesrna/intern/rna_access_internal.h +++ b/source/blender/makesrna/intern/rna_access_internal.h @@ -30,5 +30,6 @@ struct IDProperty; PropertyRNA *rna_ensure_property(PropertyRNA *prop); void rna_idproperty_touch(struct IDProperty *idprop); +struct IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name); #endif /* __ACCESS_RNA_INTERNAL_H__ */