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:
authorAlexander Gavrilov <angavrilov@gmail.com>2018-10-18 23:48:06 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2018-10-19 18:30:24 +0300
commiteaa527f6949e7eff77a3b5ecfa8897df126a7771 (patch)
tree4b0e1c10028abc1de41af84aaf4e82a7232b7f73 /source/blender
parent891078b3bc5b675c47159fe8e5171d5bb7d86713 (diff)
Dope Sheet: remove many hard-coded color and alpha constants.
Add the necessary colors and/or alpha components to the theme instead. Also switch the background for ordinary channels to use the likely intended theme option, instead of the window background color. The general rule is that the channel color is drawn full strength in the channel list on the left, and with alpha in the actual key frame area on the right. This alpha is also reused with bone group colors. Reviewers: brecht, billreynish Differential Revision: https://developer.blender.org/D3813
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c12
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c8
-rw-r--r--source/blender/editors/animation/keyframes_draw.c5
-rw-r--r--source/blender/editors/include/UI_resources.h2
-rw-r--r--source/blender/editors/interface/resources.c4
-rw-r--r--source/blender/editors/space_action/action_draw.c44
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h4
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c28
9 files changed, 69 insertions, 40 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index d4b5b4c7d47..b5e20671cac 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -28,7 +28,7 @@
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION 26
+#define BLENDER_SUBVERSION 27
/* Several breakages with 280, e.g. collections vs layers */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index b04acf6016c..2f98d068e7d 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -65,6 +65,18 @@ static void do_versions_theme(UserDef *userdef, bTheme *btheme)
copy_v4_v4_char(btheme->tui.icon_modifier, U_theme_default.tui.icon_modifier);
copy_v4_v4_char(btheme->tui.icon_shading, U_theme_default.tui.icon_shading);
}
+
+ if (!USER_VERSION_ATLEAST(280, 27)) {
+ copy_v4_v4_char(btheme->tact.shade2, U_theme_default.tact.shade2);
+ copy_v4_v4_char(btheme->tact.hilite, U_theme_default.tact.hilite);
+ copy_v4_v4_char(btheme->tact.group, U_theme_default.tact.group);
+ copy_v4_v4_char(btheme->tact.group_active, U_theme_default.tact.group_active);
+ copy_v4_v4_char(btheme->tact.strip_select, U_theme_default.tact.strip_select);
+ copy_v4_v4_char(btheme->tact.ds_channel, U_theme_default.tact.ds_channel);
+ copy_v4_v4_char(btheme->tact.ds_subchannel, U_theme_default.tact.ds_subchannel);
+ copy_v4_v4_char(btheme->tact.keytype_movehold, U_theme_default.tact.keytype_movehold);
+ copy_v4_v4_char(btheme->tact.keytype_movehold_select, U_theme_default.tact.keytype_movehold_select);
+ }
#undef USER_VERSION_ATLEAST
}
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 1495ca50870..b80667a011a 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -223,8 +223,8 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa
}
else {
// FIXME: what happens when the indention is 1 greater than what it should be (due to grouping)?
- int colOfs = 20 - 20 * indent;
- UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, colOfs, r_color);
+ int colOfs = 10 - 10 * indent;
+ UI_GetThemeColorShade3fv(TH_SHADE2, colOfs, r_color);
}
}
@@ -817,9 +817,9 @@ static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float r_color[
else {
/* highlight only for active */
if (ale->flag & AGRP_ACTIVE)
- UI_GetThemeColorShade3fv(TH_GROUP_ACTIVE, 10, r_color);
+ UI_GetThemeColor3fv(TH_GROUP_ACTIVE, r_color);
else
- UI_GetThemeColorShade3fv(TH_GROUP, 20, r_color);
+ UI_GetThemeColor3fv(TH_GROUP, r_color);
}
}
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index 046bf2a3106..33e2a11f4c5 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -471,10 +471,7 @@ void draw_keyframe_shape(float x, float y, float size, bool sel, short key_type,
UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_JITTER_SELECT : TH_KEYTYPE_JITTER, fill_col);
break;
case BEZT_KEYTYPE_MOVEHOLD: /* similar to traditional keyframes, but different... */
- /* XXX: Should these get their own theme options instead? */
- if (sel) UI_GetThemeColorShade3ubv(TH_STRIP_SELECT, 35, fill_col);
- else UI_GetThemeColorShade3ubv(TH_STRIP, 50, fill_col);
- fill_col[3] = 255; /* full opacity, to avoid problems with visual glitches */
+ UI_GetThemeColor4ubv(sel ? TH_KEYTYPE_MOVEHOLD_SELECT : TH_KEYTYPE_MOVEHOLD, fill_col);
break;
case BEZT_KEYTYPE_KEYFRAME: /* traditional yellowish frames (default theme) */
default:
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 1a8b7bb12af..fd6fa3add30 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -156,6 +156,8 @@ typedef enum ThemeColorID {
TH_KEYTYPE_BREAKDOWN_SELECT,
TH_KEYTYPE_JITTER,
TH_KEYTYPE_JITTER_SELECT,
+ TH_KEYTYPE_MOVEHOLD,
+ TH_KEYTYPE_MOVEHOLD_SELECT,
TH_KEYBORDER,
TH_KEYBORDER_SELECT,
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 33a8a2ec5fa..220d7064a5d 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -381,6 +381,10 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
cp = ts->keytype_jitter; break;
case TH_KEYTYPE_JITTER_SELECT:
cp = ts->keytype_jitter_select; break;
+ case TH_KEYTYPE_MOVEHOLD:
+ cp = ts->keytype_movehold; break;
+ case TH_KEYTYPE_MOVEHOLD_SELECT:
+ cp = ts->keytype_movehold_select; break;
case TH_KEYBORDER:
cp = ts->keyborder; break;
case TH_KEYBORDER_SELECT:
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index e679688f887..9da128469cd 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -171,22 +171,22 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
float act_start, act_end, y;
- unsigned char col1[3], col2[3];
- unsigned char col1a[3], col2a[3];
- unsigned char col1b[3], col2b[3];
+ unsigned char col1[4], col2[4];
+ unsigned char col1a[4], col2a[4];
+ unsigned char col1b[4], col2b[4];
const bool show_group_colors = !(saction->flag & SACTION_NODRAWGCOLORS);
/* get theme colors */
- UI_GetThemeColor3ubv(TH_BACK, col2);
- UI_GetThemeColor3ubv(TH_HILITE, col1);
+ UI_GetThemeColor4ubv(TH_SHADE2, col2);
+ UI_GetThemeColor4ubv(TH_HILITE, col1);
- UI_GetThemeColor3ubv(TH_GROUP, col2a);
- UI_GetThemeColor3ubv(TH_GROUP_ACTIVE, col1a);
+ UI_GetThemeColor4ubv(TH_GROUP, col2a);
+ UI_GetThemeColor4ubv(TH_GROUP_ACTIVE, col1a);
- UI_GetThemeColor3ubv(TH_DOPESHEET_CHANNELOB, col1b);
- UI_GetThemeColor3ubv(TH_DOPESHEET_CHANNELSUBOB, col2b);
+ UI_GetThemeColor4ubv(TH_DOPESHEET_CHANNELOB, col1b);
+ UI_GetThemeColor4ubv(TH_DOPESHEET_CHANNELSUBOB, col2b);
/* set view-mapping rect (only used for x-axis), for NLA-scaling mapping with less calculation */
@@ -246,14 +246,14 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
case ANIMTYPE_SCENE:
case ANIMTYPE_OBJECT:
{
- immUniformColor3ubvAlpha(col1b, sel ? 0x45 : 0x22);
+ immUniformColor3ubvAlpha(col1b, sel ? col1[3] : col1b[3]);
break;
}
case ANIMTYPE_FILLACTD:
case ANIMTYPE_DSSKEY:
case ANIMTYPE_DSWOR:
{
- immUniformColor3ubvAlpha(col2b, sel ? 0x45 : 0x22);
+ immUniformColor3ubvAlpha(col2b, sel ? col1[3] : col2b[3]);
break;
}
case ANIMTYPE_GROUP:
@@ -261,14 +261,14 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
bActionGroup *agrp = ale->data;
if (show_group_colors && agrp->customCol) {
if (sel) {
- immUniformColor3ubvAlpha((unsigned char *)agrp->cs.select, 0x45);
+ immUniformColor3ubvAlpha((unsigned char *)agrp->cs.select, col1a[3]);
}
else {
- immUniformColor3ubvAlpha((unsigned char *)agrp->cs.solid, 0x1D);
+ immUniformColor3ubvAlpha((unsigned char *)agrp->cs.solid, col2a[3]);
}
}
else {
- immUniformColor3ubvAlpha(sel ? col1a : col2a, 0x22);
+ immUniformColor4ubv(sel ? col1a : col2a);
}
break;
}
@@ -276,16 +276,16 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
{
FCurve *fcu = ale->data;
if (show_group_colors && fcu->grp && fcu->grp->customCol) {
- immUniformColor3ubvAlpha((unsigned char *)fcu->grp->cs.active, sel ? 0x65 : 0x0B);
+ immUniformColor3ubvAlpha((unsigned char *)fcu->grp->cs.active, sel ? col1[3] : col2[3]);
}
else {
- immUniformColor3ubvAlpha(sel ? col1 : col2, 0x22);
+ immUniformColor4ubv(sel ? col1 : col2);
}
break;
}
default:
{
- immUniformColor3ubvAlpha(sel ? col1 : col2, 0x22);
+ immUniformColor4ubv(sel ? col1 : col2);
}
}
@@ -297,21 +297,23 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
}
else if (ac->datatype == ANIMCONT_GPENCIL) {
/* frames less than one get less saturated background */
- immUniformColor3ubvAlpha(sel ? col1 : col2, 0x22);
+ unsigned char *color = sel ? col1 : col2;
+ immUniformColor4ubv(color);
immRectf(pos, 0.0f, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmin, (float)y + ACHANNEL_HEIGHT_HALF(ac));
/* frames one and higher get a saturated background */
- immUniformColor3ubvAlpha(sel ? col1 : col2, 0x44);
+ immUniformColor3ubvAlpha(color, MIN2(255, color[3]*2));
immRectf(pos, v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac));
}
else if (ac->datatype == ANIMCONT_MASK) {
/* TODO --- this is a copy of gpencil */
/* frames less than one get less saturated background */
- immUniformColor3ubvAlpha(sel ? col1 : col2, 0x22);
+ unsigned char *color = sel ? col1 : col2;
+ immUniformColor4ubv(color);
immRectf(pos, 0.0f, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmin, (float)y + ACHANNEL_HEIGHT_HALF(ac));
/* frames one and higher get a saturated background */
- immUniformColor3ubvAlpha(sel ? col1 : col2, 0x44);
+ immUniformColor3ubvAlpha(color, MIN2(255, color[3]*2));
immRectf(pos, v2d->cur.xmin, (float)y - ACHANNEL_HEIGHT_HALF(ac), v2d->cur.xmax + EXTRA_SCROLL_PAD, (float)y + ACHANNEL_HEIGHT_HALF(ac));
}
}
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 75811ad5369..3fd6fff932b 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -287,8 +287,8 @@ typedef struct ThemeSpace {
char handle_sel_free[4], handle_sel_auto[4], handle_sel_vect[4], handle_sel_align[4], handle_sel_auto_clamped[4];
char ds_channel[4], ds_subchannel[4]; /* dopesheet */
- char keytype_keyframe[4], keytype_extreme[4], keytype_breakdown[4], keytype_jitter[4]; /* keytypes */
- char keytype_keyframe_select[4], keytype_extreme_select[4], keytype_breakdown_select[4], keytype_jitter_select[4]; /* keytypes */
+ char keytype_keyframe[4], keytype_extreme[4], keytype_breakdown[4], keytype_jitter[4], keytype_movehold[4]; /* keytypes */
+ char keytype_keyframe_select[4], keytype_extreme_select[4], keytype_breakdown_select[4], keytype_jitter_select[4], keytype_movehold_select[4]; /* keytypes */
char keyborder[4], keyborder_select[4];
char console_output[4], console_input[4], console_info[4], console_error[4];
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 5783e9252ed..1acba55549a 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2709,51 +2709,51 @@ static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
prop = RNA_def_property(srna, "dopesheet_channel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "ds_channel");
- RNA_def_property_array(prop, 3);
+ RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Dope Sheet Channel", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "dopesheet_subchannel", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "ds_subchannel");
- RNA_def_property_array(prop, 3);
+ RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Dope Sheet Sub-Channel", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "channels", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "shade2");
- RNA_def_property_array(prop, 3);
+ RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Channels", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "channels_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "hilite");
- RNA_def_property_array(prop, 3);
+ RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Channels Selected", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "channel_group", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "group");
- RNA_def_property_array(prop, 3);
+ RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Channel Group", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "active_channels_group", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "group_active");
- RNA_def_property_array(prop, 3);
+ RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Active Channel Group", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "long_key", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "strip");
- RNA_def_property_array(prop, 3);
+ RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Long Key", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "long_key_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "strip_select");
- RNA_def_property_array(prop, 3);
+ RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Long Key Selected", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
@@ -2807,6 +2807,18 @@ static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Jitter Keyframe Selected", "Color of selected jitter keyframe");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+ prop = RNA_def_property(srna, "keyframe_movehold", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keytype_movehold");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Moving Hold Keyframe", "Color of moving hold keyframe");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "keyframe_movehold_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keytype_movehold_select");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Moving Hold Keyframe Selected", "Color of selected moving hold keyframe");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
prop = RNA_def_property(srna, "keyframe_border", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "keyborder");
RNA_def_property_array(prop, 4);