Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-04-21 10:47:16 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-04-21 10:59:40 +0400
commit9ae0e585b0aab466c978ec1a55c824d902faa3b4 (patch)
tree6a99d63651f1b66ffacac2582b5f03d58898ad99 /source/blender/editors/space_clip/clip_graph_ops.c
parent6ee8670fca946d146332e80ceff29e459cd91ed5 (diff)
View2d: API Cleanup for view<->region conversion
View2D had some inconsistencies making it error prone in some cases. - Inconstant checking for NULL x/y args. Disallow NULL args for x/y destination pointers, instead add: - UI_view2d_region_to_view_x/y - UI_view2d_view_to_region_x/y - '_no_clip' suffix wasn't always used for non-clipping conversion, switch it around and use a '_clip' suffix for all funcs that clip. - UI_view2d_text_cache_add now clips before adding cache. - '_clip' funcs return a bool to quickly check if its in the view. - add conversion for rectangles, since this is a common task: - UI_view2d_view_to_region_rcti - UI_view2d_region_to_view_rctf
Diffstat (limited to 'source/blender/editors/space_clip/clip_graph_ops.c')
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index 2aaf064ef53..074d76c1a41 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -193,8 +193,8 @@ static bool mouse_select_knot(bContext *C, float co[2], bool extend)
if (userdata.marker) {
int x1, y1, x2, y2;
- UI_view2d_view_to_region(v2d, co[0], co[1], &x1, &y1);
- UI_view2d_view_to_region(v2d, userdata.min_co[0], userdata.min_co[1], &x2, &y2);
+ UI_view2d_view_to_region_clip(v2d, co[0], co[1], &x1, &y1);
+ UI_view2d_view_to_region_clip(v2d, userdata.min_co[0], userdata.min_co[1], &x2, &y2);
if (abs(x2 - x1) <= delta && abs(y2 - y1) <= delta) {
if (!extend) {
@@ -366,17 +366,15 @@ static int border_select_graph_exec(bContext *C, wmOperator *op)
MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *act_track = BKE_tracking_track_get_active(tracking);
BorderSelectuserData userdata;
- rcti rect;
+ rctf rect;
if (act_track == NULL) {
return OPERATOR_CANCELLED;
}
/* get rectangle from operator */
- WM_operator_properties_border_to_rcti(op, &rect);
-
- UI_view2d_region_to_view(&ar->v2d, rect.xmin, rect.ymin, &userdata.rect.xmin, &userdata.rect.ymin);
- UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &userdata.rect.xmax, &userdata.rect.ymax);
+ WM_operator_properties_border_to_rctf(op, &rect);
+ UI_view2d_region_to_view_rctf(&ar->v2d, &rect, &userdata.rect);
userdata.changed = false;
userdata.mode = RNA_int_get(op->ptr, "gesture_mode");