[Bf-blender-cvs] [04fcd847947] greasepencil-object: Code Cleanup: Replaced inlined layer-copying code with a call to the copy_ex() method

Joshua Leung noreply at git.blender.org
Tue Sep 26 07:51:05 CEST 2017


Commit: 04fcd847947e32acc6ea37d1fac06f220f459bd6
Author: Joshua Leung
Date:   Tue Sep 26 15:40:46 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rB04fcd847947e32acc6ea37d1fac06f220f459bd6

Code Cleanup: Replaced inlined layer-copying code with a call to the copy_ex() method

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

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

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index ff6f2924394..b3bd6bd0b6f 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -951,7 +951,7 @@ bGPDlayer *BKE_gpencil_layer_duplicate(const bGPDlayer *gpl_src)
 
 /**
  * Only copy internal data of GreasePencil ID from source to already allocated/initialized destination.
- * You probably nerver want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ * You probably never want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
  *
  * WARNING! This function will not handle ID user count!
  *
@@ -987,8 +987,6 @@ bGPdata *BKE_gpencil_copy(Main *bmain, const bGPdata *gpd)
 // XXX: Should this be deprecated?
 bGPdata *BKE_gpencil_data_duplicate(Main *bmain, const bGPdata *gpd_src, bool internal_copy)
 {
-	const bGPDlayer *gpl_src;
-	bGPDlayer *gpl_dst;
 	bGPdata *gpd_dst;
 
 	/* Yuck and super-uber-hyper yuck!!!
@@ -1010,13 +1008,8 @@ bGPdata *BKE_gpencil_data_duplicate(Main *bmain, const bGPdata *gpd_src, bool in
 		gpd_dst->batch_cache_data = NULL;
 	}
 	
-	/* copy layers */
-	BLI_listbase_clear(&gpd_dst->layers);
-	for (gpl_src = gpd_src->layers.first; gpl_src; gpl_src = gpl_src->next) {
-		/* make a copy of source layer and its data */
-		gpl_dst = BKE_gpencil_layer_duplicate(gpl_src);
-		BLI_addtail(&gpd_dst->layers, gpl_dst);
-	}
+	/* Copy internal data (layers, etc.) */
+	BKE_gpencil_copy_data(bmain, gpd_dst, gpd_src, 0);
 	
 	/* return new */
 	return gpd_dst;



More information about the Bf-blender-cvs mailing list