From 9cce2d864554cb78abfb5e2909dfb1a506933d3c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 12 Aug 2012 01:07:31 +0000 Subject: smooth-view for 2d views, graph editor, sequencer, node view, works with border zoom, view selected, view all. --- source/blender/editors/space_graph/graph_edit.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'source/blender/editors/space_graph/graph_edit.c') 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; } -- cgit v1.2.3