diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_gpencil.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 11 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_undo.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/space_sequencer.c | 2 |
4 files changed, 12 insertions, 9 deletions
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index 86c111653d1..c21207c042f 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 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); diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c index ff92d69f39d..9a71c65c105 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 c0cfaed7867..007d3c44a64 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)); |