Skip to content

Commit

Permalink
add option to disable editor UI animations
Browse files Browse the repository at this point in the history
  • Loading branch information
brakhane committed Jan 12, 2025
1 parent 9b7e102 commit a9e9921
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 3 deletions.
18 changes: 16 additions & 2 deletions Editor/GeneralWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -980,6 +991,9 @@ void GeneralWindow::ResizeLayout()
add_right(freezeCullingCameraCheckBox);
add_right(disableAlbedoMapsCheckBox);
add_right(forceDiffuseLightingCheckBox);
y += jump;

add_right(reduceGuiFx);

y += jump;

Expand Down
1 change: 1 addition & 0 deletions Editor/GeneralWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Editor/IconDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
37 changes: 36 additions & 1 deletion WickedEngine/wiGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit a9e9921

Please sign in to comment.