diff options
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/lamp.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 15 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/world.c | 6 |
5 files changed, 15 insertions, 24 deletions
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c index 1f381a1a2c2..903b032e080 100644 --- a/source/blender/blenkernel/intern/lamp.c +++ b/source/blender/blenkernel/intern/lamp.c @@ -172,9 +172,6 @@ void BKE_lamp_make_local(Lamp *la) if (la->id.lib == NULL) return; if (la->id.us == 1) { id_clear_lib_data(bmain, &la->id); - /* nodetree uses same lib */ - if (la->nodetree) - la->nodetree->id.lib = NULL; return; } @@ -189,9 +186,6 @@ void BKE_lamp_make_local(Lamp *la) if (is_local && is_lib == FALSE) { id_clear_lib_data(bmain, &la->id); - /* nodetree uses same lib */ - if (la->nodetree) - la->nodetree->id.lib = NULL; } else if (is_local && is_lib) { Lamp *la_new = BKE_lamp_copy(la); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index db4706e3c6c..c1715ada7bd 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1428,11 +1428,26 @@ bool new_id(ListBase *lb, ID *id, const char *tname) * don't have other library users. */ void id_clear_lib_data(Main *bmain, ID *id) { + bNodeTree *ntree = NULL; + BKE_id_lib_local_paths(bmain, id->lib, id); id->lib = NULL; id->flag = LIB_LOCAL; new_id(which_libbase(bmain, GS(id->name)), id, NULL); + + /* internal bNodeTree blocks inside ID types below + * also stores id->lib, make sure this stays in sync. + */ + switch (GS(id->name)) { + case ID_SCE: ntree = ((Scene *)id)->nodetree; break; + case ID_MA: ntree = ((Material *)id)->nodetree; break; + case ID_LA: ntree = ((Lamp *)id)->nodetree; break; + case ID_WO: ntree = ((World *)id)->nodetree; break; + case ID_TE: ntree = ((Tex *)id)->nodetree; break; + } + if (ntree) + ntree->id.lib = NULL; } /* next to indirect usage in read/writefile also in editobject.c scene.c */ diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 87fb64c0761..c8cd65e9477 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -308,9 +308,6 @@ void BKE_material_make_local(Material *ma) if (ma->id.us == 1) { id_clear_lib_data(bmain, &ma->id); extern_local_material(ma); - /* nodetree uses same lib */ - if (ma->nodetree) - ma->nodetree->id.lib = NULL; return; } @@ -373,9 +370,6 @@ void BKE_material_make_local(Material *ma) if (is_local && is_lib == FALSE) { id_clear_lib_data(bmain, &ma->id); extern_local_material(ma); - /* nodetree uses same lib */ - if (ma->nodetree) - ma->nodetree->id.lib = NULL; } /* Both user and local, so copy. */ else if (is_local && is_lib) { diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index be48c7cf12a..1d0b0deae7e 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -765,9 +765,6 @@ void BKE_texture_make_local(Tex *tex) if (tex->id.us == 1) { id_clear_lib_data(bmain, &tex->id); extern_local_texture(tex); - /* nodetree uses same lib */ - if (tex->nodetree) - tex->nodetree->id.lib = NULL; return; } @@ -827,9 +824,6 @@ void BKE_texture_make_local(Tex *tex) if (is_local && is_lib == FALSE) { id_clear_lib_data(bmain, &tex->id); extern_local_texture(tex); - /* nodetree uses same lib */ - if (tex->nodetree) - tex->nodetree->id.lib = NULL; } else if (is_local && is_lib) { Tex *tex_new = BKE_texture_copy(tex); diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 050fcd2600b..206f829eaa8 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -179,9 +179,6 @@ void BKE_world_make_local(World *wrld) if (wrld->id.lib == NULL) return; if (wrld->id.us == 1) { id_clear_lib_data(bmain, &wrld->id); - /* nodetree uses same lib */ - if (wrld->nodetree) - wrld->nodetree->id.lib = NULL; return; } @@ -194,9 +191,6 @@ void BKE_world_make_local(World *wrld) if (is_local && is_lib == FALSE) { id_clear_lib_data(bmain, &wrld->id); - /* nodetree uses same lib */ - if (wrld->nodetree) - wrld->nodetree->id.lib = NULL; } else if (is_local && is_lib) { World *wrld_new = BKE_world_copy(wrld); |