diff --git a/source/blender/include/BSE_drawipo.h b/source/blender/include/BSE_drawipo.h index 65545441ff8..17c53fc6e2d 100644 --- a/source/blender/include/BSE_drawipo.h +++ b/source/blender/include/BSE_drawipo.h @@ -59,6 +59,7 @@ int in_ipo_buttons(void); void drawscroll(int disptype); void drawipo(void); +void center_currframe(void); void scroll_ipobuts(void); int view2dzoom(unsigned short event); int view2dmove(unsigned short event); diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c index d72799acbf0..4b7dbcab05f 100644 --- a/source/blender/src/drawipo.c +++ b/source/blender/src/drawipo.c @@ -1532,6 +1532,26 @@ int view2dzoom(unsigned short event) return 1; } +void center_currframe(void) +{ + /* place the current frame in the + * center of the 2D window. + */ + float width; + + areawinset(curarea->win); + curarea->head_swap= 0; + + width = G.v2d->cur.xmax - G.v2d->cur.xmin; + G.v2d->cur.xmin = CFRA - 0.5*(width); + G.v2d->cur.xmax = CFRA + 0.5*(width); + + test_view2d(G.v2d, curarea->winx, curarea->winy); + scrarea_do_windraw(curarea); + screen_swapbuffers(); + curarea->head_swap= 0; +} + int view2dmove(unsigned short event) { /* return 1 als er iets gedaan is */ diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index e521d59e675..1289b44a0b0 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -1405,6 +1405,14 @@ void winqreadactionspace(unsigned short event, short val, char ascii) case HOMEKEY: do_action_buttons(B_ACTHOME); break; + + case CKEY: + /* scroll the window so the current + * frame is in the center. + */ + center_currframe(); + break; + case DKEY: if (G.qual & LR_SHIFTKEY && mval[0]>ACTWIDTH){ duplicate_actionchannel_keys();