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...
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user