diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c index 4570f7ec5ef..55d768d76cc 100644 --- a/release/datafiles/userdef/userdef_default_theme.c +++ b/release/datafiles/userdef/userdef_default_theme.c @@ -253,6 +253,7 @@ const bTheme U_theme_default = { .xaxis = RGBA(0xff3352ff), .yaxis = RGBA(0x8bdc00ff), .zaxis = RGBA(0x2890ffff), + .waxis = RGBA(0xedba18ff), .gizmo_hi = RGBA(0xffffffff), .gizmo_primary = RGBA(0xf5f14dff), .gizmo_secondary = RGBA(0x63ffffff), diff --git a/scripts/presets/interface_theme/Blender_Light.xml b/scripts/presets/interface_theme/Blender_Light.xml index 6550c5f4c99..1b688642c48 100644 --- a/scripts/presets/interface_theme/Blender_Light.xml +++ b/scripts/presets/interface_theme/Blender_Light.xml @@ -24,6 +24,7 @@ axis_x="#ff3352" axis_y="#8bdc00" axis_z="#2890ff" + axis_w="#b47aff" gizmo_hi="#ffffff" gizmo_primary="#f5f14d" gizmo_secondary="#63ffff" diff --git a/scripts/startup/bl_ui/space_userpref.py b/scripts/startup/bl_ui/space_userpref.py index aaf0c3e1d0b..55a5f3ddf53 100644 --- a/scripts/startup/bl_ui/space_userpref.py +++ b/scripts/startup/bl_ui/space_userpref.py @@ -1233,6 +1233,7 @@ class USERPREF_PT_theme_interface_gizmos(ThemePanel, CenterAlignMixIn, Panel): col.prop(ui, "axis_x", text="Axis X") col.prop(ui, "axis_y", text="Y") col.prop(ui, "axis_z", text="Z") + col.prop(ui, "axis_w", text="W") col = flow.column() col.prop(ui, "gizmo_primary") diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 966e66d812e..a57a46a758a 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -27,7 +27,7 @@ /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION -#define BLENDER_FILE_SUBVERSION 51 +#define BLENDER_FILE_SUBVERSION 52 /* 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 diff --git a/source/blender/blenloader/intern/versioning_userdef.cc b/source/blender/blenloader/intern/versioning_userdef.cc index 4a2f43aaac7..74d63b9a579 100644 --- a/source/blender/blenloader/intern/versioning_userdef.cc +++ b/source/blender/blenloader/intern/versioning_userdef.cc @@ -359,6 +359,10 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) FROM_DEFAULT_V4_UCHAR(common.anim.preview_range); } + if (!USER_VERSION_ATLEAST(500, 52)) { + FROM_DEFAULT_V4_UCHAR(tui.waxis); + } + /** * 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/include/UI_resources.hh b/source/blender/editors/include/UI_resources.hh index 70aec9dc1b7..b4e815b7669 100644 --- a/source/blender/editors/include/UI_resources.hh +++ b/source/blender/editors/include/UI_resources.hh @@ -342,6 +342,8 @@ enum ThemeColorID { TH_AXIS_Y, TH_AXIS_Z, + TH_AXIS_W, /* W (quaternion and axis-angle rotations) */ + TH_GIZMO_HI, TH_GIZMO_PRIMARY, TH_GIZMO_SECONDARY, diff --git a/source/blender/editors/interface/resources.cc b/source/blender/editors/interface/resources.cc index 4134564e9ea..ea953c08528 100644 --- a/source/blender/editors/interface/resources.cc +++ b/source/blender/editors/interface/resources.cc @@ -1001,6 +1001,9 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) case TH_AXIS_Z: cp = btheme->tui.zaxis; break; + case TH_AXIS_W: + cp = btheme->tui.waxis; + break; case TH_GIZMO_HI: cp = btheme->tui.gizmo_hi; diff --git a/source/blender/editors/space_graph/space_graph.cc b/source/blender/editors/space_graph/space_graph.cc index e51a9a42051..4a3805a84c6 100644 --- a/source/blender/editors/space_graph/space_graph.cc +++ b/source/blender/editors/space_graph/space_graph.cc @@ -751,23 +751,7 @@ static void graph_refresh_fcurve_colors(const bContext *C) break; case 0: { - /* Special Case: "W" channel should be yellowish, so blend X and Y channel colors... */ - float c1[3], c2[3]; - float h1[3], h2[3]; - float hresult[3]; - - /* - get colors (rgb) */ - UI_GetThemeColor3fv(TH_AXIS_X, c1); - UI_GetThemeColor3fv(TH_AXIS_Y, c2); - - /* - perform blending in HSV space (to keep brightness similar) */ - rgb_to_hsv_v(c1, h1); - rgb_to_hsv_v(c2, h2); - - interp_v3_v3v3(hresult, h1, h2, 0.5f); - - /* - convert back to RGB for display */ - hsv_to_rgb_v(hresult, col); + UI_GetThemeColor3fv(TH_AXIS_W, col); break; } diff --git a/source/blender/makesdna/DNA_theme_types.h b/source/blender/makesdna/DNA_theme_types.h index 9a74a322e07..db14894f885 100644 --- a/source/blender/makesdna/DNA_theme_types.h +++ b/source/blender/makesdna/DNA_theme_types.h @@ -172,14 +172,14 @@ typedef struct ThemeUI { /* Transparent Grid */ unsigned char transparent_checker_primary[4], transparent_checker_secondary[4]; unsigned char transparent_checker_size; - char _pad1[1]; + char _pad1[5]; float icon_alpha; float icon_saturation; unsigned char widget_text_cursor[4]; /* Axis Colors */ - unsigned char xaxis[4], yaxis[4], zaxis[4]; + unsigned char xaxis[4], yaxis[4], zaxis[4], waxis[4]; /* Gizmo Colors. */ unsigned char gizmo_hi[4]; diff --git a/source/blender/makesrna/intern/rna_fcurve.cc b/source/blender/makesrna/intern/rna_fcurve.cc index 2f03bdb60f7..2d952cf8196 100644 --- a/source/blender/makesrna/intern/rna_fcurve.cc +++ b/source/blender/makesrna/intern/rna_fcurve.cc @@ -2555,7 +2555,8 @@ static void rna_def_fcurve(BlenderRNA *brna) "AUTO_YRGB", 0, "Auto WXYZ to YRGB", - "Use axis colors for XYZ parts of transform, and yellow for the 'W' channel"}, + "Use WXYZ axis colors for quaternion/axis-angle rotations, XYZ axis colors for other " + "transform and color properties, and auto-rainbow for the rest"}, {FCURVE_COLOR_CUSTOM, "CUSTOM", 0, diff --git a/source/blender/makesrna/intern/rna_userdef.cc b/source/blender/makesrna/intern/rna_userdef.cc index 1360bd544bd..37315635d1a 100644 --- a/source/blender/makesrna/intern/rna_userdef.cc +++ b/source/blender/makesrna/intern/rna_userdef.cc @@ -2045,6 +2045,12 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Z Axis", ""); RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + prop = RNA_def_property(srna, "axis_w", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, nullptr, "waxis"); + RNA_def_property_array(prop, 3); + RNA_def_property_ui_text(prop, "W Axis", "W-axis for quaternion and axis-angle rotations"); + RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); + /* Generic gizmo colors. */ prop = RNA_def_property(srna, "gizmo_hi", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, nullptr, "gizmo_hi");