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>2012-05-24 05:25:31 +0400
committerJoshua Leung <aligorith@gmail.com>2012-05-24 05:25:31 +0400
commit8e97203f7d1101d8069b22f0f9a5666812704e22 (patch)
tree160ce3d1d9751745629d71c42ce3f6f963698843 /source/blender/editors/animation
parent57b488574a0720eb749e9daa16df1979db9bbe6f (diff)
Restoring Group Colours for Animation Channels - Part 1
This commit restores the group colours support for F-Curves and F-Curve Groups in the DopeSheet and Graph Editors. Currently the relevant settings for groups are only exposed via RNA, but a followup commit will add support for automatically setting these colours. By default, DopeSheet and Graph Editors are set to display these colours if/when they are available. This functionality used to be in 2.48, and is a useful mechanism for visually distinguishing between channels for different controls when animating (if group colours are used on the rigs too).
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c64
1 files changed, 50 insertions, 14 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index dd9a0600725..c4fca2d4ea5 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -146,18 +146,39 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale
glRectf(offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
}
+/* helper method to test if group colors should be drawn */
+static short acf_show_channel_colors(bAnimContext *ac)
+{
+ short showGroupColors = 0;
+
+ if (ac->sl) {
+ switch (ac->spacetype) {
+ case SPACE_ACTION:
+ {
+ SpaceAction *saction = (SpaceAction *)ac->sl;
+ showGroupColors = !(saction->flag & SACTION_NODRAWGCOLORS);
+ }
+ break;
+ case SPACE_IPO:
+ {
+ SpaceIpo *sipo = (SpaceIpo *)ac->sl;
+ showGroupColors = !(sipo->flag & SIPO_NODRAWGCOLORS);
+ }
+ break;
+ }
+ }
+
+ return showGroupColors;
+}
+
/* get backdrop color for generic channels */
static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
{
bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
- SpaceAction *saction = NULL;
bActionGroup *grp = NULL;
short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0;
+ short showGroupColors = acf_show_channel_colors(ac);
- /* get context info needed... */
- if ((ac->sl) && (ac->spacetype == SPACE_ACTION))
- saction = (SpaceAction *)ac->sl;
-
if (ale->type == ANIMTYPE_FCURVE) {
FCurve *fcu = (FCurve *)ale->data;
grp = fcu->grp;
@@ -167,9 +188,7 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa
* - use 3 shades of color group/standard color for 3 indention level
* - only use group colors if allowed to, and if actually feasible
*/
- if ( (saction && !(saction->flag & SACTION_NODRAWGCOLORS)) &&
- ((grp) && (grp->customCol)) )
- {
+ if (showGroupColors && (grp) && (grp->customCol)) {
unsigned char cp[3];
if (indent == 2) {
@@ -730,13 +749,30 @@ static bAnimChannelType ACF_OBJECT =
/* Group ------------------------------------------- */
/* get backdrop color for group widget */
-static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float r_color[3])
+static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
{
- /* highlight only for action group channels */
- if (ale->flag & AGRP_ACTIVE)
- UI_GetThemeColorShade3fv(TH_GROUP_ACTIVE, 10, r_color);
- else
- UI_GetThemeColorShade3fv(TH_GROUP, 20, r_color);
+ bActionGroup *agrp = (bActionGroup *)ale->data;
+ short showGroupColors = acf_show_channel_colors(ac);
+
+ if (showGroupColors && agrp->customCol) {
+ unsigned char cp[3];
+
+ /* highlight only for active */
+ if (ale->flag & AGRP_ACTIVE)
+ copy_v3_v3_char((char *)cp, agrp->cs.active);
+ else
+ copy_v3_v3_char((char *)cp, agrp->cs.solid);
+
+ /* copy the colors over, transforming from bytes to floats */
+ rgb_uchar_to_float(r_color, cp);
+ }
+ else {
+ /* highlight only for active */
+ if (ale->flag & AGRP_ACTIVE)
+ UI_GetThemeColorShade3fv(TH_GROUP_ACTIVE, 10, r_color);
+ else
+ UI_GetThemeColorShade3fv(TH_GROUP, 20, r_color);
+ }
}
/* backdrop for group widget */