diff options
author | Bastien Montagne <bastien@blender.org> | 2020-06-10 17:43:25 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-06-10 17:48:49 +0300 |
commit | 74ec37b70cbc8dc228f11d0796dbe68c24526b16 (patch) | |
tree | 5691206349ce3365d554ec64e136fc534908af76 /source/blender/blenkernel/intern/lib_id.c | |
parent | 1d0017089c6ad4bd9b87af1bb30024a86e7b2771 (diff) |
Enable (deep) copy of overrides.
This commit enables basic copy of overrides on generic ID level, as well
as from (deep) copy operators for objects and collections.
So e.g. if your linked overridden caracter is in a collection, you can
now (from the outliner) Duplicate that override collection to get a new
overriding copy of the character.
We still need operators (new or modifying existing ones) to handle that
from 3DView e.g.
Note that deep copy code for objects/collections (and incidently
animdata) had to be modified to avoid duplicating/making local IDs that
remain linked ones being used by overrides ones.
Diffstat (limited to 'source/blender/blenkernel/intern/lib_id.c')
-rw-r--r-- | source/blender/blenkernel/intern/lib_id.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index 734fe9ad9ae..3ad429c5f5a 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -64,6 +64,7 @@ #include "BKE_idtype.h" #include "BKE_key.h" #include "BKE_lib_id.h" +#include "BKE_lib_override.h" #include "BKE_lib_query.h" #include "BKE_lib_remap.h" #include "BKE_main.h" @@ -1153,14 +1154,13 @@ void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int ori new_id->properties = IDP_CopyProperty_ex(id->properties, copy_data_flag); } - /* XXX Again... We need a way to control what we copy in a much more refined way. - * We cannot always copy this, some internal copying will die on it! */ - /* For now, upper level code will have to do that itself when required. */ -#if 0 - if (id->override != NULL) { - BKE_override_copy(new_id, id); + /* We may need our own flag to control that at some point, but for now 'no main' one should be + * good enough. */ + if ((orig_flag & LIB_ID_CREATE_NO_MAIN) == 0 && id->override_library != NULL) { + /* We do not want to copy existing override rules here, as they would break the proper + * remapping between IDs. Proper overrides rules will be re-generated anyway. */ + BKE_lib_override_library_copy(new_id, id, false); } -#endif if (id_can_have_animdata(new_id)) { IdAdtTemplate *iat = (IdAdtTemplate *)new_id; |