From 607a56cb7a0e5a7fef2214d60a723dd67e8209ab Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 31 Jan 2009 10:00:08 +0000 Subject: [PATCH] 2.5 - Made standard border operator calls bail out on zero sized borders - Fixed compile warning in call to BKE_animsys_evaluate_animdata() --- source/blender/blenkernel/intern/action.c | 2 +- .../windowmanager/intern/wm_operators.c | 32 ++++++++++++------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 3758f9ba0db..c05aad07fce 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -710,7 +710,7 @@ void what_does_obaction (Scene *scene, Object *ob, Object *workob, bPose *pose, adt.action= act; /* execute effects of Action on to workob (or it's PoseChannels) */ - BKE_animsys_evaluate_animdata(workob, &adt, cframe, ADT_RECALC_ANIM); + BKE_animsys_evaluate_animdata(&workob->id, &adt, cframe, ADT_RECALC_ANIM); } /* ********** NLA with non-poses works with ipo channels ********** */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 9d59e71981e..a496ebc3bea 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -519,7 +519,7 @@ void WM_paint_cursor_end(wmWindowManager *wm, void *handle) It stores 4 values (xmin, xmax, ymin, ymax) and event it ended with (event_type) */ -static void border_apply(bContext *C, wmOperator *op, int event_type) +static int border_apply(bContext *C, wmOperator *op, int event_type) { wmGesture *gesture= op->customdata; rcti *rect= gesture->customdata; @@ -529,15 +529,20 @@ static void border_apply(bContext *C, wmOperator *op, int event_type) if(rect->ymin > rect->ymax) SWAP(int, rect->ymin, rect->ymax); - /* operator arguments and storage. */ - RNA_int_set(op->ptr, "xmin", rect->xmin); - RNA_int_set(op->ptr, "ymin", rect->ymin); - RNA_int_set(op->ptr, "xmax", rect->xmax); - RNA_int_set(op->ptr, "ymax", rect->ymax); - if( RNA_struct_find_property(op->ptr, "event_type") ) - RNA_int_set(op->ptr, "event_type", event_type); - - op->type->exec(C, op); + if(rect->xmin==rect->xmax || rect->ymin==rect->ymax) + return 0; + else { + + /* operator arguments and storage. */ + RNA_int_set(op->ptr, "xmin", rect->xmin); + RNA_int_set(op->ptr, "ymin", rect->ymin); + RNA_int_set(op->ptr, "xmax", rect->xmax); + RNA_int_set(op->ptr, "ymax", rect->ymax); + if( RNA_struct_find_property(op->ptr, "event_type") ) + RNA_int_set(op->ptr, "event_type", event_type); + + op->type->exec(C, op); + } } static void wm_gesture_end(bContext *C, wmOperator *op) @@ -597,9 +602,12 @@ int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event) } } else { - border_apply(C, op, event->type); + if(border_apply(C, op, event->type)) { + wm_gesture_end(C, op); + return OPERATOR_FINISHED; + } wm_gesture_end(C, op); - return OPERATOR_FINISHED; + return OPERATOR_CANCELLED; } break; case ESCKEY: