From 7f62d5d85e4a2707b3754f06e02dc7115b25a3d9 Mon Sep 17 00:00:00 2001 From: Nika Kutsniashvili Date: Fri, 12 Sep 2025 14:49:27 +0200 Subject: [PATCH] UI: Theme: Common colors for animation channels Continuation of #140360 New common properties for Channel and Channel Selected, used in animation editors. Previously Dope Sheet, Graph Editor, NLA, and Movie Clip Editor had separate properties for them. Video and images inside the PR. --- > [!important] - Channels looked different in Dope Sheet and Graph Editor. In the former, they were same color as the background, so only labels and icons were visible, in the latter they had a darker color, so their outline was visible. We need to pick which design we go for now that they're combined. I chose color from Graph Editor for now, with alpha from Dope Sheet, since only that editor uses alpha. --- There is a confusion with names of channel colors. In 4.5 there is: - - "Channel" (singular, blue color) which refers to objects, actions, and action slots that hold/combine channels. - - "Channels" (plural, black color) which refers to individual channels. This goes against how we name things. In theme, especially, we refer to object colors as "Object", singular, not Objects, plular. Same goes for all elements except this one, where individual elements are referred in plural. To lessen the confusion, and also avoid unnecessary breaking changes in the future (in case we want to rename blue things, which seems likely), in this PR I swap those names. Main reason is that black color marks individual channels, so it should be singular, and blue colors are combination of many channels, so they should be plural. Otherwise even talking about them is awkward. Note that renaming isn't a breaking change, because we already "broke" them by moving them to common path from individual editors. Pull Request: https://projects.blender.org/blender/blender/pulls/146091 --- .../datafiles/userdef/userdef_default_theme.c | 11 ++-- .../presets/interface_theme/Blender_Light.xml | 11 ++-- .../blender/blenkernel/BKE_blender_version.h | 2 +- .../blenloader/intern/versioning_userdef.cc | 13 ++--- .../animation/anim_channels_defines.cc | 2 +- .../blender/editors/include/UI_resources.hh | 4 +- source/blender/editors/interface/resources.cc | 13 +++-- .../editors/space_action/action_draw.cc | 4 +- .../editors/space_clip/clip_dopesheet_draw.cc | 4 +- source/blender/makesdna/DNA_theme_types.h | 9 +--- source/blender/makesrna/intern/rna_userdef.cc | 51 +++++-------------- 11 files changed, 48 insertions(+), 76 deletions(-) diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c index 316775f7ede..97b1ff58712 100644 --- a/release/datafiles/userdef/userdef_default_theme.c +++ b/release/datafiles/userdef/userdef_default_theme.c @@ -298,10 +298,12 @@ const bTheme U_theme_default = { .preview_range = RGBA(0xa14d0066), .time_marker = RGBA(0xffffff4d), .time_marker_selected = RGBA(0xffffffb3), - .channel = RGBA(0x194e8080), - .channel_sub = RGBA(0x0f2c4d80), + .channels = RGBA(0x194e8080), + .channels_sub = RGBA(0x0f2c4d80), .channel_group = RGBA(0x1a332d37), .channel_group_active = RGBA(0x216d5b67), + .channel = RGBA(0x12121299), + .channel_selected = RGBA(0x60c04044), .keyframe = RGBA(0xbfbfbfff), .keyframe_extreme = RGBA(0xe8b3ccff), .keyframe_breakdown = RGBA(0xb3dbe8ff), @@ -442,7 +444,6 @@ const bTheme U_theme_default = { .header_text = RGBA(0xeeeeeeff), .header_text_hi = RGBA(0xffffffff), .shade1 = RGBA(0x96969600), - .shade2 = RGBA(0x12121264), .grid = RGBA(0x1a1a1aff), .vertex = RGBA(0x000000ff), .vertex_select = RGBA(0xff8500ff), @@ -484,8 +485,6 @@ const bTheme U_theme_default = { .header_text = RGBA(0xeeeeeeff), .header_text_hi = RGBA(0xffffffff), .shade1 = RGBA(0xc0c0c000), - .shade2 = RGBA(0x1d1d1d99), - .hilite = RGBA(0x60c04044), .grid = RGBA(0x161616ff), .time_scrub_background = RGBA(0x1d1d1dff), .ds_ipoline = RGBA(0x94e575cc), @@ -520,7 +519,6 @@ const bTheme U_theme_default = { .anim_non_active = RGBA(0x4d3b174d), .nla_tweaking = RGBA(0x4df31a4d), .nla_tweakdupli = RGBA(0xd90000ff), - .nla_track = RGBA(0x303030ff), .nla_transition = RGBA(0x1c2630ff), .nla_transition_sel = RGBA(0x2e75dbff), .nla_meta = RGBA(0x332642ff), @@ -745,7 +743,6 @@ const bTheme U_theme_default = { .path_keyframe_after = RGBA(0xc4c4ffff), .gp_vertex_size = 1, .metadatatext = RGBA(0xffffffff), - .track_selected = RGBA(0xe7f7e74d), }, .space_topbar = { .back = RGBA(0x18181800), diff --git a/scripts/presets/interface_theme/Blender_Light.xml b/scripts/presets/interface_theme/Blender_Light.xml index dd3433d0447..fd11ed05a57 100644 --- a/scripts/presets/interface_theme/Blender_Light.xml +++ b/scripts/presets/interface_theme/Blender_Light.xml @@ -417,10 +417,12 @@ preview_range="#a14d0066" time_marker="#00000060" time_marker_selected="#ffffff60" - channel="#2e639924" - channel_sub="#7aa4cc24" + channels="#2e639924" + channels_sub="#7aa4cc24" channel_group="#278c0e37" channel_group_active="#4eb33555" + channel="#999999ff" + channels_selected="#60c04044" keyframe="#e8e8e8" keyframe_selected="#ffbe33" keyframe_extreme="#e8b3cc" @@ -551,7 +553,6 @@ common.curves.handle_vertex_size = U_theme_default.common.curves.handle_vertex_size; } - if (!USER_VERSION_ATLEAST(500, 68)) { - FROM_DEFAULT_V4_UCHAR(space_clip.track_selected); - } - if (!USER_VERSION_ATLEAST(500, 69)) { FROM_DEFAULT_V4_UCHAR(common.anim.keyframe); FROM_DEFAULT_V4_UCHAR(common.anim.keyframe_extreme); @@ -361,6 +355,13 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) FROM_DEFAULT_V4_UCHAR(regions.sidebars.tab_back); } + if (!USER_VERSION_ATLEAST(500, 79)) { + FROM_DEFAULT_V4_UCHAR(common.anim.channels); + FROM_DEFAULT_V4_UCHAR(common.anim.channels_sub); + FROM_DEFAULT_V4_UCHAR(common.anim.channel); + FROM_DEFAULT_V4_UCHAR(common.anim.channel_selected); + } + /** * Always bump subversion in BKE_blender_version.h when adding versioning * code here, and wrap it inside a USER_VERSION_ATLEAST check. diff --git a/source/blender/editors/animation/anim_channels_defines.cc b/source/blender/editors/animation/anim_channels_defines.cc index a90aadb7f13..4f2dada8090 100644 --- a/source/blender/editors/animation/anim_channels_defines.cc +++ b/source/blender/editors/animation/anim_channels_defines.cc @@ -189,7 +189,7 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa /* FIXME: what happens when the indentation is 1 greater than what it should be * (due to grouping)? */ const int colorOffset = 10 - 10 * indent; - UI_GetThemeColorShade3fv(TH_SHADE2, colorOffset, r_color); + UI_GetThemeColorShade3fv(TH_CHANNEL, colorOffset, r_color); } /* backdrop for generic channels */ diff --git a/source/blender/editors/include/UI_resources.hh b/source/blender/editors/include/UI_resources.hh index 3f0d6ef2f92..9d8b9205807 100644 --- a/source/blender/editors/include/UI_resources.hh +++ b/source/blender/editors/include/UI_resources.hh @@ -157,7 +157,9 @@ enum ThemeColorID { TH_STRIP, TH_STRIP_SELECT, - TH_TRACK_SELECT, + + TH_CHANNEL, + TH_CHANNEL_SELECT, TH_LONGKEY, TH_LONGKEY_SELECT, diff --git a/source/blender/editors/interface/resources.cc b/source/blender/editors/interface/resources.cc index 4baee5c6bd6..56c6841c61d 100644 --- a/source/blender/editors/interface/resources.cc +++ b/source/blender/editors/interface/resources.cc @@ -491,8 +491,11 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) case TH_STRIP_SELECT: cp = ts->strip_select; break; - case TH_TRACK_SELECT: - cp = ts->track_selected; + case TH_CHANNEL: + cp = btheme->common.anim.channel; + break; + case TH_CHANNEL_SELECT: + cp = btheme->common.anim.channel_selected; break; case TH_KEYTYPE_KEYFRAME: cp = btheme->common.anim.keyframe; @@ -793,10 +796,10 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) break; case TH_DOPESHEET_CHANNELOB: - cp = btheme->common.anim.channel; + cp = btheme->common.anim.channels; break; case TH_DOPESHEET_CHANNELSUBOB: - cp = btheme->common.anim.channel_sub; + cp = btheme->common.anim.channels_sub; break; case TH_DOPESHEET_IPOLINE: cp = ts->ds_ipoline; @@ -937,7 +940,7 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) break; case TH_NLA_TRACK: - cp = ts->nla_track; + cp = btheme->common.anim.channel; break; case TH_NLA_TRANSITION: cp = ts->nla_transition; diff --git a/source/blender/editors/space_action/action_draw.cc b/source/blender/editors/space_action/action_draw.cc index 52a801f2866..6810beca53a 100644 --- a/source/blender/editors/space_action/action_draw.cc +++ b/source/blender/editors/space_action/action_draw.cc @@ -177,8 +177,8 @@ static void draw_backdrops(bAnimContext *ac, ListBase &anim_data, View2D *v2d, u uchar col_summary[4]; /* get theme colors */ - UI_GetThemeColor4ubv(TH_SHADE2, col2); - UI_GetThemeColor4ubv(TH_HILITE, col1); + UI_GetThemeColor4ubv(TH_CHANNEL, col2); + UI_GetThemeColor4ubv(TH_CHANNEL_SELECT, col1); UI_GetThemeColor4ubv(TH_ANIM_ACTIVE, col_summary); UI_GetThemeColor4ubv(TH_GROUP, col2a); diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.cc b/source/blender/editors/space_clip/clip_dopesheet_draw.cc index 86473a41cd8..8e00a6c7a0e 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.cc +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.cc @@ -47,10 +47,10 @@ static void track_channel_color(MovieTrackingTrack *track, bool default_color, f } else { if (default_color) { - UI_GetThemeColor4fv(TH_TRACK_SELECT, color); + UI_GetThemeColor4fv(TH_CHANNEL_SELECT, color); } else { - UI_GetThemeColor3fv(TH_HEADER, color); + UI_GetThemeColor3fv(TH_CHANNEL, color); } } } diff --git a/source/blender/makesdna/DNA_theme_types.h b/source/blender/makesdna/DNA_theme_types.h index ab4ca9811cd..cb593d99616 100644 --- a/source/blender/makesdna/DNA_theme_types.h +++ b/source/blender/makesdna/DNA_theme_types.h @@ -135,8 +135,9 @@ typedef struct ThemeCommonAnim { unsigned char time_marker[4], time_marker_selected[4]; - unsigned char channel[4], channel_sub[4]; + unsigned char channels[4], channels_sub[4]; unsigned char channel_group[4], channel_group_active[4]; + unsigned char channel[4], channel_selected[4]; /** Key-types. */ unsigned char keyframe[4], keyframe_extreme[4], keyframe_breakdown[4], keyframe_jitter[4], @@ -433,8 +434,6 @@ typedef struct ThemeSpace { /** NLA - warning color for duplicate instances of tweaking strip. */ unsigned char nla_tweakdupli[4]; - /** NLA "Track" */ - unsigned char nla_track[4]; /** NLA "Transition" strips. */ unsigned char nla_transition[4], nla_transition_sel[4]; /** NLA "Meta" strips. */ @@ -456,10 +455,6 @@ typedef struct ThemeSpace { unsigned char metadatabg[4]; unsigned char metadatatext[4]; - - /** For Movie Clip Editor. */ - unsigned char track_selected[4]; - } ThemeSpace; /* Viewport Background Gradient Types. */ diff --git a/source/blender/makesrna/intern/rna_userdef.cc b/source/blender/makesrna/intern/rna_userdef.cc index 11151866dfd..a3d7cb1640e 100644 --- a/source/blender/makesrna/intern/rna_userdef.cc +++ b/source/blender/makesrna/intern/rna_userdef.cc @@ -2278,16 +2278,14 @@ static void rna_def_userdef_theme_common_anim(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); /* Channel properties */ - prop = RNA_def_property(srna, "channel", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, nullptr, "channel"); + prop = RNA_def_property(srna, "channels", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 4); - RNA_def_property_ui_text(prop, "Channel", ""); + RNA_def_property_ui_text(prop, "Channels", ""); RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); - prop = RNA_def_property(srna, "channel_sub", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, nullptr, "channel_sub"); + prop = RNA_def_property(srna, "channels_sub", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 4); - RNA_def_property_ui_text(prop, "Sub-channel", ""); + RNA_def_property_ui_text(prop, "Sub-channels", ""); RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); prop = RNA_def_property(srna, "channel_group", PROP_FLOAT, PROP_COLOR_GAMMA); @@ -2302,6 +2300,16 @@ static void rna_def_userdef_theme_common_anim(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Active Channel Group", ""); RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + prop = RNA_def_property(srna, "channel", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Channel", ""); + RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + + prop = RNA_def_property(srna, "channel_selected", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Selected Channel", ""); + RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + /* Keyframe properties */ prop = RNA_def_property(srna, "keyframe", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 3); @@ -3039,12 +3047,6 @@ 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, "channels_region", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, nullptr, "shade2"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Channels Region", ""); - RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); - rna_def_userdef_theme_spaces_vertex(srna, true, false); } @@ -3836,18 +3838,6 @@ 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, "channels", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, nullptr, "shade2"); - RNA_def_property_array(prop, 4); - RNA_def_property_ui_text(prop, "Channels", ""); - RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); - - prop = RNA_def_property(srna, "channels_selected", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, nullptr, "hilite"); - RNA_def_property_array(prop, 4); - RNA_def_property_ui_text(prop, "Channels Selected", ""); - RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); - prop = RNA_def_property(srna, "keyframe_border", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, nullptr, "keyborder"); RNA_def_property_array(prop, 4); @@ -3906,13 +3896,6 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Grid", ""); RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); - prop = RNA_def_property(srna, "nla_track", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, nullptr, "nla_track"); - RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Track", "Nonlinear Animation Track"); - RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ACTION); - RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); - prop = RNA_def_property(srna, "active_action", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, nullptr, "anim_active"); RNA_def_property_array(prop, 4); @@ -4173,12 +4156,6 @@ static void rna_def_userdef_theme_space_clip(BlenderRNA *brna) RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Metadata Text", ""); RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); - - prop = RNA_def_property(srna, "track_selected", PROP_FLOAT, PROP_COLOR_GAMMA); - RNA_def_property_float_sdna(prop, nullptr, "track_selected"); - RNA_def_property_array(prop, 4); - RNA_def_property_ui_text(prop, "Selected Tracks", ""); - RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); } static void rna_def_userdef_theme_space_topbar(BlenderRNA *brna)