From 6e99fb04b6cccef4d5685184dfd0d1406fc6e624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Fri, 21 Mar 2014 14:07:49 +0100 Subject: Use the new BKE_libblock_copy_nolib function for bNodeTree datablocks as well. These were already doing the same thing, just not as nice. Only difference is the do_action argument (false for BKE_libblock_copy_nolib) but this is of no consequence because the function is only called for trees nested inside material, scene, etc., which never have own actions. --- source/blender/blenkernel/intern/node.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'source/blender/blenkernel/intern/node.c') diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 249fb5264fe..d8d83cb536b 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); -- cgit v1.2.3