diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-03-21 17:07:49 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2014-03-21 17:07:49 +0400 |
commit | 6e99fb04b6cccef4d5685184dfd0d1406fc6e624 (patch) | |
tree | d3accf9af5b16ca867e945317a8eefcd727bfcf8 /source/blender/blenkernel/intern/node.c | |
parent | c626462c0fe1257c07948b49db1a41526682ba3f (diff) |
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.
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 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); |