diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-08-27 05:01:13 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-08-27 05:01:13 +0400 |
commit | 65b7d58fa212377226f9a132cfd274a76328e2a6 (patch) | |
tree | 6e62b8481dd9e42df22ad70b443caa4c3cb8638c /source/blender/editors/gpencil | |
parent | a3bc7f3d1d2824a1d05832a4c9186f440fbb91b0 (diff) |
Grease Pencil: Bugfixes
* Realtime updates now work again
* Fixed problems with clicks to start drawing resulting in a stroke being ended.
* Changed the hotkeys to Ctrl-Alt-Shift-LMB (draw) and Ctrl-Alt-Shift-RMB (erase). Still very temporary stuff, will probably change these a few more times as I experiment with new approaches.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 26 |
2 files changed, 21 insertions, 13 deletions
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index c5fa8398cd8..c18c7bb3f78 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -47,14 +47,18 @@ void gpencil_common_keymap(wmWindowManager *wm, ListBase *keymap) { - wmKeymapItem *km; + wmKeymapItem *kmi; /* if no keymap provided, use default */ if (keymap == NULL) keymap= WM_keymap_listbase(wm, "Grease Pencil Generic", 0, 0); /* Draw */ - WM_keymap_add_item(keymap, "GPENCIL_OT_draw", SKEY, KM_PRESS, 0, DKEY); + /* draw */ + WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0); + /* erase */ + kmi=WM_keymap_add_item(keymap, "GPENCIL_OT_draw", LEFTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0); + RNA_enum_set(kmi->ptr, "mode", 1); // XXX need to make the defines for this public (this is GP_PAINTMODE_ERASER) } /* ****************************************** */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index dc701924b3e..059c3417a04 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -859,7 +859,7 @@ static tGPsdata *gp_session_initpaint (bContext *C) p->scene->gpd= p->gpd; } - /* set edit flags */ + /* set edit flags - so that buffer will get drawn */ G.f |= G_GREASEPENCIL; /* set initial run flag */ @@ -1171,7 +1171,7 @@ static void gpencil_draw_apply_event (bContext *C, wmOperator *op, wmEvent *even } /* force refresh */ - ED_area_tag_redraw(p->sa); // XXX this is crude + WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); // XXX please work! } /* ------------------------------- */ @@ -1216,6 +1216,18 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) printf("\tGP - handle modal event...\n"); switch (event->type) { + /* end of stroke -> ONLY when a mouse-button release occurs + * otherwise, carry on to mouse-move... + */ + case LEFTMOUSE: + case MIDDLEMOUSE: + case RIGHTMOUSE: + if (event->val != KM_PRESS) { + printf("\t\tGP - end of stroke \n"); + gpencil_draw_exit(C, op); + return OPERATOR_FINISHED; + } + /* moving mouse - assumed that mouse button is down */ case MOUSEMOVE: /* handle drawing event */ @@ -1230,14 +1242,6 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) } break; - /* end of stroke - i.e. when a mouse-button release occurs */ - case LEFTMOUSE: - case MIDDLEMOUSE: - case RIGHTMOUSE: - printf("\t\tGP - end of stroke \n"); - gpencil_draw_exit(C, op); - return OPERATOR_FINISHED; - /* scrolling mouse-wheel increases radius of eraser * - though this is quite a difficult action to perform */ @@ -1259,7 +1263,7 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) break; default: - return OPERATOR_RUNNING_MODAL|OPERATOR_PASS_THROUGH; + printf("\t\tGP unknown event - %d \n", event->type); break; } |