From f18f2fbb33d90ecc91e6f3d063cb9f97f217e808 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sat, 28 Sep 2013 19:28:41 +0000 Subject: [PATCH] Fix [#36831] Grease Pencil dont create a drawing in current frame less than 1 Only forbid negframes when user has not allowed them in whole Blender (userpref, editing). Else, it's more than annoying to not be able to draw negframed gpencil. --- source/blender/blenkernel/intern/gpencil.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 31dd79e7623..4d17bd286b4 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -42,6 +42,7 @@ #include "BLF_translation.h" #include "DNA_gpencil_types.h" +#include "DNA_userdef_types.h" #include "BKE_global.h" #include "BKE_gpencil.h" @@ -125,8 +126,8 @@ bGPDframe *gpencil_frame_addnew(bGPDlayer *gpl, int cframe) bGPDframe *gpf, *gf; short state = 0; - /* error checking */ - if ((gpl == NULL) || (cframe <= 0)) + /* error checking (neg frame only if they are not allowed in Blender!) */ + if ((gpl == NULL) || ((U.flag & USER_NONEGFRAMES) && (cframe <= 0))) return NULL; /* allocate memory for this frame */ @@ -349,7 +350,8 @@ bGPDframe *gpencil_layer_getframe(bGPDlayer *gpl, int cframe, short addnew) /* error checking */ if (gpl == NULL) return NULL; - if (cframe <= 0) cframe = 1; + /* 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) {