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 22:27:15 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-07-11 22:30:02 +0300
commit7212ebd09f9720883581221be923ae5e97ff5d76 (patch)
tree546606626647d473ae9d4a037ce8e24e17943e08 /source/blender/blenkernel/intern/mball.c
parent3b8e0606e1cfa484971d09c5060a78dbadbe1569 (diff)
Remove usercount handling from BKE_id_expand_local.
Idea looked good, but we have too much custom situations here (some half-fake-sub-ID being copied with their 'owner', animdata, etc.), let's let datablock copy functions handle that themselves. Also allows to safely call BKE_id_expand_local from all copy functions now (only when copying linked data).
Diffstat (limited to 'source/blender/blenkernel/intern/mball.c')
-rw-r--r--source/blender/blenkernel/intern/mball.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index b65df04804d..9a0a6e3540c 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -105,19 +105,22 @@ 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_expand_local(&mbn->id);
BKE_id_lib_local_paths(bmain, mb->id.lib, &mbn->id);
}
@@ -142,7 +145,7 @@ void BKE_mball_make_local(Main *bmain, MetaBall *mb)
if (is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &mb->id);
- BKE_id_expand_local(&mb->id, false);
+ BKE_id_expand_local(&mb->id);
}
else {
MetaBall *mb_new = BKE_mball_copy(bmain, mb);