From 158657026122d3b169f1bea12a69ff8eb16bbe04 Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 6 Jul 2009 11:06:34 +0000 Subject: NLA SoC: More work on Meta-Strips * Added several API functions for Meta-Strips editing. One of these (flush transform) still needs a few tweaks before it does its job well enough for all cases. * Meta strips are now drawn with a purple-ish colour. The start/end points of the strips they encompass are shown with lines along the length of the strips, with lines starting from the top indicating start-points and lines starting from the bottom indicating end-points. * Meta strips can be made (i.e. strips can be assigned to meta-strips) by selecting some strips and pressing Shift-G. Meta strips can be removed by selecting some meta-strips and pressing Alt-G. * Strips can now be 'snapped' to start from: the current frame, the nearest frame, the nearest second, or the nearest marker; using the Shift-S hotkey. 'Islands' of adjacent selected strips occurring in the same track are moved together as a single strip so that the start-point of the first strip is on the sepcified time, but all the relative lengths of strips stay the same. Internally, temporary meta-strips are created to facilitate this. --- source/blender/editors/space_nla/nla_draw.c | 39 ++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_nla/nla_draw.c') diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index ab33434077e..e31aebf0155 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -176,6 +176,23 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co color[2]= 0.19f; } } + else if (strip->type == NLASTRIP_TYPE_META) { + /* Meta Clip */ + if (strip->flag & NLASTRIP_FLAG_SELECT) { + /* selected - use a bold purple color */ + // FIXME: hardcoded temp-hack colors + color[0]= 0.41f; + color[1]= 0.13f; + color[2]= 0.59f; + } + else { + /* normal, unselected strip - use (hardly noticable) dark purple tinge */ + // FIXME: hardcoded temp-hack colors + color[0]= 0.20f; + color[1]= 0.15f; + color[2]= 0.26f; + } + } else { /* Action Clip (default/normal type of strip) */ if ((strip->flag & NLASTRIP_FLAG_ACTIVE) && (adt && (adt->flag & ADT_NLA_EDIT_ON))) { @@ -293,7 +310,7 @@ static void nla_draw_strip (AnimData *adt, NlaTrack *nlt, NlaStrip *strip, View2 /* draw outline */ gl_round_box_shade(GL_LINE_LOOP, strip->start, yminc, strip->end, ymaxc, 0.0, 0.0, 0.1); - /* if action-clip strip, draw lines delimiting repeats too (in the same colour */ + /* if action-clip strip, draw lines delimiting repeats too (in the same color as outline) */ if ((strip->type == NLASTRIP_TYPE_CLIP) && IS_EQ(strip->repeat, 1.0f)==0) { float repeatLen = (strip->actend - strip->actstart) * strip->scale; int i; @@ -309,6 +326,26 @@ static void nla_draw_strip (AnimData *adt, NlaTrack *nlt, NlaStrip *strip, View2 fdrawline(repeatPos, yminc, repeatPos, ymaxc); } } + /* or if meta-strip, draw lines delimiting extents of sub-strips (in same color as outline, if more than 1 exists) */ + else if ((strip->type == NLASTRIP_TYPE_META) && (strip->strips.first != strip->strips.last)) { + NlaStrip *cs; + float y= (ymaxc-yminc)/2.0f + yminc; + + /* only draw first-level of child-strips, but don't draw any lines on the endpoints */ + for (cs= strip->strips.first; cs; cs= cs->next) { + /* draw start-line if not same as end of previous (and only if not the first strip) + * - on upper half of strip + */ + if ((cs->prev) && IS_EQ(cs->prev->end, cs->start)==0) + fdrawline(cs->start, y, cs->start, ymaxc); + + /* draw end-line if not the last strip + * - on lower half of strip + */ + if (cs->next) + fdrawline(cs->end, yminc, cs->end, y); + } + } /* reset linestyle */ setlinestyle(0); -- cgit v1.2.3