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/lamp.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/lamp.c')
-rw-r--r--source/blender/blenkernel/intern/lamp.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 3e656a2433d..e1aec61d3f6 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -127,7 +127,6 @@ Lamp *BKE_lamp_copy(Main *bmain, Lamp *la)
if (lan->mtex[a]) {
lan->mtex[a] = MEM_mallocN(sizeof(MTex), "copylamptex");
memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
- id_us_plus((ID *)lan->mtex[a]->tex);
}
}
@@ -136,9 +135,10 @@ Lamp *BKE_lamp_copy(Main *bmain, Lamp *la)
if (la->nodetree)
lan->nodetree = ntreeCopyTree(bmain, la->nodetree);
- if (la->preview)
- lan->preview = BKE_previewimg_copy(la->preview);
-
+ lan->preview = BKE_previewimg_copy(la->preview);
+
+ BKE_id_expand_local(&lan->id, true);
+
if (ID_IS_LINKED_DATABLOCK(la)) {
BKE_id_lib_local_paths(bmain, la->id.lib, &lan->id);
}
@@ -167,26 +167,11 @@ Lamp *localize_lamp(Lamp *la)
if (la->nodetree)
lan->nodetree = ntreeLocalize(la->nodetree);
- lan->preview = BKE_previewimg_copy(la->preview);
+ lan->preview = NULL;
return lan;
}
-static int extern_local_lamp_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_lamp(Lamp *la)
-{
- BKE_library_foreach_ID_link(&la->id, extern_local_lamp_callback, NULL, 0);
-}
-
void BKE_lamp_make_local(Main *bmain, Lamp *la)
{
bool is_local = false, is_lib = false;
@@ -205,7 +190,7 @@ void BKE_lamp_make_local(Main *bmain, Lamp *la)
if (is_local) {
if (!is_lib) {
id_clear_lib_data(bmain, &la->id);
- extern_local_lamp(la);
+ BKE_id_expand_local(&la->id, false);
}
else {
Lamp *la_new = BKE_lamp_copy(bmain, la);