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/curve.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/curve.c')
-rw-r--r--source/blender/blenkernel/intern/curve.c31
1 files changed, 2 insertions, 29 deletions
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 3a7be948760..4fb2cda3a2c 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -177,7 +177,6 @@ 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);
@@ -185,9 +184,6 @@ 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);
@@ -196,21 +192,14 @@ 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;
-#if 0 // XXX old animation system
- /* single user ipo too */
- if (cun->ipo) cun->ipo = copy_ipo(cun->ipo);
-#endif // XXX old animation system
-
- id_us_plus((ID *)cun->vfont);
- id_us_plus((ID *)cun->vfontb);
- id_us_plus((ID *)cun->vfonti);
- id_us_plus((ID *)cun->vfontbi);
+ BKE_id_expand_local(&cun->id, true);
if (ID_IS_LINKED_DATABLOCK(cu)) {
BKE_id_lib_local_paths(bmain, cu->id.lib, &cun->id);
@@ -219,21 +208,6 @@ Curve *BKE_curve_copy(Main *bmain, Curve *cu)
return cun;
}
-static int extern_local_curve_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_curve(Curve *cu)
-{
- BKE_library_foreach_ID_link(&cu->id, extern_local_curve_callback, NULL, 0);
-}
-
void BKE_curve_make_local(Main *bmain, Curve *cu)
{
bool is_local = false, is_lib = false;
@@ -255,7 +229,6 @@ void BKE_curve_make_local(Main *bmain, Curve *cu)
if (cu->key) {
BKE_key_make_local(bmain, cu->key);
}
- extern_local_curve(cu);
}
else {
Curve *cu_new = BKE_curve_copy(bmain, cu);