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:
authorMichael Soluyanov <crantisz>2020-02-25 17:09:30 +0300
committerJulian Eisel <eiseljulian@gmail.com>2020-02-25 17:19:19 +0300
commita4a1074f3d2411a562c5cd4d5ebee6d92a1f0a27 (patch)
treee6f3e651349d5095b3c7c5bed1d9db802b997cd9
parent4e9fffc2892601b3b11366f115f342ebeeb026f1 (diff)
UI: Add theme option for time markers line
This patch adds the ability to set colors and alpha of dashed line of Time Markers. That way themes can avoid contrast issues and communicate selection better. See screenshots in D6877. Bumps subversion. Reviewed By: William Reynish, Julian Eisel Differential Revision: https://developer.blender.org/D6877
-rw-r--r--release/datafiles/userdef/userdef_default_theme.c10
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenloader/intern/versioning_280.c26
-rw-r--r--source/blender/blenloader/intern/versioning_userdef.c13
-rw-r--r--source/blender/editors/animation/anim_markers.c41
-rw-r--r--source/blender/editors/include/UI_resources.h2
-rw-r--r--source/blender/editors/interface/resources.c6
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c54
9 files changed, 121 insertions, 34 deletions
diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
index f5f16183d92..3ad2da99b9f 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -435,6 +435,8 @@ const bTheme U_theme_default = {
.vertex_select = RGBA(0xff8500ff),
.cframe = RGBA(0x5680c2ff),
.time_scrub_background = RGBA(0x292929e6),
+ .time_marker_line = RGBA(0x00000060),
+ .time_marker_line_selected = RGBA(0xffffff60),
.lastsel_point = RGBA(0xffffffff),
.handle_auto = RGBA(0x909000ff),
.handle_vect = RGBA(0x409030ff),
@@ -526,6 +528,8 @@ const bTheme U_theme_default = {
.strip_select = RGBA(0xff8c00cc),
.cframe = RGBA(0x5680c2ff),
.time_scrub_background = RGBA(0x292929e6),
+ .time_marker_line = RGBA(0x00000060),
+ .time_marker_line_selected = RGBA(0xffffff60),
.ds_channel = RGBA(0x0f2c4d24),
.ds_subchannel = RGBA(0x143e6624),
.ds_ipoline = RGBA(0x94e575cc),
@@ -580,6 +584,8 @@ const bTheme U_theme_default = {
.strip_select = RGBA(0xff8c00ff),
.cframe = RGBA(0x5680c2ff),
.time_scrub_background = RGBA(0x292929e6),
+ .time_marker_line = RGBA(0x00000060),
+ .time_marker_line_selected = RGBA(0xffffff60),
.ds_channel = RGBA(0x5a85b2ff),
.ds_subchannel = RGBA(0x7d98b3ff),
.keyborder = RGBA(0x000000ff),
@@ -628,6 +634,8 @@ const bTheme U_theme_default = {
.bone_pose = RGBA(0x50c8ff50),
.cframe = RGBA(0x5680c2ff),
.time_scrub_background = RGBA(0x292929e6),
+ .time_marker_line = RGBA(0x00000060),
+ .time_marker_line_selected = RGBA(0xffffff60),
.vertex_size = 3,
.outline_width = 1,
.facedot_size = 4,
@@ -909,6 +917,8 @@ const bTheme U_theme_default = {
.strip_select = RGBA(0xff8c00ff),
.cframe = RGBA(0x5680c2ff),
.time_scrub_background = RGBA(0x292929e6),
+ .time_marker_line = RGBA(0x00000060),
+ .time_marker_line_selected = RGBA(0xffffff60),
.handle_auto = RGBA(0x909000ff),
.handle_align = RGBA(0x803060ff),
.handle_sel_auto = RGBA(0xf0ff40ff),
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 09aa4ca7a6b..3e7edb175d9 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -27,7 +27,7 @@
* \note Use #STRINGIFY() rather than defining with quotes.
*/
#define BLENDER_VERSION 283
-#define BLENDER_SUBVERSION 4
+#define BLENDER_SUBVERSION 5
/** 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_280.c b/source/blender/blenloader/intern/versioning_280.c
index d0fad1aafab..627b38a58e8 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -4466,18 +4466,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
- /**
- * Versioning code until next subversion bump goes here.
- *
- * \note Be sure to check when bumping the version:
- * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend
- * - "versioning_userdef.c", #do_versions_theme
- *
- * \note Keep this message at the bottom of the function.
- */
- {
- /* Keep this block, even when empty. */
-
+ if (!MAIN_VERSION_ATLEAST(bmain, 283, 5)) {
/* Alembic Transform Cache changed from world to local space. */
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
LISTBASE_FOREACH (bConstraint *, con, &ob->constraints) {
@@ -4513,4 +4502,17 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+
+ /**
+ * Versioning code until next subversion bump goes here.
+ *
+ * \note Be sure to check when bumping the version:
+ * - "versioning_userdef.c", #BLO_version_defaults_userpref_blend
+ * - "versioning_userdef.c", #do_versions_theme
+ *
+ * \note Keep this message at the bottom of the function.
+ */
+ {
+ /* Keep this block, even when empty. */
+ }
}
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 94ee8d46675..f70988c9277 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -175,6 +175,19 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
FROM_DEFAULT_V4_UCHAR(space_info.info_operator_text);
}
+ if (!USER_VERSION_ATLEAST(283, 5)) {
+ FROM_DEFAULT_V4_UCHAR(space_graph.time_marker_line);
+ FROM_DEFAULT_V4_UCHAR(space_action.time_marker_line);
+ FROM_DEFAULT_V4_UCHAR(space_nla.time_marker_line);
+ FROM_DEFAULT_V4_UCHAR(space_sequencer.time_marker_line);
+ FROM_DEFAULT_V4_UCHAR(space_clip.time_marker_line);
+ FROM_DEFAULT_V4_UCHAR(space_graph.time_marker_line_selected);
+ FROM_DEFAULT_V4_UCHAR(space_action.time_marker_line_selected);
+ FROM_DEFAULT_V4_UCHAR(space_nla.time_marker_line_selected);
+ FROM_DEFAULT_V4_UCHAR(space_sequencer.time_marker_line_selected);
+ FROM_DEFAULT_V4_UCHAR(space_clip.time_marker_line_selected);
+ }
+
/**
* Versioning code until next subversion bump goes here.
*
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 8d3c932cbe6..4f1cab40463 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -416,41 +416,44 @@ void debug_markers_print_list(ListBase *markers)
/* ************* Marker Drawing ************ */
-static void marker_color_get(TimeMarker *marker, unsigned char *color)
+static void marker_color_get(const TimeMarker *marker, uchar *r_text_color, uchar *r_line_color)
{
if (marker->flag & SELECT) {
- UI_GetThemeColor4ubv(TH_TEXT_HI, color);
+ UI_GetThemeColor4ubv(TH_TEXT_HI, r_text_color);
+ UI_GetThemeColor4ubv(TH_TIME_MARKER_LINE_SELECTED, r_line_color);
}
else {
- UI_GetThemeColor4ubv(TH_TEXT, color);
+ UI_GetThemeColor4ubv(TH_TEXT, r_text_color);
+ UI_GetThemeColor4ubv(TH_TIME_MARKER_LINE, r_line_color);
}
}
-static void draw_marker_name(const uiFontStyle *fstyle,
+static void draw_marker_name(const uchar *text_color,
+ const uiFontStyle *fstyle,
TimeMarker *marker,
float marker_x,
float text_y)
{
- unsigned char text_color[4];
- marker_color_get(marker, text_color);
-
const char *name = marker->name;
+ uchar final_text_color[4];
+
+ copy_v4_v4_uchar(final_text_color, text_color);
#ifdef DURIAN_CAMERA_SWITCH
if (marker->camera) {
Object *camera = marker->camera;
name = camera->id.name + 2;
if (camera->restrictflag & OB_RESTRICT_RENDER) {
- text_color[3] = 100;
+ final_text_color[3] = 100;
}
}
#endif
int name_x = marker_x + UI_DPI_ICON_SIZE * 0.6;
- UI_fontstyle_draw_simple(fstyle, name_x, text_y, name, text_color);
+ UI_fontstyle_draw_simple(fstyle, name_x, text_y, name, final_text_color);
}
-static void draw_marker_line(const float color[4], int xpos, int ymin, int ymax)
+static void draw_marker_line(const uchar *color, int xpos, int ymin, int ymax)
{
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -461,7 +464,7 @@ static void draw_marker_line(const float color[4], int xpos, int ymin, int ymax)
GPU_viewport_size_get_f(viewport_size);
immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC);
- immUniformColor4fv(color);
+ immUniformColor4ubv(color);
immUniform1i("colors_len", 0); /* "simple" mode */
immUniform1f("dash_width", 6.0f);
immUniform1f("dash_factor", 0.5f);
@@ -493,19 +496,15 @@ static int marker_get_icon_id(TimeMarker *marker, int flag)
static void draw_marker(
const uiFontStyle *fstyle, TimeMarker *marker, int cfra, int xpos, int flag, int region_height)
{
+ uchar line_color[4], text_color[4];
+
+ marker_color_get(marker, text_color, line_color);
+
GPU_blend(true);
GPU_blend_set_func_separate(
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
- float color[4];
- if (marker->flag & SELECT) {
- copy_v4_fl4(color, 1.0f, 1.0f, 1.0f, 0.38f);
- }
- else {
- copy_v4_fl4(color, 0.0f, 0.0f, 0.0f, 0.38f);
- }
-
- draw_marker_line(color, xpos, UI_DPI_FAC * 20, region_height);
+ draw_marker_line(line_color, xpos, UI_DPI_FAC * 20, region_height);
int icon_id = marker_get_icon_id(marker, flag);
UI_icon_draw(xpos - 0.55f * UI_DPI_ICON_SIZE, UI_DPI_FAC * 18, icon_id);
@@ -518,7 +517,7 @@ static void draw_marker(
if ((marker->flag & SELECT) || (cfra - 4 <= marker->frame && marker->frame <= cfra)) {
name_y += UI_DPI_FAC * 10;
}
- draw_marker_name(fstyle, marker, xpos, name_y);
+ draw_marker_name(text_color, fstyle, marker, xpos, name_y);
}
static void draw_markers_background(rctf *rect)
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index e4b11977214..10ca89c8222 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -108,6 +108,8 @@ typedef enum ThemeColorID {
TH_FACEDOT_SIZE,
TH_CFRAME,
TH_TIME_SCRUB_BACKGROUND,
+ TH_TIME_MARKER_LINE,
+ TH_TIME_MARKER_LINE_SELECTED,
TH_TIME_KEYFRAME,
TH_TIME_GP_KEYFRAME,
TH_NURB_ULINE,
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 4a6ce59de9b..cdbd049346e 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -311,6 +311,12 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case TH_TIME_SCRUB_BACKGROUND:
cp = ts->time_scrub_background;
break;
+ case TH_TIME_MARKER_LINE:
+ cp = ts->time_marker_line;
+ break;
+ case TH_TIME_MARKER_LINE_SELECTED:
+ cp = ts->time_marker_line_selected;
+ break;
case TH_VIEW_OVERLAY:
cp = ts->view_overlay;
break;
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 8459447a688..d0d966381d1 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -289,6 +289,7 @@ typedef struct ThemeSpace {
unsigned char time_keyframe[4], time_gp_keyframe[4];
unsigned char freestyle_edge_mark[4], freestyle_face_mark[4];
unsigned char time_scrub_background[4];
+ unsigned char time_marker_line[4], time_marker_line_selected[4];
unsigned char nurb_uline[4], nurb_vline[4];
unsigned char act_spline[4], nurb_sel_uline[4], nurb_sel_vline[4], lastsel_point[4];
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 418fcfaf5f4..34f4fd45b9c 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2338,6 +2338,16 @@ static void rna_def_userdef_theme_space_graph(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Scrubbing/Markers Region", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "time_marker_line", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Marker Line", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "time_marker_line_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Marker Line Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
prop = RNA_def_property(srna, "window_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "shade1");
RNA_def_property_array(prop, 3);
@@ -3074,6 +3084,17 @@ static void rna_def_userdef_theme_space_seq(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Scrubbing/Markers Region", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "time_marker_line", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Marker Line", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "time_marker_line_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Marker Line Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+
prop = RNA_def_property(srna, "keyframe", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "vertex_select");
RNA_def_property_array(prop, 3);
@@ -3142,6 +3163,17 @@ static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Scrubbing/Markers Region", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "time_marker_line", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Marker Line", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "time_marker_line_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Marker Line Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+
prop = RNA_def_property(srna, "value_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "face");
RNA_def_property_array(prop, 3);
@@ -3451,6 +3483,17 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Scrubbing/Markers Region", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "time_marker_line", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Marker Line", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "time_marker_line_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Marker Line Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
}
static void rna_def_userdef_theme_colorset(BlenderRNA *brna)
@@ -3571,6 +3614,17 @@ static void rna_def_userdef_theme_space_clip(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Scrubbing/Markers Region", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "time_marker_line", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Marker Line", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "time_marker_line_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Marker Line Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+
prop = RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_float_sdna(prop, NULL, "strip");
RNA_def_property_array(prop, 3);