diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-21 10:47:16 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-21 10:59:40 +0400 |
commit | 9ae0e585b0aab466c978ec1a55c824d902faa3b4 (patch) | |
tree | 6a99d63651f1b66ffacac2582b5f03d58898ad99 /source/blender/editors/space_nla | |
parent | 6ee8670fca946d146332e80ceff29e459cd91ed5 (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_nla')
-rw-r--r-- | source/blender/editors/space_nla/nla_select.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 2bd2b660bcd..58eb8776168 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -464,7 +464,7 @@ static int nlaedit_select_leftright_invoke(bContext *C, wmOperator *op, const wm float x; /* determine which side of the current frame mouse is on */ - UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL); + x = UI_view2d_region_to_view_x(v2d, event->mval[0]); if (x < CFRA) RNA_int_set(op->ptr, "mode", NLAEDIT_LRSEL_LEFT); else @@ -515,7 +515,7 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s Scene *scene = ac->scene; NlaStrip *strip = NULL; int channel_index; - float xmin, xmax, dummy; + float xmin, xmax; float x, y; @@ -526,8 +526,8 @@ static void mouse_nla_strips(bContext *C, bAnimContext *ac, const int mval[2], s /* x-range to check is +/- 7 (in screen/region-space) on either side of mouse click * (that is the size of keyframe icons, so user should be expecting similar tolerances) */ - UI_view2d_region_to_view(v2d, mval[0] - 7, mval[1], &xmin, &dummy); - UI_view2d_region_to_view(v2d, mval[0] + 7, mval[1], &xmax, &dummy); + xmin = UI_view2d_region_to_view_x(v2d, mval[0] - 7); + xmax = UI_view2d_region_to_view_x(v2d, mval[0] + 7); /* filter data */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); |