diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image.c | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index db575907b49..1408647d1cb 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -4858,7 +4858,6 @@ static int paint_exec(bContext *C, wmOperator *op) static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event) { - ARegion *ar= CTX_wm_region(C); PaintOperation *pop= op->customdata; wmTabletData *wmtab; PointerRNA itemptr; @@ -4868,8 +4867,8 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event) // XXX +1 matches brush location better but // still not exact, find out why and fix .. - mouse[0]= event->x - ar->winrct.xmin + 1; - mouse[1]= event->y - ar->winrct.ymin + 1; + mouse[0]= event->mval[0] + 1; + mouse[1]= event->mval[1] + 1; time= PIL_check_seconds_timer(); @@ -5185,16 +5184,8 @@ static int sample_color_exec(bContext *C, wmOperator *op) static int sample_color_invoke(bContext *C, wmOperator *op, wmEvent *event) { - ARegion *ar= CTX_wm_region(C); - int location[2]; - - if(ar) { - location[0]= event->x - ar->winrct.xmin; - location[1]= event->y - ar->winrct.ymin; - RNA_int_set_array(op->ptr, "location", location); - - sample_color_exec(C, op); - } + RNA_int_set_array(op->ptr, "location", event->mval); + sample_color_exec(C, op); WM_event_add_modal_handler(C, op); @@ -5203,21 +5194,13 @@ static int sample_color_invoke(bContext *C, wmOperator *op, wmEvent *event) static int sample_color_modal(bContext *C, wmOperator *op, wmEvent *event) { - ARegion *ar= CTX_wm_region(C); - int location[2]; - switch(event->type) { case LEFTMOUSE: case RIGHTMOUSE: // XXX hardcoded return OPERATOR_FINISHED; case MOUSEMOVE: - if(ar) { - location[0]= event->x - ar->winrct.xmin; - location[1]= event->y - ar->winrct.ymin; - RNA_int_set_array(op->ptr, "location", location); - - sample_color_exec(C, op); - } + RNA_int_set_array(op->ptr, "location", event->mval); + sample_color_exec(C, op); break; } @@ -5284,14 +5267,10 @@ static int set_clone_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event) View3D *v3d= CTX_wm_view3d(C); ARegion *ar= CTX_wm_region(C); float location[3]; - int mval[2]; - - mval[0]= event->x - ar->winrct.xmin; - mval[1]= event->y - ar->winrct.ymin; view3d_operator_needs_opengl(C); - if(!view_autodist(scene, ar, v3d, mval, location)) + if(!view_autodist(scene, ar, v3d, event->mval, location)) return OPERATOR_CANCELLED; RNA_float_set_array(op->ptr, "location", location); |