[Bf-blender-cvs] [582fa5e] master: Fix for Grease Pencil and negative frames

Joshua Leung noreply at git.blender.org
Fri Apr 17 03:04:56 CEST 2015


Commit: 582fa5e36e031e08b2af39d055ac6790a12941ee
Author: Joshua Leung
Date:   Fri Apr 17 12:27:27 2015 +1200
Branches: master
https://developer.blender.org/rB582fa5e36e031e08b2af39d055ac6790a12941ee

Fix for Grease Pencil and negative frames

While investigating T44412, I noticed some weirdness going on when trying to
draw on frame 0 (i.e. strokes were getting added to frame 1 instead). Clearly,
this seemed like an off-by-one error related to clamping to prevent negative
frames which was also excluding frame 0.

This commit reverts the fixes made for T36831 in:
rBf18f2fbb33d90ecc91e6f3d063cb9f97f217e808

After thinking this over, I think these checks against drawing on negative
frames aren't needed. Even if the current userpref setting doesn't allow
navigating to negative frames, this may not be true for other users that
may work on the same file (in a team environment). Also, negative frame
values can get set via the dopesheet.

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

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 17d8739..ba4077e 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -133,7 +133,7 @@ bGPDframe *gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
 	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 */
@@ -388,8 +388,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) {
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 6b61b37..2f4e788 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -568,7 +568,7 @@ static void rna_def_gpencil_frame(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "frame_number", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "framenum");
 	/* XXX note: this cannot occur on the same frame as another sketch */
-	RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
+	RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
 	RNA_def_property_ui_text(prop, "Frame Number", "The frame on which this sketch appears");
 	
 	/* Flags */
@@ -579,7 +579,9 @@ static void rna_def_gpencil_frame(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_FRAME_SELECT);
 	RNA_def_property_ui_text(prop, "Select", "Frame is selected for editing in the Dope Sheet");
-
+	
+	
+	/* API */
 	func = RNA_def_function(srna, "clear", "rna_GPencil_frame_clear");
 	RNA_def_function_ui_description(func, "Remove all the grease pencil frame data");
 }




More information about the Bf-blender-cvs mailing list