diff options
author | Bastien Montagne <bastien@blender.org> | 2020-06-09 20:35:11 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-06-10 10:38:34 +0300 |
commit | edb4e553f506c858e7df5e45ad6235cd59a181eb (patch) | |
tree | 0d7b7a652fab333f2f45cdbdd348f35353703a3f /source/blender/blenkernel/intern/lib_override.c | |
parent | 2d1b560a4e29567e4d9c3b964dc7d6a7bfd8056c (diff) |
LibOverride: Fix issues related to ID name differences.
Local datablocks (including overrides) need to have a unique name, which
can then differ from the reference linked one (especially when there are
several local overrides of a same linked data).
Issue is, ID name is a 'rna name property', and as such used as
reference when dealing with override of collections of IDs, so we cannot
have a changing name.
The solution implemented here should work and is simple, but it may have
some issues in corner cases (time will say), it is not really robust.
Alternative solution would be to store ID pointers as reference in
override operations, instead of there name. But that would potentially
add quiet a lot of overhead to foreach looping in `lib_query.c`.
Diffstat (limited to 'source/blender/blenkernel/intern/lib_override.c')
-rw-r--r-- | source/blender/blenkernel/intern/lib_override.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 9426d229e01..8d1a4e3594c 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -937,6 +937,12 @@ void BKE_lib_override_library_update(Main *bmain, ID *local) return; } + /* This ID name is problematic, since it is an 'rna name property' it should not be editable or + * different from reference linked ID. But local ID names need to be unique in a given type list + * of Main, so we cannot always keep it identical, which is why we need this special manual + * handling here. */ + BLI_strncpy(tmp_id->name, local->name, sizeof(tmp_id->name)); + PointerRNA rnaptr_src, rnaptr_dst, rnaptr_storage_stack, *rnaptr_storage = NULL; RNA_id_pointer_create(local, &rnaptr_src); RNA_id_pointer_create(tmp_id, &rnaptr_dst); |