Commit: 018d336cbd51a9e4b75f8270e90397d35192496f
Author: Bastien Montagne
Date: Thu Jul 14 15:32:25 2016 +0200
Branches: master
https://developer.blender.org/rB018d336cbd51a9e4b75f8270e90397d35192496f
Cleanup: use BKE's ntreeFromID in readfile instead of local same function.
Also, no need to set ntree->id.lib to NULL after BKE_libblock_copy_nolib(),
generic datablock copy function always make copy local.
===================================================================
M source/blender/blenkernel/intern/node.c
M source/blender/blenloader/intern/readfile.c
===================================================================
diff --git a/source/blender/blenkernel/intern/node.c
b/source/blender/blenkernel/intern/node.c
index 1058b22..eec0997 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 4ef30fe..79cd8a7 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) {
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs