Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2014-11-22 08:03:37 +0300
committerJoshua Leung <aligorith@gmail.com>2014-11-22 08:05:46 +0300
commit731f3476b7b4660adc446bfb1c6061c20a7d0c1b (patch)
treeffc3fbd9125e7a2f0d988329d37a009ac907eddc /source/blender/blenkernel/intern/gpencil.c
parent8319a91ad4c010dc6060260b36fe5cb15c55e005 (diff)
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.
Diffstat (limited to 'source/blender/blenkernel/intern/gpencil.c')
-rw-r--r--source/blender/blenkernel/intern/gpencil.c11
1 files changed, 9 insertions, 2 deletions
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);