Graph Editor: Frame numbers in horizontal scrollbar are no longer restricted to 1.0 frame intervals.

This commit is contained in:
2009-03-09 07:00:40 +00:00
parent f73d7c697c
commit 6475e462fa
3 changed files with 8 additions and 3 deletions

View File

@@ -68,6 +68,7 @@ enum {
/* for drawing time */
V2D_UNIT_SECONDS = 0,
V2D_UNIT_FRAMES,
V2D_UNIT_FRAMESCALE,
/* for drawing values */
V2D_UNIT_VALUES,

View File

@@ -1468,10 +1468,14 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
/* draw numbers in the appropriate range */
if (dfac > 0.0f) {
for (; fac < hor.xmax; fac+=dfac, val+=grid->dx) {
switch (vs->xunits) {
switch (vs->xunits) {
case V2D_UNIT_FRAMES: /* frames (as whole numbers)*/
scroll_printstr(vs, scene, fac, 3.0f+(float)(hor.ymin), val, grid->powerx, V2D_UNIT_FRAMES, 'h');
break;
case V2D_UNIT_FRAMESCALE: /* frames (not always as whole numbers) */
scroll_printstr(vs, scene, fac, 3.0f+(float)(hor.ymin), val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h');
break;
case V2D_UNIT_SECONDS: /* seconds */
fac2= val/(float)FPS;
@@ -1490,7 +1494,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
}
break;
case V2D_UNIT_DEGREES: /* IPO-Editor for rotation IPO-Drivers */
case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */
/* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */
scroll_printstr(vs, scene, fac, 3.0f+(float)(hor.ymin), val, grid->powerx, V2D_UNIT_DEGREES, 'v');
break;

View File

@@ -227,7 +227,7 @@ static void graph_main_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_ortho(C, v2d);
/* grid */
unitx= (sipo->flag & SIPO_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMES;
unitx= (sipo->flag & SIPO_DRAWTIME)? V2D_UNIT_SECONDS : V2D_UNIT_FRAMESCALE;
grid= UI_view2d_grid_calc(C, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy);
UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL);
UI_view2d_grid_free(grid);