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 | |
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')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 26 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 6 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 1 |
4 files changed, 25 insertions, 16 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; } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 07ffb35f807..4ca1f296f15 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2084,7 +2084,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) /* draw grease-pencil stuff */ //if (v3d->flag2 & V3D_DISPGP) - draw_gpencil_3dview(C, 1); + draw_gpencil_3dview((bContext *)C, 1); BDR_drawSketch(C); @@ -2100,9 +2100,9 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) if(rv3d->persp>1) drawviewborder(scene, ar, v3d); if(rv3d->rflag & RV3D_FLYMODE) drawviewborder_flymode(ar); - /* draw grease-pencil stuff */ + /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */ // if (v3d->flag2 & V3D_DISPGP) -// draw_gpencil_3dview(ar, 0); + draw_gpencil_3dview((bContext *)C, 0); drawcursor(scene, ar, v3d); diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 42ee6e926fc..5687cb565d1 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -149,6 +149,7 @@ typedef struct wmNotifier { #define ND_SCREENDELETE (2<<16) #define ND_SCREENCAST (3<<16) #define ND_ANIMPLAY (4<<16) +#define ND_GPENCIL (5<<16) /* NC_SCENE Scene */ #define ND_SCENEBROWSE (1<<16) |