diff options
author | Xiao Xiangquan <xiaoxiangquan@gmail.com> | 2011-09-01 19:08:32 +0400 |
---|---|---|
committer | Xiao Xiangquan <xiaoxiangquan@gmail.com> | 2011-09-01 19:08:32 +0400 |
commit | 981f7fcd0d315abb425bf34dd37f7cd4d9e8d55e (patch) | |
tree | 70800c93ec1a12579c32874e2a72eaf3290eba8e /source/blender/editors/gpencil/gpencil_paint.c | |
parent | 5b91a783cf0ec132398a2767d3419d675e5126b5 (diff) | |
parent | 2365c64014b3e067bb212b2061f1d14c1f944090 (diff) |
merge with trunk r39834
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_paint.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 0323d1f9e45..0ca30866f0d 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1,6 +1,4 @@ /* - * $Id$ - * * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -1617,7 +1615,12 @@ static int gpencil_area_exists(bContext *C, ScrArea *satest) static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) { tGPsdata *p= op->customdata; - int estate = OPERATOR_PASS_THROUGH; /* default exit state - not handled, so let others have a share of the pie */ + //int estate = OPERATOR_PASS_THROUGH; /* default exit state - not handled, so let others have a share of the pie */ + /* currently, grease pencil conflicts with such operators as undo and set object mode + which makes behavior of operator totally unpredictable and crash for some cases. + the only way to solve this proper is to ger rid of pointers to data which can + chage stored in operator custom data (sergey) */ + int estate = OPERATOR_RUNNING_MODAL; // if (event->type == NDOF_MOTION) // return OPERATOR_PASS_THROUGH; @@ -1724,13 +1727,18 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event) /* standard undo/redo shouldn't be allowed to execute or else it causes crashes, so catch it here */ // FIXME: this is a hardcoded hotkey that can't be changed // TODO: catch redo as well, but how? - if (event->type == ZKEY) { + if (event->type == ZKEY && event->val == KM_RELEASE) { /* oskey = cmd key on macs as they seem to use cmd-z for undo as well? */ if ((event->ctrl) || (event->oskey)) { /* just delete last stroke, which will look like undo to the end user */ //printf("caught attempted undo event... deleting last stroke \n"); gpencil_frame_delete_laststroke(p->gpl, p->gpf); - + /* undoing the last line can free p->gpf + * note, could do this in a bit more of an elegant way then a search but it at least prevents a crash */ + if(BLI_findindex(&p->gpl->frames, p->gpf) == -1) { + p->gpf= NULL; + } + /* event handled, so force refresh */ ED_region_tag_redraw(p->ar); /* just active area for now, since doing whole screen is too slow */ estate = OPERATOR_RUNNING_MODAL; |