diff options
Diffstat (limited to 'source/blender/blenkernel/intern/speaker.c')
-rw-r--r-- | source/blender/blenkernel/intern/speaker.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c index a91d8657179..ee6886e3fb2 100644 --- a/source/blender/blenkernel/intern/speaker.c +++ b/source/blender/blenkernel/intern/speaker.c @@ -77,42 +77,14 @@ Speaker *BKE_speaker_copy(Main *bmain, Speaker *spk) if (spkn->sound) id_us_plus(&spkn->sound->id); - if (ID_IS_LINKED_DATABLOCK(spk)) { - BKE_id_expand_local(&spkn->id); - BKE_id_lib_local_paths(G.main, spk->id.lib, &spkn->id); - } + BKE_id_copy_ensure_local(bmain, &spk->id, &spkn->id); return spkn; } -void BKE_speaker_make_local(Main *bmain, Speaker *spk) +void BKE_speaker_make_local(Main *bmain, Speaker *spk, const bool lib_local) { - bool is_local = false, is_lib = false; - - /* - only lib users: do nothing - * - only local users: set flag - * - mixed: make copy - */ - - if (!ID_IS_LINKED_DATABLOCK(spk)) { - return; - } - - BKE_library_ID_test_usages(bmain, spk, &is_local, &is_lib); - - if (is_local) { - if (!is_lib) { - id_clear_lib_data(bmain, &spk->id); - BKE_id_expand_local(&spk->id); - } - else { - Speaker *spk_new = BKE_speaker_copy(bmain, spk); - - spk_new->id.us = 0; - - BKE_libblock_remap(bmain, spk, spk_new, ID_REMAP_SKIP_INDIRECT_USAGE); - } - } + BKE_id_make_local_generic(bmain, &spk->id, true, lib_local); } void BKE_speaker_free(Speaker *spk) |