[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47713] trunk/blender/source/blender/ editors/gpencil/gpencil_paint.c: Grease Pencil Eraser - Numpad +/ - and Scrollwheel Up/Down to change radius of

Joshua Leung aligorith at gmail.com
Mon Jun 11 03:28:09 CEST 2012


Revision: 47713
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47713
Author:   aligorith
Date:     2012-06-11 01:27:56 +0000 (Mon, 11 Jun 2012)
Log Message:
-----------
Grease Pencil Eraser - Numpad +/- and Scrollwheel Up/Down to change radius of
brush while erasing

This makes it easier to change the size of the brush without having to jump out
to the User Preferences and back

Modified Paths:
--------------
    trunk/blender/source/blender/editors/gpencil/gpencil_paint.c

Modified: trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- trunk/blender/source/blender/editors/gpencil/gpencil_paint.c	2012-06-11 01:09:25 UTC (rev 47712)
+++ trunk/blender/source/blender/editors/gpencil/gpencil_paint.c	2012-06-11 01:27:56 UTC (rev 47713)
@@ -1329,6 +1329,10 @@
 		if (p->paintmode == GP_PAINTMODE_ERASER) {
 			/* turn off radial brush cursor */
 			gpencil_draw_toggle_eraser_cursor(C, p, FALSE);
+			
+			/* if successful, store the new eraser size to be used again next time */
+			if (p->status == GP_STATUS_DONE)
+				U.gp_eraser = p->radius;
 		}
 		
 		/* cleanup */
@@ -1804,8 +1808,37 @@
 				estate = OPERATOR_RUNNING_MODAL;
 			}
 		}
+		/* eraser size */
+		else if ((p->paintmode == GP_PAINTMODE_ERASER) &&
+		         ELEM4(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE, PADPLUSKEY, PADMINUS))
+		{
+			/* just resize the brush (local version)
+			 * TODO: fix the hardcoded size jumps (set to make a visible difference) and hardcoded keys
+			 */
+			//printf("\t\tGP - resize eraser\n");
+			switch (event->type) {
+				case WHEELUPMOUSE: /* larger */
+				case PADPLUSKEY:
+					p->radius += 5;
+					break;
+					
+				case WHEELDOWNMOUSE: /* smaller */
+				case PADMINUS:
+					p->radius -= 5;
+					
+					if (p->radius < 0) 
+						p->radius = 0;
+					break;
+			}
+			
+			/* force refresh */
+			ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */
+			
+			/* event handled, so just tag as running modal */
+			estate = OPERATOR_RUNNING_MODAL;
+		}
 		/* there shouldn't be any other events, but just in case there are, let's swallow them 
-		 * (i.e. to prevent problems with with undo)
+		 * (i.e. to prevent problems with undo)
 		 */
 		else {
 			/* swallow event to save ourselves trouble */




More information about the Bf-blender-cvs mailing list