[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22812] branches/blender2.5/blender/source /blender/editors/gpencil: Grease Pencil: Another quick experiment - easier usage

Joshua Leung aligorith at gmail.com
Thu Aug 27 03:57:15 CEST 2009


Revision: 22812
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22812
Author:   aligorith
Date:     2009-08-27 03:57:09 +0200 (Thu, 27 Aug 2009)

Log Message:
-----------
Grease Pencil: Another quick experiment - easier usage

* Changed the hotkey to simply be:
Hold DKEY, click+drag using Left-Mouse (draw) or Right-Mouse (erase). How to get tablet erasers to work (via keymaps) is on todo...
You can simply hold DKEY until you've finished drawing, thanks to the nice way that keymaps can support standard-key modifiers now.

* Eraser works now too.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/gpencil/gpencil_ops.c
    branches/blender2.5/blender/source/blender/editors/gpencil/gpencil_paint.c

Modified: branches/blender2.5/blender/source/blender/editors/gpencil/gpencil_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/gpencil/gpencil_ops.c	2009-08-27 01:01:13 UTC (rev 22811)
+++ branches/blender2.5/blender/source/blender/editors/gpencil/gpencil_ops.c	2009-08-27 01:57:09 UTC (rev 22812)
@@ -55,9 +55,9 @@
 	
 	/* Draw */
 		/* draw */
-	WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0);
+	WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, 0, DKEY);
 		/* erase */
-	kmi=WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0);
+	kmi=WM_keymap_add_item(keymap, "GPENCIL_OT_draw", RIGHTMOUSE, KM_PRESS, 0, DKEY);
 		RNA_enum_set(kmi->ptr, "mode", 1); // XXX need to make the defines for this public (this is GP_PAINTMODE_ERASER)
 }
 
@@ -67,6 +67,10 @@
 {
 	/* Drawing ----------------------- */
 	WM_operatortype_append(GPENCIL_OT_draw);
+	
+	/* Editing (Buttons) ------------ */
+	
+	/* Editing (Time) --------------- */
 }
 
 /* ****************************************** */

Modified: branches/blender2.5/blender/source/blender/editors/gpencil/gpencil_paint.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/gpencil/gpencil_paint.c	2009-08-27 01:01:13 UTC (rev 22811)
+++ branches/blender2.5/blender/source/blender/editors/gpencil/gpencil_paint.c	2009-08-27 01:57:09 UTC (rev 22812)
@@ -1030,6 +1030,7 @@
 static int gpencil_draw_init (bContext *C, wmOperator *op)
 {
 	tGPsdata *p;
+	wmWindow *win= CTX_wm_window(C);
 	int paintmode= RNA_enum_get(op->ptr, "mode");
 	
 	/* check context */
@@ -1048,9 +1049,14 @@
 	}
 	
 	/* radius for eraser circle is defined in userprefs now */
-	// TODO: make this more easily tweaked... 
 	p->radius= U.gp_eraser;
 	
+	/* set cursor */
+	if (p->paintmode == GP_PAINTMODE_ERASER)
+		WM_cursor_modal(win, BC_CROSSCURSOR); // XXX need a better cursor
+	else
+		WM_cursor_modal(win, BC_PAINTBRUSHCURSOR);
+	
 	/* everything is now setup ok */
 	return 1;
 }
@@ -1065,7 +1071,7 @@
 	G.f &= ~G_GREASEPENCIL;
 	
 	/* restore cursor to indicate end of drawing */
-	// XXX  (cursor callbacks in regiontype) setcursor_space(p.sa->spacetype, CURSOR_STD);
+	WM_cursor_restore(CTX_wm_window(C));
 	
 	/* check size of buffer before cleanup, to determine if anything happened here */
 	if (p->paintmode == GP_PAINTMODE_ERASER) {





More information about the Bf-blender-cvs mailing list