diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-12 05:07:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-12 05:07:31 +0400 |
commit | 9cce2d864554cb78abfb5e2909dfb1a506933d3c (patch) | |
tree | 57f1037cb16ce26791f4bb1cd5fb0a88293d8af9 /source/blender/editors/space_graph/graph_edit.c | |
parent | 1aaaf67a9e42cfbba6d8c955a9e0a7519b296933 (diff) |
smooth-view for 2d views, graph editor, sequencer, node view, works with border zoom, view selected, view all.
Diffstat (limited to 'source/blender/editors/space_graph/graph_edit.c')
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 55dca725131..8a0538eddb0 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -202,33 +202,28 @@ void GRAPH_OT_previewrange_set(wmOperatorType *ot) static int graphkeys_viewall(bContext *C, const short do_sel_only, const short include_handles) { bAnimContext ac; - View2D *v2d; float extra; + rctf cur_new; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) return OPERATOR_CANCELLED; - v2d = &ac.ar->v2d; /* set the horizontal range, with an extra offset so that the extreme keys will be in view */ get_graph_keyframe_extents(&ac, - &v2d->cur.xmin, &v2d->cur.xmax, - &v2d->cur.ymin, &v2d->cur.ymax, + &cur_new.xmin, &cur_new.xmax, + &cur_new.ymin, &cur_new.ymax, do_sel_only, include_handles); - extra = 0.1f * (v2d->cur.xmax - v2d->cur.xmin); - v2d->cur.xmin -= extra; - v2d->cur.xmax += extra; - - extra = 0.1f * (v2d->cur.ymax - v2d->cur.ymin); - v2d->cur.ymin -= extra; - v2d->cur.ymax += extra; + extra = 0.1f * (cur_new.xmax - cur_new.xmin); + cur_new.xmin -= extra; + cur_new.xmax += extra; - /* do View2D syncing */ - UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); + extra = 0.1f * (cur_new.ymax - cur_new.ymin); + cur_new.ymin -= extra; + cur_new.ymax += extra; - /* set notifier that things have changed */ - ED_area_tag_redraw(CTX_wm_area(C)); + UI_view2d_smooth_view(C, ac.ar, &cur_new); return OPERATOR_FINISHED; } |