UI: Add common theme properties panel; make preview range common
First part of design defined in #140360 Images in PR This PR does two things: - Creates new panel in theme preferences called "Common" that doesn't belong to any editor - Moves "Preview Range" property in common, and removes it from animation editors. Now, there is a single theme property for preview range, rather than 5 for each animation editor. Co-authored-by: Pablo Vazquez <pablo@blender.org> Pull Request: https://projects.blender.org/blender/blender/pulls/140686
This commit is contained in:
committed by
Nika Kutsniashvili
parent
0730d3f256
commit
39c066ee53
@@ -275,6 +275,11 @@ const bTheme U_theme_default = {
|
||||
.panel_title = RGBA(0xe6e6e6ff),
|
||||
.panel_text = RGBA(0xe6e6e6ff),
|
||||
},
|
||||
.common = {
|
||||
.anim = {
|
||||
.preview_range = RGBA(0xa14d0066),
|
||||
},
|
||||
},
|
||||
.space_properties = {
|
||||
.back = RGBA(0x30303000),
|
||||
.title = RGBA(0xe6e6e6ff),
|
||||
@@ -436,7 +441,6 @@ const bTheme U_theme_default = {
|
||||
.facedot_size = 4,
|
||||
.handle_vertex_select = RGBA(0xff8500ff),
|
||||
.handle_vertex_size = 5,
|
||||
.anim_preview_range = RGBA(0xa14d0066),
|
||||
},
|
||||
.space_info = {
|
||||
.back = RGBA(0x1d1d1d00),
|
||||
@@ -511,7 +515,6 @@ const bTheme U_theme_default = {
|
||||
.keyframe_scale_fac = 1.0f,
|
||||
.handle_vertex_size = 4,
|
||||
.anim_active = RGBA(0x4d272766),
|
||||
.anim_preview_range = RGBA(0xa14d0066),
|
||||
},
|
||||
.space_nla = {
|
||||
.back = RGBA(0x30303000),
|
||||
@@ -545,7 +548,6 @@ const bTheme U_theme_default = {
|
||||
.handle_vertex_size = 4,
|
||||
.anim_active = RGBA(0x99541366),
|
||||
.anim_non_active = RGBA(0x4d3b174d),
|
||||
.anim_preview_range = RGBA(0xa14d0066),
|
||||
.nla_tweaking = RGBA(0x4df31a4d),
|
||||
.nla_tweakdupli = RGBA(0xd90000ff),
|
||||
.nla_track = RGBA(0x303030ff),
|
||||
@@ -615,7 +617,6 @@ const bTheme U_theme_default = {
|
||||
.gp_vertex_size = 3,
|
||||
.gp_vertex_select = RGBA(0xff8500ff),
|
||||
.row_alternate = RGBA(0xffffff05),
|
||||
.anim_preview_range = RGBA(0xa14d0066),
|
||||
.metadatatext = RGBA(0xffffffff),
|
||||
},
|
||||
.space_image = {
|
||||
@@ -835,7 +836,6 @@ const bTheme U_theme_default = {
|
||||
.path_keyframe_before = RGBA(0xffc4c4ff),
|
||||
.path_keyframe_after = RGBA(0xc4c4ffff),
|
||||
.gp_vertex_size = 1,
|
||||
.anim_preview_range = RGBA(0xa14d0066),
|
||||
.metadatatext = RGBA(0xffffffff),
|
||||
},
|
||||
.space_topbar = {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
/* Blender file format version. */
|
||||
#define BLENDER_FILE_VERSION BLENDER_VERSION
|
||||
#define BLENDER_FILE_SUBVERSION 49
|
||||
#define BLENDER_FILE_SUBVERSION 50
|
||||
|
||||
/* Minimum Blender version that supports reading file written with the current
|
||||
* version. Older Blender versions will test this and cancel loading the file, showing a warning to
|
||||
|
||||
@@ -235,10 +235,6 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
|
||||
FROM_DEFAULT_V4_UCHAR(space_node.node_zone_closure);
|
||||
}
|
||||
|
||||
if (!USER_VERSION_ATLEAST(405, 82)) {
|
||||
FROM_DEFAULT_V4_UCHAR(space_clip.anim_preview_range);
|
||||
}
|
||||
|
||||
if (!USER_VERSION_ATLEAST(500, 5)) {
|
||||
FROM_DEFAULT_V4_UCHAR(space_properties.tab_back);
|
||||
FROM_DEFAULT_V4_UCHAR(space_view3d.tab_back);
|
||||
@@ -359,6 +355,10 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
|
||||
}
|
||||
}
|
||||
|
||||
if (!USER_VERSION_ATLEAST(500, 50)) {
|
||||
FROM_DEFAULT_V4_UCHAR(common.anim.preview_range);
|
||||
}
|
||||
|
||||
/**
|
||||
* Always bump subversion in BKE_blender_version.h when adding versioning
|
||||
* code here, and wrap it inside a USER_VERSION_ATLEAST check.
|
||||
|
||||
@@ -927,7 +927,7 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
|
||||
cp = ts->anim_non_active;
|
||||
break;
|
||||
case TH_ANIM_PREVIEW_RANGE:
|
||||
cp = ts->anim_preview_range;
|
||||
cp = btheme->common.anim.preview_range;
|
||||
break;
|
||||
|
||||
case TH_NLA_TWEAK:
|
||||
|
||||
@@ -106,6 +106,16 @@ typedef struct uiStyle {
|
||||
char _pad0[2];
|
||||
} uiStyle;
|
||||
|
||||
typedef struct ThemeCommonAnim {
|
||||
/** Preview range overlay. */
|
||||
unsigned char preview_range[4];
|
||||
} ThemeCommonAnim;
|
||||
|
||||
typedef struct ThemeCommon {
|
||||
ThemeCommonAnim anim;
|
||||
char _pad[4];
|
||||
} ThemeCommon;
|
||||
|
||||
typedef struct uiWidgetColors {
|
||||
unsigned char outline[4];
|
||||
unsigned char outline_sel[4];
|
||||
@@ -401,8 +411,7 @@ typedef struct ThemeSpace {
|
||||
unsigned char anim_active[4];
|
||||
/** Active Action = NULL. */
|
||||
unsigned char anim_non_active[4];
|
||||
/** Preview range overlay. */
|
||||
unsigned char anim_preview_range[4];
|
||||
char _pad8[4];
|
||||
|
||||
/** NLA 'Tweaking' action/strip. */
|
||||
unsigned char nla_tweaking[4];
|
||||
@@ -491,6 +500,8 @@ typedef struct bTheme {
|
||||
|
||||
ThemeUI tui;
|
||||
|
||||
ThemeCommon common;
|
||||
|
||||
/**
|
||||
* Individual Space-types:
|
||||
* \note Ensure #UI_THEMESPACE_END is updated when adding.
|
||||
|
||||
@@ -2140,6 +2140,39 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update_icons");
|
||||
}
|
||||
|
||||
static void rna_def_userdef_theme_common_anim(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna = RNA_def_struct(brna, "ThemeCommonAnim", nullptr);
|
||||
RNA_def_struct_sdna(srna, "ThemeCommonAnim");
|
||||
RNA_def_struct_ui_text(srna, "Common Animation Properties", "Shared animation theme properties");
|
||||
|
||||
prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "preview_range");
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
}
|
||||
|
||||
static void rna_def_userdef_theme_common(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
rna_def_userdef_theme_common_anim(brna);
|
||||
|
||||
srna = RNA_def_struct(brna, "ThemeCommon", nullptr);
|
||||
RNA_def_struct_ui_text(
|
||||
srna, "Common Theme Properties", "Theme properties shared by different editors");
|
||||
|
||||
prop = RNA_def_property(srna, "anim", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
RNA_def_property_ui_text(prop, "Animation", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
}
|
||||
|
||||
static void rna_def_userdef_theme_space_common(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
@@ -2949,12 +2982,6 @@ static void rna_def_userdef_theme_space_graph(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, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "anim_preview_range");
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
rna_def_userdef_theme_spaces_vertex(srna, true);
|
||||
rna_def_userdef_theme_spaces_curves(srna, false, true, true, true);
|
||||
}
|
||||
@@ -3826,12 +3853,6 @@ static void rna_def_userdef_theme_space_seq(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Metadata Text", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "anim_preview_range");
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
prop = RNA_def_property(srna, "row_alternate", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Alternate Rows", "Overlay color on every other row");
|
||||
@@ -4054,12 +4075,6 @@ static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Summary", "Color of summary channel");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "anim_preview_range");
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
prop = RNA_def_property(srna, "interpolation_line", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "ds_ipoline");
|
||||
RNA_def_property_array(prop, 4);
|
||||
@@ -4131,12 +4146,6 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
|
||||
prop, "No Active Action", "Animation data-block doesn't have active action");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "anim_preview_range");
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
|
||||
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, nullptr, "strip");
|
||||
RNA_def_property_array(prop, 3);
|
||||
@@ -4431,12 +4440,6 @@ static void rna_def_userdef_theme_space_clip(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Metadata Text", "");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "anim_preview_range");
|
||||
RNA_def_property_array(prop, 4);
|
||||
RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
|
||||
|
||||
rna_def_userdef_theme_spaces_curves(srna, false, false, false, true);
|
||||
}
|
||||
|
||||
@@ -4494,6 +4497,7 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
|
||||
static const EnumPropertyItem active_theme_area[] = {
|
||||
{0, "USER_INTERFACE", ICON_WORKSPACE, "User Interface", ""},
|
||||
{19, "STYLE", ICON_FONTPREVIEW, "Text Style", ""},
|
||||
{25, "COMMON", ICON_NONE, "Common", ""},
|
||||
{24, "ASSET_SHELF", ICON_ASSET_MANAGER, "Asset Shelf", ""},
|
||||
{1, "VIEW_3D", ICON_VIEW3D, "3D Viewport", ""},
|
||||
{4, "DOPESHEET_EDITOR", ICON_ACTION, "Dope Sheet/Timeline", ""},
|
||||
@@ -4548,6 +4552,11 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
|
||||
RNA_def_property_struct_type(prop, "ThemeUserInterface");
|
||||
RNA_def_property_ui_text(prop, "User Interface", "");
|
||||
|
||||
prop = RNA_def_property(srna, "common", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
RNA_def_property_struct_type(prop, "ThemeCommon");
|
||||
RNA_def_property_ui_text(prop, "Common", "Theme properties shared by different editors");
|
||||
|
||||
/* Space Types */
|
||||
prop = RNA_def_property(srna, "view_3d", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
@@ -4876,6 +4885,7 @@ static void rna_def_userdef_dothemes(BlenderRNA *brna)
|
||||
|
||||
rna_def_userdef_theme_ui_style(brna);
|
||||
rna_def_userdef_theme_ui(brna);
|
||||
rna_def_userdef_theme_common(brna);
|
||||
|
||||
rna_def_userdef_theme_space_generic(brna);
|
||||
rna_def_userdef_theme_space_gradient(brna);
|
||||
|
||||
Reference in New Issue
Block a user