From 3c8f22a528b2a2236b8f05ecd69a62e721704944 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 11 Jul 2016 20:45:57 +0200 Subject: Use new generic BKE_id_expand_local() for make_local() for image/material/texture/world. As said in previous commits, did not touch to copy functions for now, due to ntree issues... --- source/blender/blenkernel/intern/image.c | 8 +------- source/blender/blenkernel/intern/linestyle.c | 2 +- source/blender/blenkernel/intern/material.c | 17 +---------------- source/blender/blenkernel/intern/texture.c | 17 +---------------- source/blender/blenkernel/intern/world.c | 17 +---------------- 5 files changed, 5 insertions(+), 56 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 5c223d824ef..4d506746ef5 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -468,12 +468,6 @@ Image *BKE_image_copy(Main *bmain, Image *ima) return nima; } -static void extern_local_image(Image *UNUSED(ima)) -{ - /* Nothing to do: images don't link to other IDs. This function exists to - * match id_make_local pattern. */ -} - void BKE_image_make_local(Main *bmain, Image *ima) { bool is_local = false, is_lib = false; @@ -492,7 +486,7 @@ void BKE_image_make_local(Main *bmain, Image *ima) if (is_local) { if (!is_lib) { id_clear_lib_data(bmain, &ima->id); - extern_local_image(ima); + BKE_id_expand_local(&ima->id, false); } else { Image *ima_new = BKE_image_copy(bmain, ima); diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index 591975b05fa..12fb42bea5f 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -219,7 +219,7 @@ FreestyleLineStyle *BKE_linestyle_copy(struct Main *bmain, FreestyleLineStyle *l BKE_linestyle_geometry_modifier_copy(new_linestyle, m); if (ID_IS_LINKED_DATABLOCK(linestyle)) { - BKE_id_lib_local_paths(G.main, linestyle->id.lib, &new_linestyle->id); + BKE_id_lib_local_paths(bmain, linestyle->id.lib, &new_linestyle->id); } return new_linestyle; diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 3e29a9e91de..8658088e8ed 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -284,21 +284,6 @@ Material *localize_material(Material *ma) return man; } -static int extern_local_material_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_material(Material *ma) -{ - BKE_library_foreach_ID_link(&ma->id, extern_local_material_callback, NULL, 0); -} - void BKE_material_make_local(Main *bmain, Material *ma) { bool is_local = false, is_lib = false; @@ -317,7 +302,7 @@ void BKE_material_make_local(Main *bmain, Material *ma) if (is_local) { if (!is_lib) { id_clear_lib_data(bmain, &ma->id); - extern_local_material(ma); + BKE_id_expand_local(&ma->id, false); } else { Material *ma_new = BKE_material_copy(bmain, ma); diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 459b6f94d5e..6d44e4d7878 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -917,21 +917,6 @@ Tex *BKE_texture_localize(Tex *tex) /* ------------------------------------------------------------------------- */ -static int extern_local_texture_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_texture(Tex *tex) -{ - BKE_library_foreach_ID_link(&tex->id, extern_local_texture_callback, NULL, 0); -} - void BKE_texture_make_local(Main *bmain, Tex *tex) { bool is_local = false, is_lib = false; @@ -950,7 +935,7 @@ void BKE_texture_make_local(Main *bmain, Tex *tex) if (is_local) { if (!is_lib) { id_clear_lib_data(bmain, &tex->id); - extern_local_texture(tex); + BKE_id_expand_local(&tex->id, false); } else { Tex *tex_new = BKE_texture_copy(bmain, tex); diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 69e89fc9171..8ca30af88d8 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -175,21 +175,6 @@ World *localize_world(World *wrld) return wrldn; } -static int extern_local_world_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 expand_local_world(World *wrld) -{ - BKE_library_foreach_ID_link(&wrld->id, extern_local_world_callback, NULL, 0); -} - void BKE_world_make_local(Main *bmain, World *wrld) { bool is_local = false, is_lib = false; @@ -208,7 +193,7 @@ void BKE_world_make_local(Main *bmain, World *wrld) if (is_local) { if (!is_lib) { id_clear_lib_data(bmain, &wrld->id); - expand_local_world(wrld); + BKE_id_expand_local(&wrld->id, false); } else { World *wrld_new = BKE_world_copy(bmain, wrld); -- cgit v1.2.3