diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-06-29 18:10:42 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-06-29 18:10:42 +0300 |
commit | 58d6cbba6da31db8dc8a2b42d528b9a353081904 (patch) | |
tree | 04b57a2f809c6f08d84a082edf061f3ece631860 /source/blender/blenkernel/intern/gpencil.c | |
parent | 94549adec4b6857fb6ec4cf77606da51ff7c26b7 (diff) | |
parent | 295d0c52a26730edc6d4ed1276e4051cce006be5 (diff) |
Merge branch 'master' into temp-ghash-setopstemp-ghash-setops
Diffstat (limited to 'source/blender/blenkernel/intern/gpencil.c')
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index dd2155505fb..38a84296ca6 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -119,7 +119,7 @@ void BKE_gpencil_free(bGPdata *gpd) /* free animation data */ if (gpd->adt) { - BKE_free_animdata(&gpd->id); + BKE_animdata_free(&gpd->id); gpd->adt = NULL; } } @@ -129,11 +129,11 @@ void BKE_gpencil_free(bGPdata *gpd) /* add a new gp-frame to the given layer */ bGPDframe *gpencil_frame_addnew(bGPDlayer *gpl, int cframe) { - bGPDframe *gpf, *gf; + bGPDframe *gpf = NULL, *gf = NULL; short state = 0; /* error checking (neg frame only if they are not allowed in Blender!) */ - if ((gpl == NULL) || ((U.flag & USER_NONEGFRAMES) && (cframe <= 0))) + if (gpl == NULL) return NULL; /* allocate memory for this frame */ @@ -160,8 +160,14 @@ bGPDframe *gpencil_frame_addnew(bGPDlayer *gpl, int cframe) /* check whether frame was added successfully */ if (state == -1) { + printf("Error: Frame (%d) existed already for this layer. Using existing frame\n", cframe); + + /* free the newly created one, and use the old one instead */ MEM_freeN(gpf); - printf("Error: frame (%d) existed already for this layer\n", cframe); + + /* return existing frame instead... */ + BLI_assert(gf != NULL); + gpf = gf; } else if (state == 0) { /* add to end then! */ @@ -388,8 +394,6 @@ bGPDframe *gpencil_layer_getframe(bGPDlayer *gpl, int cframe, short addnew) /* error checking */ if (gpl == NULL) return NULL; - /* No reason to forbid negative frames when they are allowed in Blender! */ - if ((U.flag & USER_NONEGFRAMES) && cframe <= 0) cframe = 1; /* check if there is already an active frame */ if (gpl->actframe) { |