diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-10-30 12:57:46 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-11-09 13:11:05 +0300 |
commit | ad85256e71081016fe7b4009f8a0c0cd7e18dafe (patch) | |
tree | cd0eb7f225c2282d4be71d5f9ff55553d1cf0207 /source/blender/editors | |
parent | 25375c769a158c54396f60b9ceecd3c267871f3e (diff) |
Animation: move group colors switch to user preferences
Move the "Show Group Colors" toggle from a per-editor option to a single
user preference in the Animation preferences. The Grease Pencil
animation channel side panel allows picking a channel color; this now
shows a message when channel colors are disabled.
The old "Show Group Colors" toggle had to be set per editor, and was on
by default. This meant that disabling group colors would require an
action for every file, for every editor. It is very hard to select a
color that works both as bone color in the 3D Viewport (needs to be
bright there) as well as the channel list (needs to be dark there), most
animators turn channel list colors off.
Differential Revision: https://developer.blender.org/D9391
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 32 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_draw.c | 2 |
2 files changed, 8 insertions, 26 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 338cbf2cded..c70a86eab1d 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -54,6 +54,7 @@ #include "DNA_simulation_types.h" #include "DNA_space_types.h" #include "DNA_speaker_types.h" +#include "DNA_userdef_types.h" #include "DNA_volume_types.h" #include "DNA_world_types.h" @@ -170,28 +171,9 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, } /* helper method to test if group colors should be drawn */ -static bool acf_show_channel_colors(bAnimContext *ac) +static bool acf_show_channel_colors(void) { - bool showGroupColors = false; - - if (ac->sl) { - switch (ac->spacetype) { - case SPACE_ACTION: { - SpaceAction *saction = (SpaceAction *)ac->sl; - showGroupColors = !(saction->flag & SACTION_NODRAWGCOLORS); - - break; - } - case SPACE_GRAPH: { - SpaceGraph *sipo = (SpaceGraph *)ac->sl; - showGroupColors = !(sipo->flag & SIPO_NODRAWGCOLORS); - - break; - } - } - } - - return showGroupColors; + return (U.animation_flag & USER_ANIM_SHOW_CHANNEL_GROUP_COLORS) != 0; } /* get backdrop color for generic channels */ @@ -200,7 +182,7 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); bActionGroup *grp = NULL; short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0; - bool showGroupColors = acf_show_channel_colors(ac); + bool showGroupColors = acf_show_channel_colors(); if (ale->type == ANIMTYPE_FCURVE) { FCurve *fcu = (FCurve *)ale->data; @@ -240,7 +222,7 @@ static void acf_gpencil_channel_color(bAnimContext *ac, bAnimListElem *ale, floa { 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); + bool showGroupColors = acf_show_channel_colors(); if ((showGroupColors) && (ale->type == ANIMTYPE_GPLAYER)) { bGPDlayer *gpl = (bGPDlayer *)ale->data; @@ -848,10 +830,10 @@ static bAnimChannelType ACF_OBJECT = { /* Group ------------------------------------------- */ /* get backdrop color for group widget */ -static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3]) +static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float r_color[3]) { bActionGroup *agrp = (bActionGroup *)ale->data; - bool showGroupColors = acf_show_channel_colors(ac); + bool showGroupColors = acf_show_channel_colors(); if (showGroupColors && agrp->customCol) { uchar cp[3]; diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 8634e5a5f29..5036f22fd0e 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -145,7 +145,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region uchar col1a[4], col2a[4]; uchar col1b[4], col2b[4]; - const bool show_group_colors = !(saction->flag & SACTION_NODRAWGCOLORS); + const bool show_group_colors = U.animation_flag & USER_ANIM_SHOW_CHANNEL_GROUP_COLORS; /* get theme colors */ UI_GetThemeColor4ubv(TH_SHADE2, col2); |