[Bf-blender-cvs] [eaa527f6949] blender2.8: Dope Sheet: remove many hard-coded color and alpha constants.

Alexander Gavrilov noreply at git.blender.org
Fri Oct 19 17:50:36 CEST 2018


Commit: eaa527f6949e7eff77a3b5ecfa8897df126a7771
Author: Alexander Gavrilov
Date:   Thu Oct 18 23:48:06 2018 +0300
Branches: blender2.8
https://developer.blender.org/rBeaa527f6949e7eff77a3b5ecfa8897df126a7771

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

===================================================================

M	release/datafiles/userdef/userdef_default_theme.c
M	source/blender/blenkernel/BKE_blender_version.h
M	source/blender/blenloader/intern/versioning_userdef.c
M	source/blender/editors/animation/anim_channels_defines.c
M	source/blender/editors/animation/keyframes_draw.c
M	source/blender/editors/include/UI_resources.h
M	source/blender/editors/interface/resources.c
M	source/blender/editors/space_action/action_draw.c
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_userdef.c

===================================================================

diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
index 0a5ac909c31..daf4b1eb1bc 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -502,24 +502,26 @@ const bTheme U_theme_default = {
 			.sub_back = RGBA(0x0000003e),
 		},
 		.shade1 = RGBA(0xc0c0c000),
-		.shade2 = RGBA(0x70707064),
-		.hilite = RGBA(0x60c040ff),
+		.shade2 = RGBA(0x7e7e7e10),
+		.hilite = RGBA(0x60c04044),
 		.grid = RGBA(0x2a2a2aff),
-		.group = RGBA(0x44992eff),
-		.group_active = RGBA(0x5ccd3eff),
+		.group = RGBA(0x3b8c2837),
+		.group_active = RGBA(0x439e2d55),
 		.strip = RGBA(0x1a151580),
-		.strip_select = RGBA(0xff8c00ff),
+		.strip_select = RGBA(0xff8c00cc),
 		.cframe = RGBA(0x5680c2ff),
-		.ds_channel = RGBA(0x5a85b2ff),
-		.ds_subchannel = RGBA(0x7d98b3ff),
+		.ds_channel = RGBA(0x547ca624),
+		.ds_subchannel = RGBA(0x748da624),
 		.keytype_keyframe = RGBA(0xe8e8e8ff),
 		.keytype_extreme = RGBA(0xe8b3ccff),
 		.keytype_breakdown = RGBA(0xb3dbe8ff),
 		.keytype_jitter = RGBA(0x94e575ff),
+		.keytype_movehold = RGBA(0x5c5656ff),
 		.keytype_keyframe_select = RGBA(0xffbe33ff),
 		.keytype_extreme_select = RGBA(0xf28080ff),
 		.keytype_breakdown_select = RGBA(0x54bfedff),
 		.keytype_jitter_select = RGBA(0x61c042ff),
+		.keytype_movehold_select = RGBA(0xffaf23ff),
 		.keyborder = RGBA(0x000000ff),
 		.keyborder_select = RGBA(0x000000ff),
 		.vertex_size = 3,
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 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list