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:
-rw-r--r--source/blender/blenkernel/intern/node.c1
-rw-r--r--source/blender/blenloader/intern/readfile.c34
2 files changed, 8 insertions, 27 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 1058b22f96e..eec09973a82 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1211,7 +1211,6 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, Main *bmain, bool ski
}
else {
newtree = BKE_libblock_copy_nolib(&ntree->id, true);
- newtree->id.lib = NULL; /* same as owning datablock id.lib */
}
id_us_plus((ID *)newtree->gpd);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 4ef30fe0f3b..79cd8a7fe6e 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2756,22 +2756,6 @@ static void lib_link_nodetree(FileData *fd, Main *main)
}
}
-/* get node tree stored locally in other IDs */
-static bNodeTree *nodetree_from_id(ID *id)
-{
- if (!id)
- return NULL;
- switch (GS(id->name)) {
- case ID_SCE: return ((Scene *)id)->nodetree;
- case ID_MA: return ((Material *)id)->nodetree;
- case ID_WO: return ((World *)id)->nodetree;
- case ID_LA: return ((Lamp *)id)->nodetree;
- case ID_TE: return ((Tex *)id)->nodetree;
- case ID_LS: return ((FreestyleLineStyle *)id)->nodetree;
- }
- return NULL;
-}
-
/* updates group node socket identifier so that
* external links to/from the group node are preserved.
*/
@@ -6350,11 +6334,9 @@ static void lib_link_screen(FileData *fd, Main *main)
snode->id = newlibadr(fd, sc->id.lib, snode->id);
snode->from = newlibadr(fd, sc->id.lib, snode->from);
- ntree = nodetree_from_id(snode->id);
- if (ntree)
- snode->nodetree = ntree;
- else {
- snode->nodetree = newlibadr_us(fd, sc->id.lib, snode->nodetree);
+ if (snode->id) {
+ ntree = ntreeFromID(snode->id);
+ snode->nodetree = ntree ? ntree : newlibadr_us(fd, sc->id.lib, snode->nodetree);
}
for (path = snode->treepath.first; path; path = path->next) {
@@ -6734,11 +6716,11 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
snode->id = restore_pointer_by_name(id_map, snode->id, USER_REAL);
snode->from = restore_pointer_by_name(id_map, snode->from, USER_IGNORE);
- ntree = nodetree_from_id(snode->id);
- if (ntree)
- snode->nodetree = ntree;
- else
- snode->nodetree = restore_pointer_by_name(id_map, (ID*)snode->nodetree, USER_REAL);
+ if (snode->id) {
+ ntree = ntreeFromID(snode->id);
+ snode->nodetree = ntree ? ntree :
+ restore_pointer_by_name(id_map, (ID *)snode->nodetree, USER_REAL);
+ }
for (path = snode->treepath.first; path; path = path->next) {
if (path == snode->treepath.first) {