diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-12-02 12:43:23 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-12-02 12:43:23 +0300 |
commit | 628d7013e2c0236894d329abfde705d023833092 (patch) | |
tree | 12378e2d5618f02ebef21153618eb376b0c819bb /source/blender/editors/space_time | |
parent | f8d5883a5bcc7be575b1b9a2ca3ef0bfee9360d5 (diff) |
View2D - Some more tweaks...
* Improved scrollbar drawing a bit more - only cosmetic lines
* Added new view2d view-matrix api method to only use 'cur' coordinates on one axis, for use when drawing markers, etc. that need to be glued to a certain time but stay fixed in space in another dimension. This should improve the sitation for drawing markers
* To aid testing, adding markers now sets the marker to have frame number as it's "name". This will need to be removed later...
Diffstat (limited to 'source/blender/editors/space_time')
-rw-r--r-- | source/blender/editors/space_time/ed_markers.c | 29 | ||||
-rw-r--r-- | source/blender/editors/space_time/space_time.c | 15 |
2 files changed, 20 insertions, 24 deletions
diff --git a/source/blender/editors/space_time/ed_markers.c b/source/blender/editors/space_time/ed_markers.c index 590b09b886b..83ede869360 100644 --- a/source/blender/editors/space_time/ed_markers.c +++ b/source/blender/editors/space_time/ed_markers.c @@ -81,14 +81,6 @@ static ListBase *context_get_markers(const bContext *C) return &C->scene->markers; } -static View2D *context_get_view2d(const bContext *C) -{ - /* XXX solve, get from view2d api? */ - SpaceTime *stime= C->area->spacedata.first; - - return &stime->v2d; -} - /* ************* Marker Drawing ************ */ /* XXX */ @@ -106,7 +98,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag) ypixels= v2d->mask.ymax-v2d->mask.ymin; UI_view2d_getscale(v2d, &xscale, &yscale); - glScalef( 1.0/xscale, 1.0/yscale, 1.0); + glScalef(1.0/xscale, 1.0, 1.0); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -137,7 +129,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag) ICON_MARKER; } - UI_icon_draw(xpos*xscale-5.0, 8.0, icon_id); + UI_icon_draw(xpos*xscale-5.0, 16.0, icon_id); glBlendFunc(GL_ONE, GL_ZERO); glDisable(GL_BLEND); @@ -145,26 +137,26 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag) /* and the marker name too, shifted slightly to the top-right */ if(marker->name && marker->name[0]) { if(marker->flag & SELECT) { - //BIF_ThemeColor(TH_TEXT_HI); + UI_ThemeColor(TH_TEXT_HI); ui_rasterpos_safe(xpos*xscale+4.0, (ypixels<=39.0)?(ypixels-10.0):29.0, 1.0); } else { - // BIF_ThemeColor(TH_TEXT); + UI_ThemeColor(TH_TEXT); if((marker->frame <= cfra) && (marker->frame+5 > cfra)) ui_rasterpos_safe(xpos*xscale+4.0, (ypixels<=39.0)?(ypixels-10.0):29.0, 1.0); else ui_rasterpos_safe(xpos*xscale+4.0, 17.0, 1.0); } -// BIF_DrawString(G.font, marker->name, 0); + UI_DrawString(G.font, marker->name, 0); } - glScalef(xscale, yscale, 1.0); + glScalef(xscale, 1.0, 1.0); } /* Draw Scene-Markers in time window */ void draw_markers_time(const bContext *C, int flag) { ListBase *markers= context_get_markers(C); - View2D *v2d= context_get_view2d(C); + View2D *v2d= UI_view2d_fromcontext(C); TimeMarker *marker; /* unselected markers are drawn at the first time */ @@ -201,6 +193,7 @@ static int ed_marker_add(bContext *C, wmOperator *op) marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); marker->flag= SELECT; marker->frame= frame; + sprintf(marker->name, "Frame %d", frame); // XXX - temp code only BLI_addtail(markers, marker); //BIF_undo_push("Add Marker"); @@ -368,7 +361,7 @@ int WM_modal_tweak_check(wmEvent *evt, int tweak_event) static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) { MarkerMove *mm= op->customdata; - View2D *v2d= context_get_view2d(C); + View2D *v2d= UI_view2d_fromcontext(C); TimeMarker *marker, *selmarker=NULL; float dx, fac; char str[256]; @@ -612,7 +605,7 @@ static int find_nearest_marker_time(ListBase *markers, float dx) static int ed_marker_select(bContext *C, wmEvent *evt, int extend) { ListBase *markers= context_get_markers(C); - View2D *v2d= context_get_view2d(C); + View2D *v2d= UI_view2d_fromcontext(C); float viewx; int x, y, cfra; @@ -689,7 +682,7 @@ callbacks: static int ed_marker_border_select_exec(bContext *C, wmOperator *op) { - View2D *v2d= context_get_view2d(C); + View2D *v2d= UI_view2d_fromcontext(C); ListBase *markers= context_get_markers(C); wmGesture *gesture= op->customdata; TimeMarker *marker; diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index d29af67950b..e391ac82c82 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -80,22 +80,24 @@ static void time_draw_cfra_time(const bContext *C, SpaceTime *stime, ARegion *ar static void time_draw_sfra_efra(const bContext *C, SpaceTime *stime, ARegion *ar) { - /* draw darkened area outside of active timeline + View2D *v2d= UI_view2d_fromcontext(C); + + /* draw darkened area outside of active timeline * frame range used is preview range or scene range */ UI_ThemeColorShade(TH_BACK, -25); if (PSFRA < PEFRA) { - glRectf(ar->v2d.cur.xmin, ar->v2d.cur.ymin, PSFRA, ar->v2d.cur.ymax); - glRectf(PEFRA, ar->v2d.cur.ymin, ar->v2d.cur.xmax, ar->v2d.cur.ymax); + glRectf(v2d->cur.xmin, v2d->cur.ymin, PSFRA, v2d->cur.ymax); + glRectf(PEFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); } else { - glRectf(ar->v2d.cur.xmin, ar->v2d.cur.ymin, ar->v2d.cur.xmax, ar->v2d.cur.ymax); + glRectf(v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); } UI_ThemeColorShade(TH_BACK, -60); /* thin lines where the actual frames are */ - fdrawline(PSFRA, ar->v2d.cur.ymin, PSFRA, ar->v2d.cur.ymax); - fdrawline(PEFRA, ar->v2d.cur.ymin, PEFRA, ar->v2d.cur.ymax); + fdrawline(PSFRA, v2d->cur.ymin, PSFRA, v2d->cur.ymax); + fdrawline(PEFRA, v2d->cur.ymin, PEFRA, v2d->cur.ymax); } static void time_main_area_init(const bContext *C, ARegion *ar) @@ -143,6 +145,7 @@ static void time_main_area_draw(const bContext *C, ARegion *ar) time_draw_cfra_time(C, stime, ar); /* markers */ + UI_view2d_view_orthospecial(C, v2d, 1); draw_markers_time(C, 0); /* reset view matrix */ |