diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-12-21 06:14:01 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-12-21 06:14:01 +0300 |
commit | 12439031c9f67f0acedd25d667b08fb23d79933a (patch) | |
tree | f9e48785333833b0efda382120b1b9194adbcf7f /source/blender/editors/animation/anim_draw.c | |
parent | 4d2ae9431b5a200278bbf733d6b1b76b86c0f0f5 (diff) |
2.5 - Animation Editors - common drawing stuff
* Fixed current frame number drawing in Animation Editors, so that the little frame number indicator box gets shown (animsys2 feature).
* Made all Animation Editors draw markers and preview range
Diffstat (limited to 'source/blender/editors/animation/anim_draw.c')
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index e2bc73847c0..5485ed9e61e 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -44,6 +44,7 @@ #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_object.h" #include "BKE_screen.h" #include "BKE_utildefines.h" @@ -58,17 +59,21 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "UI_text.h" #include "UI_view2d.h" +/* XXX */ +extern void ui_rasterpos_safe(float x, float y, float aspect); + /* *************************************************** */ /* CURRENT FRAME DRAWING */ /* Draw current frame number in a little green box beside the current frame indicator */ static void draw_cfra_number (View2D *v2d, float cfra, short time) { - float xscale, yscale, yspace, ypixels, x; - short slen; + float xscale, yscale, x, y; char str[32]; + short slen; /* because the frame number text is subject to the same scaling as the contents of the view */ UI_view2d_getscale(v2d, &xscale, &yscale); @@ -78,23 +83,23 @@ static void draw_cfra_number (View2D *v2d, float cfra, short time) sprintf(str, " %.2f", FRA2TIME(CFRA)); else sprintf(str, " %d", CFRA); - slen= UI_GetStringWidth(G.font, str, 0); + slen= UI_GetStringWidth(G.font, str, 0) - 1; /* get starting coordinates for drawing */ x= cfra * xscale; + y= 18; /* draw green box around/behind text */ - UI_ThemeColor(TH_CFRAME); UI_ThemeColorShadeAlpha(TH_CFRAME, 0, -100); - glRectf(x, 0, x+slen, 15); + glRectf(x, y, x+slen, y+15); /* draw current frame number - black text */ UI_ThemeColor(TH_TEXT); - ui_rasterpos_safe(x-5, 17, 1.0); - UI_DrawString(G.fonts, str, 0); + ui_rasterpos_safe(x-5, y+3, 1.0); + UI_DrawString(G.fonts, str, 0); // XXX may need to be updated for font stuff /* restore view transform */ - glScalef(xscale, yscale, 1.0); + glScalef(xscale, 1.0, 1.0); } /* General call for drawing current frame indicator in a */ |