Skip to content

Editor Layouts Management #431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Editor Layouts Management #431

wants to merge 13 commits into from

Conversation

maxbrundev
Copy link
Member

@maxbrundev maxbrundev commented Apr 1, 2025

Description

  • Added Editor Layouts management
  • Added functionality to load the most recently used layout when starting the engine

Screenshots

layoutstest

@maxbrundev maxbrundev added QoL Quality of Life : Something that can improve users productivity Feature Editor Something relative with the editor labels Apr 1, 2025
@maxbrundev maxbrundev self-assigned this Apr 1, 2025
@maxbrundev maxbrundev marked this pull request as draft April 1, 2025 17:39
@maxbrundev maxbrundev marked this pull request as ready for review April 1, 2025 17:41
Copy link
Member

@adriengivry adriengivry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

image

Looks like it's also displaying all the .ini files I have in %appdata%/OverloadTech/OvEditor.

The layouts should probably be stored in their own folder (Layouts/)

return;

auto& uiManager = *EDITOR_CONTEXT(uiManager);
EDITOR_EXEC(DelayAction(std::bind(&OvUI::Core::UIManager::SaveLayout, &uiManager, layoutsPath / (p_input + ".ini")), 1));
Copy link
Member

@adriengivry adriengivry Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this call, we should also update Settings::EditorSettings::LatestLayout, otherwise creating a new layout and exiting, result in the LatestLayout still being the previous one.

Suggested change
EDITOR_EXEC(DelayAction(std::bind(&OvUI::Core::UIManager::SaveLayout, &uiManager, layoutsPath / (p_input + ".ini")), 1));
EDITOR_EXEC(DelayAction(std::bind(&OvUI::Core::UIManager::SaveLayout, &uiManager, layoutsPath / (p_input + ".ini")), 1));
Settings::EditorSettings::LatestLayout = p_input;

if (entry.is_regular_file() && entry.path().extension() == ".ini")
{
auto& layoutMenuItem = loadMenuList.CreateWidget<MenuItem>(entry.path().stem().string());
layoutMenuItem.name = entry.path().stem().string();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could display which layout is currently selected with a checkmark

Suggested change
layoutMenuItem.name = entry.path().stem().string();
layoutMenuItem.name = entry.path().stem().string();
layoutMenuItem.checkable = true;
layoutMenuItem.checked = Settings::EditorSettings::LatestLayout.Get() == entry.path().stem().string();

image

Copy link
Member

@adriengivry adriengivry Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, since with this change we can show the currently selected layout, maybe we should always have a "Default" option in the "Load" list (instead of "Reset" outside of the list), and the "Default" option would have no contextual menu (so it cannot be deleted/renamed)

deleteMenuItem.ClickedEvent += [currentPath, &layoutMenuItem]
{
auto& uiManager = *EDITOR_CONTEXT(uiManager);
EDITOR_EXEC(DelayAction(std::bind(&OvUI::Core::UIManager::DeleteLayout, &uiManager, *currentPath), 1));
Copy link
Member

@adriengivry adriengivry Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a layout is deleted, and was currently selected, it should also be removed from LastLayout.
I've tried creating a layout, setting it as current, deleting it, and closing the editor, and in editor.ini I still have it as selected. Also, the actual layout file is never deleted, so although I deleted the layout, it still loads when I restart the editor.

Actually what happens is that the layout gets deleted, but since it's still set as LatestLayout, and used by ImGUI, closing the editor will recreate the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Editor Something relative with the editor QoL Quality of Life : Something that can improve users productivity
Development

Successfully merging this pull request may close these issues.

2 participants