-
Notifications
You must be signed in to change notification settings - Fork 272
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Adrien Givry <[email protected]>
Co-authored-by: Adrien Givry <[email protected]>
return; | ||
|
||
auto& uiManager = *EDITOR_CONTEXT(uiManager); | ||
EDITOR_EXEC(DelayAction(std::bind(&OvUI::Core::UIManager::SaveLayout, &uiManager, layoutsPath / (p_input + ".ini")), 1)); |
There was a problem hiding this comment.
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.
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(); |
There was a problem hiding this comment.
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
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(); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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.
Description
Screenshots