[Bf-blender-cvs] [cbd25eb3bf3] greasepencil-experimental: GP: Speed Guides: Fix bug in event handling

Charlie Jolly noreply at git.blender.org
Sun Jan 6 04:06:00 CET 2019


Commit: cbd25eb3bf3f658a30c93e1338f375bbda1a5878
Author: Charlie Jolly
Date:   Sun Jan 6 03:05:43 2019 +0000
Branches: greasepencil-experimental
https://developer.blender.org/rBcbd25eb3bf3f658a30c93e1338f375bbda1a5878

GP: Speed Guides: Fix bug in event handling

+ Minor edits

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

M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c
M	source/blender/makesrna/intern/rna_sculpt_paint.c

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

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 3a92792efed..5868c0877df 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2008, Blender Foundation, Joshua Leung
  * This is a new part of Blender
  *
- * Contributor(s): Joshua Leung, Antonio Vazquez
+ * Contributor(s): Joshua Leung, Antonio Vazquez, Charlie Jolly
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -390,7 +390,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
 			 * - nothing more needs to be done here, since view_autodist_simple() has already done it
 			 */
 
-			 /* verify valid zdepth, if it's wrong, the default darwing mode is used
+			 /* verify valid zdepth, if it's wrong, the default drawing mode is used
 			  * and the function doesn't return now */
 			if ((depth == NULL) || (*depth <= 1.0f)) {
 				return;
@@ -2809,11 +2809,14 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
 				break;
 				case GP_GUIDE_GRID:
 				{
-					if (ts->gp_sculpt.use_snapping) {
-						float guide_spacing = gp_float_to_pixel(op, ts->gp_sculpt.guide_spacing);
-						float half = guide_spacing * 0.5f;
+					if (ts->gp_sculpt.use_snapping &&
+						(ts->gp_sculpt.guide_spacing > 0.0f)) {
 						float origin[2];
 						gp_origin_get(op, origin);
+
+						float guide_spacing = gp_float_to_pixel(op, ts->gp_sculpt.guide_spacing);
+						float half = guide_spacing * 0.5f;
+						
 						float point[2];
 						float unit[2];
 						float angle;
@@ -2835,10 +2838,6 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
 							p->mval[0] = gp_snap_to_grid_fl(p->mval[0], origin[0] + half, guide_spacing);
 							p->mval[0] -= half;
 						}
-						
-						
-
-
 					}
 					else if (p->straight == STROKE_HORIZONTAL) {
 						p->mval[1] = p->mvali[1]; /* replace y */
@@ -3319,7 +3318,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
 			case ESCKEY:
 			case RIGHTMOUSE:
 			{
-				if (ELEM(event->val, KM_PRESS, KM_RELEASE)) {
+				if (ELEM(event->val, KM_RELEASE)) {
 					drawmode = true;				
 				}
 			}
@@ -3327,7 +3326,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
 			/* set */
 			case LEFTMOUSE:
 			{
-				if (ELEM(event->val, KM_PRESS, KM_RELEASE)) {
+				if (ELEM(event->val, KM_RELEASE)) {
 					gp_origin_set(op, event->mval);
 					drawmode = true;
 				}
@@ -3343,7 +3342,6 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
 			return OPERATOR_RUNNING_MODAL;
 		}
 	}
-	
 
 	/* we don't pass on key events, GP is used with key-modifiers - prevents Dkey to insert drivers */
 	if (ISKEYBOARD(event->type)) {
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 679f1e0195e..ba49afd0680 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2017, Blender Foundation
  * This is a new part of Blender
  *
- * Contributor(s): Antonio Vazquez
+ * Contributor(s): Antonio Vazquez, Charlie Jolly
  *
  * ***** END GPL LICENSE BLOCK *****
  *
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index ef8a2112d85..333450f52d1 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -1279,10 +1279,10 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
 
 	/* guide */
 	static const EnumPropertyItem prop_gpencil_guidetypes[] = {
-		{GP_GUIDE_CIRCULAR, "CIRCULAR", 0, "Circular", "Use single point"},
-		{GP_GUIDE_RADIAL, "RADIAL", 0, "Radial", "Use single direction"},
+		{GP_GUIDE_CIRCULAR, "CIRCULAR", 0, "Circular", "Use single point to create rings"},
+		{GP_GUIDE_RADIAL, "RADIAL", 0, "Radial", "Use single point as direction"},
 		{GP_GUIDE_PARALLEL, "PARALLEL", 0, "Parallel", "Parallel lines"},
-		{GP_GUIDE_GRID, "GRID", 0, "Grid", "Grid"},
+		{GP_GUIDE_GRID, "GRID", 0, "Grid", "Grid allows horizontal and vertical lines"},
 		{0, NULL, 0, NULL, NULL}
 	};
 
@@ -1296,7 +1296,7 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "use_snapping", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "use_snapping", false);
 	RNA_def_property_boolean_default(prop, false);
-	RNA_def_property_ui_text(prop, "Use snapping", "Snap to angle or spacing depending on guide type");
+	RNA_def_property_ui_text(prop, "Use Snapping", "Enable snapping to guides angle or spacing options");
 	RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
 	RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
 
@@ -1310,7 +1310,7 @@ static void rna_def_gpencil_sculpt(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "guide_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "guide_type");
 	RNA_def_property_enum_items(prop, prop_gpencil_guidetypes);
-	RNA_def_property_ui_text(prop, "Type", "Type of guide");
+	RNA_def_property_ui_text(prop, "Type", "Type of speed guide");
 	RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
 	RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);



More information about the Bf-blender-cvs mailing list