Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-06-02 17:03:33 +0400
committerJoshua Leung <aligorith@gmail.com>2009-06-02 17:03:33 +0400
commit8afd6a9dc54ea40e9f12e746d6e67430613776ec (patch)
tree037f9c15dc5dcc1e70bd52d91a421373e995becc
parent6a35302a54071bfd12df7d4a71e710d1e250b34d (diff)
NLA SoC: Added basic info-text drawing on strips
The format of these is still rather experimental.
-rw-r--r--source/blender/editors/space_nla/nla_draw.c41
-rw-r--r--source/blender/editors/space_nla/space_nla.c4
2 files changed, 43 insertions, 2 deletions
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index def49021160..78fc4174f95 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -48,6 +48,7 @@
#include "DNA_userdef_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_world_types.h"
+#include "DNA_vec_types.h"
#include "MEM_guardedalloc.h"
@@ -128,6 +129,36 @@ static void nla_draw_strip (NlaTrack *nlt, NlaStrip *strip, View2D *v2d, float y
gl_round_box_shade(GL_LINE_LOOP, strip->start, yminc, strip->end, ymaxc, 0.0, 0.0, 0.1);
}
+/* add the relevant text to the cache of text-strings to draw in pixelspace */
+static void nla_draw_strip_text (NlaTrack *nlt, NlaStrip *strip, int index, View2D *v2d, float yminc, float ymaxc)
+{
+ char str[256];
+ rctf rect;
+
+ /* for now, just init the string with a fixed-format */
+ if (strip->act)
+ sprintf(str, "%d | Act: %s | %.2f <-> %.2f", index, strip->act->id.name+2, strip->start, strip->end);
+ else
+ sprintf(str, "%d | Act: <NONE>", index);
+
+ /* set text colour - if colours (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);
+
+ /* set bounding-box for text
+ * - padding of 2 'units' on either side
+ */
+ rect.xmin= strip->start + 2;
+ rect.ymin= yminc;
+ rect.xmax= strip->end - 2;
+ rect.ymax= ymaxc;
+
+ /* add this string to the cache of texts to draw*/
+ UI_view2d_text_cache_rectf(v2d, &rect, str);
+}
+
/* ---------------------- */
void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
@@ -175,14 +206,20 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
{
NlaTrack *nlt= (NlaTrack *)ale->data;
NlaStrip *strip;
+ int index;
/* draw backdrop? */
// TODO...
/* draw each strip in the track (if visible) */
- for (strip=nlt->strips.first; strip; strip= strip->next) {
- if (BKE_nlastrip_within_bounds(strip, v2d->cur.xmin, v2d->cur.xmax))
+ for (strip=nlt->strips.first, index=1; strip; strip=strip->next, index++) {
+ if (BKE_nlastrip_within_bounds(strip, v2d->cur.xmin, v2d->cur.xmax)) {
+ /* draw the visualisation of the strip */
nla_draw_strip(nlt, strip, v2d, yminc, ymaxc);
+
+ /* add the text for this strip to the cache */
+ nla_draw_strip_text(nlt, strip, index, v2d, yminc, ymaxc);
+ }
}
}
break;
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 024b23c51b8..1bed72b82fb 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -246,7 +246,11 @@ static void nla_main_area_draw(const bContext *C, ARegion *ar)
/* data */
if (ANIM_animdata_get_context(C, &ac)) {
+ /* strips and backdrops */
draw_nla_main_data(&ac, snla, ar);
+
+ /* text draw cached, in pixelspace now */
+ UI_view2d_text_cache_draw(ar);
}
/* current frame */