[Bf-blender-cvs] [6e99fb0] master: Use the new BKE_libblock_copy_nolib function for bNodeTree datablocks as well.

Lukas Tönne noreply at git.blender.org
Fri Mar 21 14:15:32 CET 2014


Commit: 6e99fb04b6cccef4d5685184dfd0d1406fc6e624
Author: Lukas Tönne
Date:   Fri Mar 21 14:07:49 2014 +0100
https://developer.blender.org/rB6e99fb04b6cccef4d5685184dfd0d1406fc6e624

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.

===================================================================

M	source/blender/blenkernel/intern/node.c

===================================================================

diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 249fb52..d8d83cb 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);




More information about the Bf-blender-cvs mailing list