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/curve.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/curve.c')
-rw-r--r--source/blender/blenkernel/intern/curve.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index db5bbe30759..0e634e21ea3 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -177,6 +177,7 @@ Curve *BKE_curve_add(Main *bmain, const char *name, int type)
Curve *BKE_curve_copy(Main *bmain, Curve *cu)
{
Curve *cun;
+ int a;
cun = BKE_libblock_copy(bmain, &cu->id);
@@ -184,6 +185,9 @@ Curve *BKE_curve_copy(Main *bmain, Curve *cu)
BKE_nurbList_duplicate(&(cun->nurb), &(cu->nurb));
cun->mat = MEM_dupallocN(cu->mat);
+ for (a = 0; a < cun->totcol; a++) {
+ id_us_plus((ID *)cun->mat[a]);
+ }
cun->str = MEM_dupallocN(cu->str);
cun->strinfo = MEM_dupallocN(cu->strinfo);
@@ -192,16 +196,19 @@ Curve *BKE_curve_copy(Main *bmain, Curve *cu)
if (cu->key) {
cun->key = BKE_key_copy(bmain, cu->key);
- cun->key->id.us = 0; /* Will be increased again by BKE_id_expand_local. */
cun->key->from = (ID *)cun;
}
cun->editnurb = NULL;
cun->editfont = NULL;
- BKE_id_expand_local(&cun->id, true);
+ id_us_plus((ID *)cun->vfont);
+ id_us_plus((ID *)cun->vfontb);
+ id_us_plus((ID *)cun->vfonti);
+ id_us_plus((ID *)cun->vfontbi);
if (ID_IS_LINKED_DATABLOCK(cu)) {
+ BKE_id_expand_local(&cun->id);
BKE_id_lib_local_paths(bmain, cu->id.lib, &cun->id);
}
@@ -229,6 +236,7 @@ void BKE_curve_make_local(Main *bmain, Curve *cu)
if (cu->key) {
BKE_key_make_local(bmain, cu->key);
}
+ BKE_id_expand_local(&cu->id);
}
else {
Curve *cu_new = BKE_curve_copy(bmain, cu);