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
path: root/source
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2013-06-05 23:06:27 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-06-05 23:06:27 +0400
commit4c2a51e1f9691522d083d035b8d6b707bf1e4450 (patch)
tree1e7cf578a71b0c25018bfc4ab9b2c94c77629630 /source
parentf18fad668f67428698f4a87d08ded5858be3f018 (diff)
Fix #35640, part 1. Set the id.lib pointer for nested bNodeTree data blocks inside material, scene, etc. on lib_link, so that the UI buttons get disabled when editing linked node trees. Thanks to Brecht
van Lommel for suggesting this fix.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/lamp.c6
-rw-r--r--source/blender/blenkernel/intern/material.c6
-rw-r--r--source/blender/blenkernel/intern/node.c1
-rw-r--r--source/blender/blenkernel/intern/texture.c6
-rw-r--r--source/blender/blenkernel/intern/world.c6
-rw-r--r--source/blender/blenloader/intern/readfile.c17
6 files changed, 38 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 903b032e080..1f381a1a2c2 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -172,6 +172,9 @@ 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;
}
@@ -186,6 +189,9 @@ 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/material.c b/source/blender/blenkernel/intern/material.c
index c8cd65e9477..87fb64c0761 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -308,6 +308,9 @@ 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;
}
@@ -370,6 +373,9 @@ 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/node.c b/source/blender/blenkernel/intern/node.c
index 4f3bf4d1c0c..f9128eae866 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1124,6 +1124,7 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, const short do_id_use
}
else {
newtree = MEM_dupallocN(ntree);
+ ntree->id.lib = NULL; /* same as owning datablock id.lib */
BKE_libblock_copy_data(&newtree->id, &ntree->id, true); /* copy animdata and ID props */
}
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 1d0b0deae7e..be48c7cf12a 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -765,6 +765,9 @@ 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;
}
@@ -824,6 +827,9 @@ 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 206f829eaa8..050fcd2600b 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -179,6 +179,9 @@ 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;
}
@@ -191,6 +194,9 @@ 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);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 7f1f00431d3..e3d4acef644 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2967,8 +2967,10 @@ static void lib_link_lamp(FileData *fd, Main *main)
la->ipo = newlibadr_us(fd, la->id.lib, la->ipo); // XXX deprecated - old animation system
- if (la->nodetree)
+ if (la->nodetree) {
lib_link_ntree(fd, &la->id, la->nodetree);
+ la->nodetree->id.lib = la->id.lib;
+ }
la->id.flag -= LIB_NEED_LINK;
}
@@ -3140,8 +3142,10 @@ static void lib_link_world(FileData *fd, Main *main)
}
}
- if (wrld->nodetree)
+ if (wrld->nodetree) {
lib_link_ntree(fd, &wrld->id, wrld->nodetree);
+ wrld->nodetree->id.lib = wrld->id.lib;
+ }
wrld->id.flag -= LIB_NEED_LINK;
}
@@ -3429,8 +3433,10 @@ static void lib_link_texture(FileData *fd, Main *main)
if (tex->ot)
tex->ot->object = newlibadr(fd, tex->id.lib, tex->ot->object);
- if (tex->nodetree)
+ if (tex->nodetree) {
lib_link_ntree(fd, &tex->id, tex->nodetree);
+ tex->nodetree->id.lib = tex->id.lib;
+ }
tex->id.flag -= LIB_NEED_LINK;
}
@@ -3511,8 +3517,10 @@ static void lib_link_material(FileData *fd, Main *main)
}
}
- if (ma->nodetree)
+ if (ma->nodetree) {
lib_link_ntree(fd, &ma->id, ma->nodetree);
+ ma->nodetree->id.lib = ma->id.lib;
+ }
ma->id.flag -= LIB_NEED_LINK;
}
@@ -5160,6 +5168,7 @@ static void lib_link_scene(FileData *fd, Main *main)
if (sce->nodetree) {
lib_link_ntree(fd, &sce->id, sce->nodetree);
+ sce->nodetree->id.lib = sce->id.lib;
composite_patch(sce->nodetree, sce);
}