diff options
Diffstat (limited to 'source/blender/blenkernel/intern/node.c')
-rw-r--r-- | source/blender/blenkernel/intern/node.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index d6225560e32..4fbc5c3f2d9 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1114,20 +1114,13 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, Main *bmain, bool do_ if (ntree == NULL) return NULL; - if (bmain) { - /* is ntree part of library? */ - if (BLI_findindex(&bmain->nodetree, ntree) != -1) - newtree = BKE_libblock_copy(&ntree->id); - else - newtree = NULL; + /* is ntree part of library? */ + if (bmain && BLI_findindex(&bmain->nodetree, ntree) >= 0) { + newtree = BKE_libblock_copy(&ntree->id); } - else - newtree = NULL; - - if (newtree == NULL) { - newtree = MEM_dupallocN(ntree); + else { + newtree = BKE_libblock_copy_nolib(&ntree->id); newtree->id.lib = NULL; /* same as owning datablock id.lib */ - BKE_libblock_copy_data(&newtree->id, &ntree->id, true); /* copy animdata and ID props */ } id_us_plus((ID *)newtree->gpd); |