diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-09-05 17:41:35 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-09-05 22:31:00 +0300 |
commit | 8622849beb964536d39ca2da8a2a0e4db978502f (patch) | |
tree | fd9c4a2dd974698006ea64834bc89ea07c060513 /source/blender/blenkernel/intern/library_override.c | |
parent | 23d19c2b0dd3f47339ef07be39d47c41848be39b (diff) |
LibOverride: give more remapping control to `BKE_override_library_create_from_id()` too.
Similar change to the one done for tagged IDs overriding some days ago.
We do not always want to remap all local usages of a linked data-block
to its new local overriding copy.
Diffstat (limited to 'source/blender/blenkernel/intern/library_override.c')
-rw-r--r-- | source/blender/blenkernel/intern/library_override.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/library_override.c b/source/blender/blenkernel/intern/library_override.c index 6532fce5778..b3c628f6cb8 100644 --- a/source/blender/blenkernel/intern/library_override.c +++ b/source/blender/blenkernel/intern/library_override.c @@ -185,19 +185,28 @@ static ID *override_library_create_from(Main *bmain, ID *reference_id) } /** Create an overridden local copy of linked reference. */ -ID *BKE_override_library_create_from_id(Main *bmain, ID *reference_id) +ID *BKE_override_library_create_from_id(Main *bmain, ID *reference_id, const bool do_tagged_remap) { BLI_assert(reference_id != NULL); BLI_assert(reference_id->lib != NULL); ID *local_id = override_library_create_from(bmain, reference_id); - /* Remapping, we obviously only want to affect local data - * (and not our own reference pointer to overridden ID). */ - BKE_libblock_remap(bmain, - reference_id, - local_id, - ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_OVERRIDE_LIBRARY); + if (do_tagged_remap) { + ID *other_id; + FOREACH_MAIN_ID_BEGIN (bmain, other_id) { + if ((other_id->tag & LIB_TAG_DOIT) != 0 && other_id->lib == NULL) { + /* Note that using ID_REMAP_SKIP_INDIRECT_USAGE below is superfluous, as we only remap + * local IDs usages anyway... */ + BKE_libblock_relink_ex(bmain, + other_id, + reference_id, + local_id, + ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_OVERRIDE_LIBRARY); + } + } + FOREACH_MAIN_ID_END; + } return local_id; } |