diff options
author | Bastien Montagne <bastien@blender.org> | 2021-04-10 16:16:38 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-04-10 16:25:32 +0300 |
commit | c9e054c5de510452ca4f230db807f9c25d9ea4bb (patch) | |
tree | 2cfce4417ecc031e8c8c5847afd17e7df2ca367a /source/blender/blenkernel | |
parent | f337310b43369e54f3874d733adec515615d629d (diff) |
LibOverride: Add own flag to copy or not overrides to ID copy code.
Relying on only no-main for that was weak, and inn the end it turns out
we sometimes also need to ifnore override data during copy of Main
data-blocks.
NOTE: The new `LIB_ID_COPY_NO_LIB_OVERRIDE` is also added to the
`LIB_ID_COPY_LOCALIZE` set of flags.
NOTE: The fact that we may now copy liboverrides in some non-main cases
may cause issues in some cases, pretty impossible to track all possible
ones from reading the code... Would not expect too many problem though,
usages of `LIB_ID_CREATE_NO_MAIN` by itself are not so common.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_lib_id.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_id.c | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/blenkernel/BKE_lib_id.h b/source/blender/blenkernel/BKE_lib_id.h index 5a8d36b94ec..adac92105ee 100644 --- a/source/blender/blenkernel/BKE_lib_id.h +++ b/source/blender/blenkernel/BKE_lib_id.h @@ -116,6 +116,8 @@ enum { LIB_ID_COPY_NO_ANIMDATA = 1 << 19, /** Mesh: Reference CD data layers instead of doing real copy - USE WITH CAUTION! */ LIB_ID_COPY_CD_REFERENCE = 1 << 20, + /** Do not copy id->override_library, used by ID datablock override routines. */ + LIB_ID_COPY_NO_LIB_OVERRIDE = 1 << 21, /* *** XXX Hackish/not-so-nice specific behaviors needed for some corner cases. *** */ /* *** Ideally we should not have those, but we need them for now... *** */ @@ -136,7 +138,8 @@ enum { LIB_ID_CREATE_LOCALIZE = LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_DEG_TAG, /** Generate a local copy, outside of bmain, to work on (used by COW e.g.). */ - LIB_ID_COPY_LOCALIZE = LIB_ID_CREATE_LOCALIZE | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_CACHES, + LIB_ID_COPY_LOCALIZE = LIB_ID_CREATE_LOCALIZE | LIB_ID_COPY_NO_PREVIEW | LIB_ID_COPY_CACHES | + LIB_ID_COPY_NO_LIB_OVERRIDE, }; void BKE_libblock_copy_ex(struct Main *bmain, diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index af921307bfb..795a5ad9468 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -1264,9 +1264,7 @@ 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); } - /* 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) { + if ((orig_flag & LIB_ID_COPY_NO_LIB_OVERRIDE) == 0) { if (ID_IS_OVERRIDE_LIBRARY_REAL(id)) { /* 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. */ |