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/animation/anim_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/animation/anim_ops.c')
-rw-r--r--source/blender/editors/animation/anim_ops.c6
1 files changed, 3 insertions, 3 deletions
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(&region->v2d, event->mval[0], event->mval[1], &viewx, NULL);
+ viewx = UI_view2d_region_to_view_x(&region->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