[Bf-blender-cvs] [731f347] master: Fix for previous commit

Joshua Leung noreply at git.blender.org
Sat Nov 22 06:07:13 CET 2014


Commit: 731f3476b7b4660adc446bfb1c6061c20a7d0c1b
Author: Joshua Leung
Date:   Sat Nov 22 18:03:37 2014 +1300
Branches: master
https://developer.blender.org/rB731f3476b7b4660adc446bfb1c6061c20a7d0c1b

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.

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

M	source/blender/blenkernel/BKE_gpencil.h
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/editors/gpencil/gpencil_undo.c
M	source/blender/editors/space_sequencer/space_sequencer.c

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

diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index 86c1116..c21207c 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -49,11 +49,7 @@ struct bGPdata *gpencil_data_addnew(const char name[]);
 
 struct bGPDframe *gpencil_frame_duplicate(struct bGPDframe *src);
 struct bGPDlayer *gpencil_layer_duplicate(struct bGPDlayer *src);
-struct bGPdata *gpencil_data_duplicate(struct bGPdata *gpd);
-
-//struct bGPdata *gpencil_data_getactive(struct ScrArea *sa);
-//short gpencil_data_setactive(struct ScrArea *sa, struct bGPdata *gpd);
-//struct ScrArea *gpencil_data_findowner(struct bGPdata *gpd);
+struct bGPdata *gpencil_data_duplicate(struct bGPdata *gpd, bool internal_copy);
 
 void gpencil_frame_delete_laststroke(struct bGPDlayer *gpl, struct bGPDframe *gpf);
 
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 255693f..2011f41 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);
diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c
index ff92d69..9a71c65 100644
--- a/source/blender/editors/gpencil/gpencil_undo.c
+++ b/source/blender/editors/gpencil/gpencil_undo.c
@@ -145,7 +145,7 @@ void gpencil_undo_push(bGPdata *gpd)
 
 	/* create new undo node */
 	undo_node = MEM_callocN(sizeof(bGPundonode), "gpencil undo node");
-	undo_node->gpd = gpencil_data_duplicate(gpd);
+	undo_node->gpd = gpencil_data_duplicate(gpd, true);
 
 	cur_node = undo_node;
 
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index c0cfaed..007d3c4 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -328,7 +328,7 @@ static SpaceLink *sequencer_duplicate(SpaceLink *sl)
 	SpaceSeq *sseqn = MEM_dupallocN(sl);
 	
 	/* clear or remove stuff from old */
-// XXX	sseq->gpd = gpencil_data_duplicate(sseq->gpd);
+// XXX	sseq->gpd = gpencil_data_duplicate(sseq->gpd, false);
 
 	memset(&sseqn->scopes, 0, sizeof(sseqn->scopes));




More information about the Bf-blender-cvs mailing list