diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-11 20:13:42 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-11 22:30:02 +0300 |
commit | 2ec17e655c4fdabc6251b5c81f4404451160923c (patch) | |
tree | e733b30bb19cfc0037ffae8a01bac3c57334ebac /source/blender/blenkernel/intern/speaker.c | |
parent | 439ccca1e0b7078f3055ec14a7c81e964594ae6b (diff) |
Use new generic BKE_id_expand_local() for both make_local() and copy() functions of obdata
(armature, mesh, curve, mball, lattice, lamp, camera, and speaker).
This greatly simplifies said code, once again no change expected from user PoV.
Diffstat (limited to 'source/blender/blenkernel/intern/speaker.c')
-rw-r--r-- | source/blender/blenkernel/intern/speaker.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c index e1bb0998145..7a9fee9e0ef 100644 --- a/source/blender/blenkernel/intern/speaker.c +++ b/source/blender/blenkernel/intern/speaker.c @@ -73,8 +73,8 @@ Speaker *BKE_speaker_copy(Main *bmain, Speaker *spk) Speaker *spkn; spkn = BKE_libblock_copy(bmain, &spk->id); - if (spkn->sound) - id_us_plus(&spkn->sound->id); + + BKE_id_expand_local(&spkn->id, true); if (ID_IS_LINKED_DATABLOCK(spk)) { BKE_id_lib_local_paths(G.main, spk->id.lib, &spkn->id); @@ -83,21 +83,6 @@ Speaker *BKE_speaker_copy(Main *bmain, Speaker *spk) return spkn; } -static int extern_local_speaker_callback( - void *UNUSED(user_data), struct ID *UNUSED(id_self), struct ID **id_pointer, int cd_flag) -{ - /* We only tag usercounted ID usages as extern... Why? */ - if ((cd_flag & IDWALK_USER) && *id_pointer) { - id_lib_extern(*id_pointer); - } - return IDWALK_RET_NOP; -} - -static void extern_local_speaker(Speaker *spk) -{ - BKE_library_foreach_ID_link(&spk->id, extern_local_speaker_callback, NULL, 0); -} - void BKE_speaker_make_local(Main *bmain, Speaker *spk) { bool is_local = false, is_lib = false; @@ -116,7 +101,7 @@ void BKE_speaker_make_local(Main *bmain, Speaker *spk) if (is_local) { if (!is_lib) { id_clear_lib_data(bmain, &spk->id); - extern_local_speaker(spk); + BKE_id_expand_local(&spk->id, false); } else { Speaker *spk_new = BKE_speaker_copy(bmain, spk); |