diff options
author | Antonioya <blendergit@gmail.com> | 2019-04-03 11:25:49 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2019-04-03 11:25:49 +0300 |
commit | 382b2a9c66a9f8b64581dc2a360dffbbbe706e21 (patch) | |
tree | 4c0bd232085a821f3fe132eb4bb002f95d7d2099 /source/blender/editors/animation/anim_channels_defines.c | |
parent | a813e259d6309b25fbd0a6d506df810ad2b11395 (diff) |
GPencil: Implement custom channel color in Dopesheet
A new parameter in the layer adjustment panel allows to define the color of the channel in Dopesheet.
This is needed when there are a lot of layers.
See D4623 for more details.
Diffstat (limited to 'source/blender/editors/animation/anim_channels_defines.c')
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 997b3c22e51..618ac8f6f13 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -220,6 +220,23 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa } } +/* get backdrop color for grease pencil channels */ +static void acf_gpencil_channel_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3]) +{ + const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); + short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0; + bool showGroupColors = acf_show_channel_colors(ac); + + if ((showGroupColors) && (ale->type == ANIMTYPE_GPLAYER)) { + bGPDlayer *gpl = (bGPDlayer *)ale->data; + copy_v3_v3(r_color, gpl->color); + } + else { + int colOfs = 10 - 10 * indent; + UI_GetThemeColorShade3fv(TH_SHADE2, colOfs, r_color); + } +} + /* backdrop for generic channels */ static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc) { @@ -3058,7 +3075,7 @@ static bAnimChannelType ACF_GPL = "GPencil Layer", /* type name */ ACHANNEL_ROLE_CHANNEL, /* role */ - acf_generic_channel_color, /* backdrop color */ + acf_gpencil_channel_color, /* backdrop color */ acf_generic_channel_backdrop, /* backdrop */ acf_generic_indention_flexible, /* indent level */ acf_generic_group_offset, /* offset */ |