From 731f3476b7b4660adc446bfb1c6061c20a7d0c1b Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sat, 22 Nov 2014 18:03:37 +1300 Subject: Fix for previous commit gpencil_data_duplicate() was being used for gp drawing undo buffers, where using an exact copy is exactly what we want/need. Instead, the code here now has an additional arg for determining whether a direct copy is warranted or not. --- source/blender/blenkernel/intern/gpencil.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/gpencil.c') diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 255693f0ca2..2011f41622d 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -276,7 +276,7 @@ bGPDlayer *gpencil_layer_duplicate(bGPDlayer *src) } /* make a copy of a given gpencil datablock */ -bGPdata *gpencil_data_duplicate(bGPdata *src) +bGPdata *gpencil_data_duplicate(bGPdata *src, bool internal_copy) { bGPDlayer *gpl, *gpld; bGPdata *dst; @@ -286,7 +286,14 @@ bGPdata *gpencil_data_duplicate(bGPdata *src) return NULL; /* make a copy of the base-data */ - dst = BKE_libblock_copy(&src->id); + if (internal_copy) { + /* make a straight copy for undo buffers used during stroke drawing */ + dst = MEM_dupallocN(src); + } + else { + /* make a copy when others use this */ + dst = BKE_libblock_copy(&src->id); + } /* copy layers */ BLI_listbase_clear(&dst->layers); -- cgit v1.2.3