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:
authorSybren A. Stüvel <sybren@blender.org>2020-10-30 12:57:46 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-11-09 13:11:05 +0300
commitad85256e71081016fe7b4009f8a0c0cd7e18dafe (patch)
treecd0eb7f225c2282d4be71d5f9ff55553d1cf0207 /source/blender/editors/animation/anim_channels_defines.c
parent25375c769a158c54396f60b9ceecd3c267871f3e (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/animation/anim_channels_defines.c')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c32
1 files changed, 7 insertions, 25 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];