diff options
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_markers.c | 21 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_ops.c | 6 |
2 files changed, 10 insertions, 17 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 9cba7d04c3e..1def5339b23 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -1024,22 +1024,18 @@ static int ed_marker_select(bContext *C, const wmEvent *event, bool extend, bool ARegion *ar = CTX_wm_region(C); View2D *v2d = UI_view2d_fromcontext(C); float viewx; - int x, y, cfra; + int x, cfra; if (markers == NULL) return OPERATOR_PASS_THROUGH; x = event->x - ar->winrct.xmin; - y = event->y - ar->winrct.ymin; - UI_view2d_region_to_view(v2d, x, y, &viewx, NULL); + viewx = UI_view2d_region_to_view_x(v2d, x); cfra = ED_markers_find_nearest_marker_time(markers, viewx); - if (extend) - select_timeline_marker_frame(markers, cfra, 1); - else - select_timeline_marker_frame(markers, cfra, 0); + select_timeline_marker_frame(markers, cfra, extend); #ifdef DURIAN_CAMERA_SWITCH @@ -1150,22 +1146,19 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op) View2D *v2d = UI_view2d_fromcontext(C); ListBase *markers = ED_context_get_markers(C); TimeMarker *marker; - float xminf, xmaxf, yminf, ymaxf; int gesture_mode = RNA_int_get(op->ptr, "gesture_mode"); bool extend = RNA_boolean_get(op->ptr, "extend"); - rcti rect; + rctf rect; - WM_operator_properties_border_to_rcti(op, &rect); - - UI_view2d_region_to_view(v2d, rect.xmin, rect.ymin, &xminf, &yminf); - UI_view2d_region_to_view(v2d, rect.xmax, rect.ymax, &xmaxf, &ymaxf); + WM_operator_properties_border_to_rctf(op, &rect); + UI_view2d_region_to_view_rctf(v2d, &rect, &rect); if (markers == NULL) return 0; /* XXX marker context */ for (marker = markers->first; marker; marker = marker->next) { - if ((marker->frame > xminf) && (marker->frame <= xmaxf)) { + if (BLI_rctf_isect_x(&rect, marker->frame)) { switch (gesture_mode) { case GESTURE_MODAL_SELECT: marker->flag |= SELECT; diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 072b4c4c201..d9a5d713480 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -124,7 +124,7 @@ static int frame_from_event(bContext *C, const wmEvent *event) int frame; /* convert from region coordinates to View2D 'tot' space */ - UI_view2d_region_to_view(®ion->v2d, event->mval[0], event->mval[1], &viewx, NULL); + viewx = UI_view2d_region_to_view_x(®ion->v2d, event->mval[0]); /* round result to nearest int (frames are ints!) */ frame = iroundf(viewx); @@ -212,8 +212,8 @@ static int previewrange_define_exec(bContext *C, wmOperator *op) WM_operator_properties_border_to_rcti(op, &rect); /* convert min/max values to frames (i.e. region to 'tot' rect) */ - UI_view2d_region_to_view(&ar->v2d, rect.xmin, 0, &sfra, NULL); - UI_view2d_region_to_view(&ar->v2d, rect.xmax, 0, &efra, NULL); + sfra = UI_view2d_region_to_view_x(&ar->v2d, rect.xmin); + efra = UI_view2d_region_to_view_x(&ar->v2d, rect.xmax); /* set start/end frames for preview-range * - must clamp within allowable limits |