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-09 15:44:48 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2016-07-09 16:44:12 +0300
commit9044ccec5f811fd380fc0348d91d1c53729eea22 (patch)
treeca49364eae2fba58bbc043ae9a72866e0f926588 /source/blender/blenkernel/intern/key.c
parent8bb7a339f76549b4820a670450c0799713d650f8 (diff)
Cleanup to shapekeys' make_local (and copy) functions.
Mostly pass bmain and do not check for NULL key, keys' make_local is suspiciously simple in fact, but think until those behave like real full-featured IDs, it's doing enough!
Diffstat (limited to 'source/blender/blenkernel/intern/key.c')
-rw-r--r--source/blender/blenkernel/intern/key.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 79d42ed6e06..45686e9f450 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -58,6 +58,7 @@
#include "BKE_key.h"
#include "BKE_lattice.h"
#include "BKE_library.h"
+#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_editmesh.h"
#include "BKE_scene.h"
@@ -154,8 +155,6 @@ Key *BKE_key_copy(Key *key)
Key *keyn;
KeyBlock *kbn, *kb;
- if (key == NULL) return NULL;
-
keyn = BKE_libblock_copy(&key->id);
BLI_duplicatelist(&keyn->block, &key->block);
@@ -184,9 +183,6 @@ Key *BKE_key_copy_nolib(Key *key)
Key *keyn;
KeyBlock *kbn, *kb;
- if (key == NULL)
- return NULL;
-
keyn = MEM_dupallocN(key);
keyn->adt = NULL;
@@ -207,17 +203,16 @@ Key *BKE_key_copy_nolib(Key *key)
return keyn;
}
-void BKE_key_make_local(Key *key)
+void BKE_key_make_local(Main *bmain, Key *key)
{
+ /* Note that here for now we simply just make it local...
+ * Sounds fishy behavior, but since skeys are not *real* IDs... */
- /* - only lib users: do nothing
- * - only local users: set flag
- * - mixed: make copy
- */
- if (key == NULL) return;
-
- key->id.lib = NULL;
- new_id(NULL, &key->id, NULL);
+ if (!ID_IS_LINKED_DATABLOCK(key)) {
+ return;
+ }
+
+ id_clear_lib_data(bmain, &key->id);
}
/* Sort shape keys and Ipo curves after a change. This assumes that at most