From 4371ee22f97884a3add60d2b4b8871d5881c55fb Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Mon, 4 Jun 2012 01:17:37 +0000 Subject: Theme Colors for NLA Strips and DopeSheet Summary * NLA Strip colors are now themable * Changed the "Active Action"/"Summary" colors to be a bit more muted. The new colors are now closer to those for keyframes, though they are still different enough to be clearly distinguishable. * Removed some colors wihch don't seem to be used (from NLA theme colors) * Added function to get theme colors + alpha as floats --- source/blender/editors/space_nla/nla_draw.c | 86 ++++++++++------------------- 1 file changed, 28 insertions(+), 58 deletions(-) (limited to 'source/blender/editors/space_nla') diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index a6578ffb3f7..7eb0f676707 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -80,26 +80,17 @@ static void nla_action_get_color(AnimData *adt, bAction *act, float color[4]) { if (adt && (adt->flag & ADT_NLA_EDIT_ON)) { - // greenish color (same as tweaking strip) - hardcoded for now - color[0] = 0.30f; - color[1] = 0.95f; - color[2] = 0.10f; - color[3] = 0.30f; + /* greenish color (same as tweaking strip) */ + UI_GetThemeColor4fv(TH_NLA_TWEAK, color); } else { if (act) { - // reddish color - hardcoded for now - color[0] = 0.8f; - color[1] = 0.2f; - color[2] = 0.0f; - color[3] = 0.4f; + /* reddish color - same as dopesheet summary */ + UI_GetThemeColor4fv(TH_ANIM_ACTIVE, color); } else { - // greyish-red color - hardcoded for now - color[0] = 0.6f; - color[1] = 0.5f; - color[2] = 0.5f; - color[3] = 0.3f; + /* greyish-red color */ + UI_GetThemeColor4fv(TH_ANIM_INACTIVE, color); } } @@ -166,17 +157,11 @@ static void nla_strip_get_color_inside(AnimData *adt, NlaStrip *strip, float col /* Transition Clip */ if (strip->flag & NLASTRIP_FLAG_SELECT) { /* selected - use a bright blue color */ - // FIXME: hardcoded temp-hack colors - color[0] = 0.18f; - color[1] = 0.46f; - color[2] = 0.86f; + UI_GetThemeColor3fv(TH_NLA_TRANSITION_SEL, color); } else { /* normal, unselected strip - use (hardly noticeable) blue tinge */ - // FIXME: hardcoded temp-hack colors - color[0] = 0.11f; - color[1] = 0.15f; - color[2] = 0.19f; + UI_GetThemeColor3fv(TH_NLA_TRANSITION, color); } } else if (strip->type == NLASTRIP_TYPE_META) { @@ -184,34 +169,22 @@ static void nla_strip_get_color_inside(AnimData *adt, NlaStrip *strip, float col // TODO: should temporary metas get different colors too? 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; + UI_GetThemeColor3fv(TH_NLA_META_SEL, color); } else { /* normal, unselected strip - use (hardly noticeable) dark purple tinge */ - // FIXME: hardcoded temp-hack colors - color[0] = 0.20f; - color[1] = 0.15f; - color[2] = 0.26f; + UI_GetThemeColor3fv(TH_NLA_META, color); } } else if (strip->type == NLASTRIP_TYPE_SOUND) { /* Sound Clip */ if (strip->flag & NLASTRIP_FLAG_SELECT) { /* selected - use a bright teal color */ - // FIXME: hardcoded temp-hack colors - color[0] = 0.12f; - color[1] = 0.48f; - color[2] = 0.48f; + UI_GetThemeColor3fv(TH_NLA_SOUND_SEL, color); } else { /* normal, unselected strip - use (hardly noticeable) teal tinge */ - // FIXME: hardcoded temp-hack colors - color[0] = 0.17f; - color[1] = 0.24f; - color[2] = 0.24f; + UI_GetThemeColor3fv(TH_NLA_SOUND, color); } } else { @@ -220,19 +193,13 @@ static void nla_strip_get_color_inside(AnimData *adt, NlaStrip *strip, float col /* active strip should be drawn green when it is acting as the tweaking strip. * however, this case should be skipped for when not in EditMode... */ - // FIXME: hardcoded temp-hack colors - color[0] = 0.3f; - color[1] = 0.95f; - color[2] = 0.1f; + UI_GetThemeColor3fv(TH_NLA_TWEAK, color); } else if (strip->flag & NLASTRIP_FLAG_TWEAKUSER) { /* alert user that this strip is also used by the tweaking track (this is set when going into * 'editmode' for that strip), since the edits made here may not be what the user anticipated */ - // FIXME: hardcoded temp-hack colors - color[0] = 0.85f; - color[1] = 0.0f; - color[2] = 0.0f; + UI_GetThemeColor3fv(TH_NLA_TWEAK_DUPLI, color); } else if (strip->flag & NLASTRIP_FLAG_SELECT) { /* selected strip - use theme color for selected */ @@ -792,21 +759,24 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View glEnable(GL_BLEND); /* draw backing strip behind channel name */ + // FIXME: hardcoded colors!!! if (group == 5) { - /* Action Line */ - // TODO: if tweaking some action, use the same color as for the tweaked track (quick hack done for now) + float color[4]; + + /* Action Line + * The alpha values action_get_color returns are only useful for drawing + * strips backgrounds but here we're doing channel list backgrounds instead + * so we ignore that and use our own when needed + */ + nla_action_get_color(adt, (bAction *)ale->data, color); + if (adt && (adt->flag & ADT_NLA_EDIT_ON)) { - // greenish color (same as tweaking strip) - hardcoded for now - glColor3f(0.3f, 0.95f, 0.1f); + /* Yes, the color vector has 4 components, BUT we only want to be using 3 of them! */ + glColor3fv(color); } else { - /* if a track is being solo'd, action is ignored, so draw less boldly (alpha lower) */ - float alpha = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3f : 1.0f; - - if (ale->data) - glColor4f(0.8f, 0.2f, 0.0f, alpha); // reddish color - hardcoded for now - else - glColor4f(0.6f, 0.5f, 0.5f, alpha); // greyish-red color - hardcoded for now + float alpha = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3 : 1.0f; + glColor4f(color[0], color[1], color[2], alpha); } offset += 7 * indent; -- cgit v1.2.3