diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-12-07 10:02:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-12-07 10:02:47 +0300 |
commit | d620ff838053b58cc571913e6a1f68fa4f6a1d73 (patch) | |
tree | 9b1fa155a0dccfd476ad275d3572ee1019ee2040 /source/blender/editors/space_nla | |
parent | 612936954ac67cacee8d13f48ed1bd8b5ff386c7 (diff) |
2D text drawing
- with the NLA on a small strip text was drawn under the scroll bar, now draw with same alignment as rectangle constrained text.
- single alloc per text item.
- was using opengl context rather then passing color value.
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r-- | source/blender/editors/space_nla/nla_draw.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index d5a007fd506..e6028735d52 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -417,6 +417,7 @@ static void nla_draw_strip (SpaceNla *snla, AnimData *adt, NlaTrack *UNUSED(nlt) static void nla_draw_strip_text (NlaTrack *UNUSED(nlt), NlaStrip *strip, int UNUSED(index), View2D *v2d, float yminc, float ymaxc) { char str[256], dir[3]; + char col[4]; rctf rect; /* 'dir' - direction that strip is played in */ @@ -432,11 +433,14 @@ static void nla_draw_strip_text (NlaTrack *UNUSED(nlt), NlaStrip *strip, int UNU sprintf(str, "%s | %.2f %s %.2f", strip->name, strip->start, dir, strip->end); /* set text color - if colors (see above) are light, draw black text, otherwise draw white */ - if (strip->flag & (NLASTRIP_FLAG_ACTIVE|NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_TWEAKUSER)) - glColor3f(0.0f, 0.0f, 0.0f); - else - glColor3f(1.0f, 1.0f, 1.0f); - + if (strip->flag & (NLASTRIP_FLAG_ACTIVE|NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_TWEAKUSER)) { + col[0]= col[1]= col[2]= 0; + } + else { + col[0]= col[1]= col[2]= 255; + } + col[3]= 1.0; + /* set bounding-box for text * - padding of 2 'units' on either side */ @@ -447,7 +451,8 @@ static void nla_draw_strip_text (NlaTrack *UNUSED(nlt), NlaStrip *strip, int UNU rect.ymax= ymaxc; /* add this string to the cache of texts to draw*/ - UI_view2d_text_cache_rectf(v2d, &rect, str); + + UI_view2d_text_cache_rectf(v2d, &rect, str, col); } /* ---------------------- */ |