From a9e9921e83da15fc7f3736ff6c4045350265fdc6 Mon Sep 17 00:00:00 2001 From: Dennis Brakhane Date: Sat, 11 Jan 2025 20:32:18 +0100 Subject: [PATCH] add option to disable editor UI animations --- Editor/GeneralWindow.cpp | 18 ++++++++++++++++-- Editor/GeneralWindow.h | 1 + Editor/IconDefinitions.h | 2 ++ WickedEngine/wiGUI.cpp | 37 ++++++++++++++++++++++++++++++++++++- 4 files changed, 55 insertions(+), 3 deletions(-) diff --git a/Editor/GeneralWindow.cpp b/Editor/GeneralWindow.cpp index 2f0c57c6b6..274958d753 100644 --- a/Editor/GeneralWindow.cpp +++ b/Editor/GeneralWindow.cpp @@ -154,7 +154,18 @@ void GeneralWindow::Create(EditorComponent* _editor) forceDiffuseLightingCheckBox.SetCheck(wi::renderer::IsForceDiffuseLighting()); AddWidget(&forceDiffuseLightingCheckBox); - + reduceGuiFx.Create(ICON_EYE " Reduce editor UI effects: "); + reduceGuiFx.SetTooltip("Reduce the amount of effects in the editor GUI to improve accessibility"); + if (editor->main->config.GetSection("a11y").Has("reduceFX")) { + reduceGuiFx.SetCheck(editor->main->config.GetSection("a11y").GetBool("reduceFX")); + } + reduceGuiFx.OnClick([&](wi::gui::EventArgs args) { + editor->main->config.GetSection("a11y").Set("reduceFX", args.bValue); + // trigger themeCombo's OnSelect handler, which will enable/disable shadow highlighting + // according to this checkbox's state + themeCombo.SetSelected(themeCombo.GetSelected()); + }); + AddWidget(&reduceGuiFx); versionCheckBox.Create("Version: "); versionCheckBox.SetTooltip("Toggle the engine version display text in top left corner."); @@ -374,7 +385,7 @@ void GeneralWindow::Create(EditorComponent* _editor) break; } - theme.shadow_highlight = true; + theme.shadow_highlight = !reduceGuiFx.GetCheck(); theme.shadow_highlight_spread = 0.6f; theme.shadow_highlight_color = theme_color_focus; theme.shadow_highlight_color.x *= 1.4f; @@ -980,6 +991,9 @@ void GeneralWindow::ResizeLayout() add_right(freezeCullingCameraCheckBox); add_right(disableAlbedoMapsCheckBox); add_right(forceDiffuseLightingCheckBox); + y += jump; + + add_right(reduceGuiFx); y += jump; diff --git a/Editor/GeneralWindow.h b/Editor/GeneralWindow.h index 6370683af7..74a6a31f63 100644 --- a/Editor/GeneralWindow.h +++ b/Editor/GeneralWindow.h @@ -30,6 +30,7 @@ class GeneralWindow : public wi::gui::Window wi::gui::CheckBox freezeCullingCameraCheckBox; wi::gui::CheckBox disableAlbedoMapsCheckBox; wi::gui::CheckBox forceDiffuseLightingCheckBox; + wi::gui::CheckBox reduceGuiFx; wi::gui::Slider transformToolOpacitySlider; wi::gui::Slider bonePickerOpacitySlider; diff --git a/Editor/IconDefinitions.h b/Editor/IconDefinitions.h index 23339198df..a79d95497e 100644 --- a/Editor/IconDefinitions.h +++ b/Editor/IconDefinitions.h @@ -96,3 +96,5 @@ #define ICON_CAMERAOPTIONS ICON_CAMERA #define ICON_MATERIALBROWSER ICON_MATERIAL #define ICON_PAINTTOOL ICON_FA_PAINTBRUSH + +#define ICON_EYE ICON_FA_EYE diff --git a/WickedEngine/wiGUI.cpp b/WickedEngine/wiGUI.cpp index db08a5ad32..ffeeeaa7a9 100644 --- a/WickedEngine/wiGUI.cpp +++ b/WickedEngine/wiGUI.cpp @@ -340,7 +340,10 @@ namespace wi::gui sprites[state].Update(dt); font.Update(dt); - angular_highlight_timer += dt; + if (shadow_highlight) + { + angular_highlight_timer += dt; + } } void Widget::Render(const wi::Canvas& canvas, wi::graphics::CommandList cmd) const { @@ -993,6 +996,10 @@ namespace wi::gui fx.highlight_color = shadow_highlight_color; fx.highlight_spread = shadow_highlight_spread; } + else + { + fx.disableHighlight(); + } wi::image::Draw(nullptr, fx, cmd); } @@ -1399,6 +1406,10 @@ namespace wi::gui fx.highlight_color = shadow_highlight_color; fx.highlight_spread = shadow_highlight_spread; } + else + { + fx.disableHighlight(); + } wi::image::Draw(nullptr, fx, cmd); } @@ -1701,6 +1712,10 @@ namespace wi::gui fx.highlight_color = shadow_highlight_color; fx.highlight_spread = shadow_highlight_spread; } + else + { + fx.disableHighlight(); + } wi::image::Draw(nullptr, fx, cmd); } @@ -2065,6 +2080,10 @@ namespace wi::gui fx.highlight_color = shadow_highlight_color; fx.highlight_spread = shadow_highlight_spread; } + else + { + fx.disableHighlight(); + } wi::image::Draw(nullptr, fx, cmd); } @@ -2243,6 +2262,10 @@ namespace wi::gui fx.highlight_color = shadow_highlight_color; fx.highlight_spread = shadow_highlight_spread; } + else + { + fx.disableHighlight(); + } wi::image::Draw(nullptr, fx, cmd); } @@ -2604,6 +2627,10 @@ namespace wi::gui fx.highlight_color = shadow_highlight_color; fx.highlight_spread = shadow_highlight_spread; } + else + { + fx.disableHighlight(); + } wi::image::Draw(nullptr, fx, cmd); } @@ -3608,6 +3635,10 @@ namespace wi::gui fx.highlight_color = shadow_highlight_color; fx.highlight_spread = shadow_highlight_spread; } + else + { + fx.disableHighlight(); + } wi::image::Draw(nullptr, fx, cmd); } @@ -5245,6 +5276,10 @@ namespace wi::gui fx.highlight_color = shadow_highlight_color; fx.highlight_spread = shadow_highlight_spread; } + else + { + fx.disableHighlight(); + } wi::image::Draw(nullptr, fx, cmd); }