Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2016-07-11 20:13:42 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-07-11 22:30:02 +0300
commit2ec17e655c4fdabc6251b5c81f4404451160923c (patch)
treee733b30bb19cfc0037ffae8a01bac3c57334ebac /source/blender/blenkernel/intern/mball.c
parent439ccca1e0b7078f3055ec14a7c81e964594ae6b (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/mball.c')
-rw-r--r--source/blender/blenkernel/intern/mball.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 0a29b2d53fd..e615c229a13 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -105,20 +105,18 @@ MetaBall *BKE_mball_add(Main *bmain, const char *name)
MetaBall *BKE_mball_copy(Main *bmain, MetaBall *mb)
{
MetaBall *mbn;
- int a;
mbn = BKE_libblock_copy(bmain, &mb->id);
BLI_duplicatelist(&mbn->elems, &mb->elems);
mbn->mat = MEM_dupallocN(mb->mat);
- for (a = 0; a < mbn->totcol; a++) {
- id_us_plus((ID *)mbn->mat[a]);
- }
mbn->editelems = NULL;
mbn->lastelem = NULL;
+ BKE_id_expand_local(&mbn->id, true);
+
if (ID_IS_LINKED_DATABLOCK(mb)) {
BKE_id_lib_local_paths(bmain, mb->id.lib, &mbn->id);
}
@@ -126,21 +124,6 @@ MetaBall *BKE_mball_copy(Main *bmain, MetaBall *mb)
return mbn;
}
-static int extern_local_mball_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_mball(MetaBall *mb)
-{
- BKE_library_foreach_ID_link(&mb->id, extern_local_mball_callback, NULL, 0);
-}
-
void BKE_mball_make_local(Main *bmain, MetaBall *mb)
{
bool is_local = false, is_lib = false;
@@ -159,7 +142,7 @@ void BKE_mball_make_local(Main *bmain, MetaBall *mb)
if (is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &mb->id);
- extern_local_mball(mb);
+ BKE_id_expand_local(&mb->id, false);
}
else {
MetaBall *mb_new = BKE_mball_copy(bmain, mb);