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.
This commit is contained in:
@@ -55,9 +55,9 @@ void gpencil_common_keymap(wmWindowManager *wm, ListBase *keymap)
|
||||
|
||||
/* 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 @@ void ED_operatortypes_gpencil (void)
|
||||
{
|
||||
/* Drawing ----------------------- */
|
||||
WM_operatortype_append(GPENCIL_OT_draw);
|
||||
|
||||
/* Editing (Buttons) ------------ */
|
||||
|
||||
/* Editing (Time) --------------- */
|
||||
}
|
||||
|
||||
/* ****************************************** */
|
||||
|
||||
@@ -1030,6 +1030,7 @@ static void gp_paint_cleanup (tGPsdata *p)
|
||||
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 @@ static int gpencil_draw_init (bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
/* 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 @@ static void gpencil_draw_exit (bContext *C, wmOperator *op)
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user