Revision: 36790 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36790 Author: campbellbarton Date: 2011-05-20 07:40:05 +0000 (Fri, 20 May 2011) Log Message: ----------- use event->mval rather then subtracting ar->winrct.x / y from event->x / y
Modified Paths: -------------- trunk/blender/source/blender/editors/animation/anim_channels_edit.c trunk/blender/source/blender/editors/animation/anim_ops.c trunk/blender/source/blender/editors/armature/editarmature.c trunk/blender/source/blender/editors/curve/editcurve.c trunk/blender/source/blender/editors/gpencil/gpencil_paint.c trunk/blender/source/blender/editors/interface/interface_handlers.c trunk/blender/source/blender/editors/interface/view2d_ops.c trunk/blender/source/blender/editors/physics/particle_edit.c trunk/blender/source/blender/editors/sculpt_paint/paint_image.c trunk/blender/source/blender/editors/space_action/action_select.c trunk/blender/source/blender/editors/space_file/file_ops.c trunk/blender/source/blender/editors/space_graph/graph_ops.c trunk/blender/source/blender/editors/space_graph/graph_select.c trunk/blender/source/blender/editors/space_image/image_ops.c trunk/blender/source/blender/editors/space_nla/nla_channels.c trunk/blender/source/blender/editors/space_nla/nla_select.c trunk/blender/source/blender/editors/space_node/node_edit.c trunk/blender/source/blender/editors/space_node/node_select.c trunk/blender/source/blender/editors/space_node/node_state.c trunk/blender/source/blender/editors/space_outliner/outliner.c trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c trunk/blender/source/blender/editors/space_sequencer/sequencer_select.c trunk/blender/source/blender/editors/space_view3d/view3d_edit.c trunk/blender/source/blender/editors/space_view3d/view3d_fly.c trunk/blender/source/blender/editors/transform/transform.c trunk/blender/source/blender/editors/transform/transform.h trunk/blender/source/blender/editors/transform/transform_generics.c trunk/blender/source/blender/editors/transform/transform_input.c trunk/blender/source/blender/editors/uvedit/uvedit_ops.c Modified: trunk/blender/source/blender/editors/animation/anim_channels_edit.c =================================================================== --- trunk/blender/source/blender/editors/animation/anim_channels_edit.c 2011-05-20 05:39:56 UTC (rev 36789) +++ trunk/blender/source/blender/editors/animation/anim_channels_edit.c 2011-05-20 07:40:05 UTC (rev 36790) @@ -2148,7 +2148,7 @@ bAnimContext ac; ARegion *ar; View2D *v2d; - int mval[2], channel_index; + int channel_index; int notifierFlags = 0; short selectmode; float x, y; @@ -2162,10 +2162,6 @@ ar= ac.ar; v2d= &ar->v2d; - /* get mouse coordinates (in region coordinates) */ - mval[0]= (event->x - ar->winrct.xmin); - mval[1]= (event->y - ar->winrct.ymin); - /* select mode is either replace (deselect all, then add) or add/extend */ if (RNA_boolean_get(op->ptr, "extend")) selectmode= SELECT_INVERT; @@ -2179,7 +2175,7 @@ * so that the tops of channels get caught ok. Since ACHANNEL_FIRST is really ACHANNEL_HEIGHT, we simply use * ACHANNEL_HEIGHT_HALF. */ - UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y); + UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, &y); UI_view2d_listview_view_to_cell(v2d, ACHANNEL_NAMEWIDTH, ACHANNEL_STEP, 0, (float)ACHANNEL_HEIGHT_HALF, x, y, NULL, &channel_index); /* handle mouse-click in the relevant channel then */ Modified: trunk/blender/source/blender/editors/animation/anim_ops.c =================================================================== --- trunk/blender/source/blender/editors/animation/anim_ops.c 2011-05-20 05:39:56 UTC (rev 36789) +++ trunk/blender/source/blender/editors/animation/anim_ops.c 2011-05-20 07:40:05 UTC (rev 36790) @@ -107,14 +107,9 @@ { ARegion *region= CTX_wm_region(C); float viewx; - int x, y; - - /* convert screen coordinates to region coordinates */ - x= event->x - region->winrct.xmin; - y= event->y - region->winrct.ymin; - + /* convert from region coordinates to View2D 'tot' space */ - UI_view2d_region_to_view(®ion->v2d, x, y, &viewx, NULL); + UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &viewx, NULL); /* round result to nearest int (frames are ints!) */ return (int)floor(viewx+0.5f); Modified: trunk/blender/source/blender/editors/armature/editarmature.c =================================================================== --- trunk/blender/source/blender/editors/armature/editarmature.c 2011-05-20 05:39:56 UTC (rev 36789) +++ trunk/blender/source/blender/editors/armature/editarmature.c 2011-05-20 07:40:05 UTC (rev 36790) @@ -1522,22 +1522,17 @@ /* within active object context */ /* previously known as "selectconnected_posearmature" */ static int pose_select_connected_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ - ARegion *ar= CTX_wm_region(C); +{ Object *ob= CTX_data_edit_object(C); Bone *bone, *curBone, *next= NULL; int extend= RNA_boolean_get(op->ptr, "extend"); - int x, y; - - x= event->x - ar->winrct.xmin; - y= event->y - ar->winrct.ymin; view3d_operator_needs_opengl(C); if (extend) - bone= get_nearest_bone(C, 0, x, y); + bone= get_nearest_bone(C, 0, event->mval[0], event->mval[1]); else - bone= get_nearest_bone(C, 1, x, y); + bone= get_nearest_bone(C, 1, event->mval[0], event->mval[1]); if (!bone) return OPERATOR_CANCELLED; @@ -1606,21 +1601,17 @@ bArmature *arm; EditBone *bone, *curBone, *next; int extend= RNA_boolean_get(op->ptr, "extend"); - int x, y; ARegion *ar; Object *obedit= CTX_data_edit_object(C); arm= obedit->data; ar= CTX_wm_region(C); - x= event->x - ar->winrct.xmin; - y= event->y - ar->winrct.ymin; - view3d_operator_needs_opengl(C); if (extend) - bone= get_nearest_bone(C, 0, x, y); + bone= get_nearest_bone(C, 0, event->mval[0], event->mval[1]); else - bone= get_nearest_bone(C, 1, x, y); + bone= get_nearest_bone(C, 1, event->mval[0], event->mval[1]); if (!bone) return OPERATOR_CANCELLED; @@ -2499,7 +2490,6 @@ View3D *v3d; RegionView3D *rv3d; float *fp = NULL, tvec[3], oldcurs[3]; - int mx, my; int retv; scene= CTX_data_scene(C); @@ -2510,11 +2500,8 @@ fp= give_cursor(scene, v3d); copy_v3_v3(oldcurs, fp); - - mx= event->x - ar->winrct.xmin; - my= event->y - ar->winrct.ymin; - window_to_3d(ar, tvec, fp, mx, my); + window_to_3d(ar, tvec, fp, event->mval[0], event->mval[1]); copy_v3_v3(fp, tvec); /* extrude to the where new cursor is and store the operation result */ Modified: trunk/blender/source/blender/editors/curve/editcurve.c =================================================================== --- trunk/blender/source/blender/editors/curve/editcurve.c 2011-05-20 05:39:56 UTC (rev 36789) +++ trunk/blender/source/blender/editors/curve/editcurve.c 2011-05-20 07:40:05 UTC (rev 36790) @@ -3309,7 +3309,7 @@ } } -static short findnearestNurbvert(ViewContext *vc, short sel, int mval[2], Nurb **nurb, BezTriple **bezt, BPoint **bp) +static short findnearestNurbvert(ViewContext *vc, short sel, const int mval[2], Nurb **nurb, BezTriple **bezt, BPoint **bp) { /* sel==1: selected gets a disadvantage */ /* in nurb and bezt or bp the nearest is written */ @@ -4666,7 +4666,6 @@ Curve *cu; ViewContext vc; float location[3]; - int mval[2]; Nurb *nu; BezTriple *bezt; @@ -4688,10 +4687,7 @@ copy_v3_v3(location, give_cursor(vc.scene, vc.v3d)); } - mval[0]= event->x - vc.ar->winrct.xmin; - mval[1]= event->y - vc.ar->winrct.ymin; - - view3d_get_view_aligned_coordinate(&vc, location, mval, TRUE); + view3d_get_view_aligned_coordinate(&vc, location, event->mval, TRUE); RNA_float_set_array(op->ptr, "location", location); } @@ -4987,21 +4983,18 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event) { Object *obedit= CTX_data_edit_object(C); - ARegion *ar= CTX_wm_region(C); ViewContext vc; Nurb *nu; BezTriple *bezt; BPoint *bp; - int a, location[2], deselect; + int a, deselect; deselect= RNA_boolean_get(op->ptr, "deselect"); - location[0]= event->x - ar->winrct.xmin; - location[1]= event->y - ar->winrct.ymin; view3d_operator_needs_opengl(C); view3d_set_viewcontext(C, &vc); - findnearestNurbvert(&vc, 1, location, &nu, &bezt, &bp); + findnearestNurbvert(&vc, 1, event->mval, &nu, &bezt, &bp); if(bezt) { a= nu->pntsu; Modified: trunk/blender/source/blender/editors/gpencil/gpencil_paint.c =================================================================== --- trunk/blender/source/blender/editors/gpencil/gpencil_paint.c 2011-05-20 05:39:56 UTC (rev 36789) +++ trunk/blender/source/blender/editors/gpencil/gpencil_paint.c 2011-05-20 07:40:05 UTC (rev 36790) @@ -210,7 +210,7 @@ /* Stroke Editing ---------------------------- */ /* check if the current mouse position is suitable for adding a new point */ -static short gp_stroke_filtermval (tGPsdata *p, int mval[2], int pmval[2]) +static short gp_stroke_filtermval (tGPsdata *p, const int mval[2], int pmval[2]) { int dx= abs(mval[0] - pmval[0]); int dy= abs(mval[1] - pmval[1]); @@ -315,7 +315,7 @@ } /* add current stroke-point to buffer (returns whether point was successfully added) */ -static short gp_stroke_addpoint (tGPsdata *p, int mval[2], float pressure) +static short gp_stroke_addpoint (tGPsdata *p, const int mval[2], float pressure) { bGPdata *gpd= p->gpd; tGPspoint *pt; @@ -1416,16 +1416,15 @@ static void gpencil_draw_apply_event (wmOperator *op, wmEvent *event) { tGPsdata *p= op->customdata; - ARegion *ar= p->ar; PointerRNA itemptr; float mousef[2]; int tablet=0; /* convert from window-space to area-space mouse coordintes */ // NOTE: float to ints conversions, +1 factor is probably used to ensure a bit more accurate rounding... - p->mval[0]= event->x - ar->winrct.xmin + 1; - p->mval[1]= event->y - ar->winrct.ymin + 1; - + p->mval[0]= event->mval[0] + 1; + p->mval[1]= event->mval[1] + 1; + /* handle pressure sensitivity (which is supplied by tablets) */ if (event->custom == EVT_DATA_TABLET) { wmTabletData *wmtab= event->customdata; Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c =================================================================== --- trunk/blender/source/blender/editors/interface/interface_handlers.c 2011-05-20 05:39:56 UTC (rev 36789) +++ trunk/blender/source/blender/editors/interface/interface_handlers.c 2011-05-20 07:40:05 UTC (rev 36790) @@ -4022,12 +4022,9 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event) -{ - ARegion *ar= CTX_wm_region(C); - - but->linkto[0]= event->x-ar->winrct.xmin; - but->linkto[1]= event->y-ar->winrct.ymin; - +{ + VECCOPY2D(but->linkto, event->mval); + if(data->state == BUTTON_STATE_HIGHLIGHT) { if(event->type == LEFTMOUSE && event->val==KM_PRESS) { button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE); Modified: trunk/blender/source/blender/editors/interface/view2d_ops.c =================================================================== --- trunk/blender/source/blender/editors/interface/view2d_ops.c 2011-05-20 05:39:56 UTC (rev 36789) +++ trunk/blender/source/blender/editors/interface/view2d_ops.c 2011-05-20 07:40:05 UTC (rev 36790) @@ -702,7 +702,7 @@ /* store initial mouse position (in view space) */ UI_view2d_region_to_view(&ar->v2d, - event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, + event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); } @@ -759,7 +759,7 @@ /* store initial mouse position (in view space) */ UI_view2d_region_to_view(&ar->v2d, - event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, + event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); } @@ -936,7 +936,7 @@ /* store initial mouse position (in view space) */ UI_view2d_region_to_view(&ar->v2d, - event->x - ar->winrct.xmin, event->y - ar->winrct.ymin, + event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); } @@ -1286,7 +1286,6 @@ ARegion *ar= CTX_wm_region(C); View2D *v2d= &ar->v2d; float mask_size; - int x, y; /* set custom-data for operator */ vsm= MEM_callocN(sizeof(v2dScrollerMove), "v2dScrollerMove"); @@ -1300,8 +1299,6 @@ /* store mouse-coordinates, and convert mouse/screen coordinates to region coordinates */ vsm->lastx = event->x; vsm->lasty = event->y; - x= event->x - ar->winrct.xmin; - y= event->y - ar->winrct.ymin; /* 'zone' depends on where mouse is relative to bubble @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs