From 382b2a9c66a9f8b64581dc2a360dffbbbe706e21 Mon Sep 17 00:00:00 2001 From: Antonioya Date: Wed, 3 Apr 2019 10:25:49 +0200 Subject: 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. --- .../blender/editors/animation/anim_channels_defines.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/animation/anim_channels_defines.c') 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 */ -- cgit v1.2.3