Skip to content

Commit

Permalink
add option to disable editor UI animations (#1011)
Browse files Browse the repository at this point in the history
* add option to disable editor UI animations

* focus mode updates

---------

Co-authored-by: Turánszki János <[email protected]>
  • Loading branch information
brakhane and turanszkij authored Jan 15, 2025
1 parent 7a3e488 commit 3ffe1d7
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 4 deletions.
1 change: 0 additions & 1 deletion Editor/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ void EditorComponent::Load()
newEntityCombo.SetDropArrowEnabled(false);
newEntityCombo.SetFixedDropWidth(200);
newEntityCombo.SetMaxVisibleItemCount(16);
newEntityCombo.SetAngularHighlightWidth(3);
newEntityCombo.AddItem("Transform " ICON_TRANSFORM, NEW_TRANSFORM);
newEntityCombo.AddItem("Material " ICON_MATERIAL, NEW_MATERIAL);
newEntityCombo.AddItem("Point Light " ICON_POINTLIGHT, NEW_POINTLIGHT);
Expand Down
30 changes: 28 additions & 2 deletions Editor/GeneralWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,20 @@ void GeneralWindow::Create(EditorComponent* _editor)
forceDiffuseLightingCheckBox.SetCheck(wi::renderer::IsForceDiffuseLighting());
AddWidget(&forceDiffuseLightingCheckBox);


focusModeCheckBox.Create(ICON_EYE " Focus mode GUI: ");
focusModeCheckBox.SetCheckText(ICON_EYE);
focusModeCheckBox.SetTooltip("Reduce the amount of effects in the editor GUI to improve accessibility");
if (editor->main->config.GetSection("options").Has("focus_mode"))
{
focusModeCheckBox.SetCheck(editor->main->config.GetSection("options").GetBool("focus_mode"));
}
focusModeCheckBox.OnClick([&](wi::gui::EventArgs args) {
editor->main->config.GetSection("options").Set("focus_mode", args.bValue);
// trigger themeCombo's OnSelect handler, which will enable/disable shadow highlighting
// according to this checkbox's state
themeCombo.SetSelected(themeCombo.GetSelected());
});
AddWidget(&focusModeCheckBox);

versionCheckBox.Create("Version: ");
versionCheckBox.SetTooltip("Toggle the engine version display text in top left corner.");
Expand Down Expand Up @@ -385,7 +398,7 @@ void GeneralWindow::Create(EditorComponent* _editor)
break;
}

theme.shadow_highlight = true;
theme.shadow_highlight = !focusModeCheckBox.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 @@ -777,6 +790,16 @@ void GeneralWindow::Create(EditorComponent* _editor)
sprite.params.corners_rounding[3].radius = 10;
}

if (focusModeCheckBox.GetCheck())
{
editor->newEntityCombo.SetAngularHighlightWidth(0);
editor->newEntityCombo.SetShadowRadius(2);
}
else
{
editor->newEntityCombo.SetAngularHighlightWidth(3);
editor->newEntityCombo.SetShadowRadius(0);
}
});
AddWidget(&themeCombo);

Expand Down Expand Up @@ -993,6 +1016,9 @@ void GeneralWindow::ResizeLayout()
add_right(freezeCullingCameraCheckBox);
add_right(disableAlbedoMapsCheckBox);
add_right(forceDiffuseLightingCheckBox);
y += jump;

add_right(focusModeCheckBox);

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 @@ -31,6 +31,7 @@ class GeneralWindow : public wi::gui::Window
wi::gui::CheckBox freezeCullingCameraCheckBox;
wi::gui::CheckBox disableAlbedoMapsCheckBox;
wi::gui::CheckBox forceDiffuseLightingCheckBox;
wi::gui::CheckBox focusModeCheckBox;

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
33 changes: 32 additions & 1 deletion WickedEngine/wiGUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ namespace wi::gui

sprites[state].Update(dt);
font.Update(dt);

angular_highlight_timer += dt;
}
void Widget::Render(const wi::Canvas& canvas, wi::graphics::CommandList cmd) const
Expand Down Expand Up @@ -993,6 +992,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 +1402,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 +1708,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 +2076,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 +2258,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 +2623,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 +3631,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 +5272,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 3ffe1d7

Please sign in to comment.