Conversation
Co-authored-by: Adrien Givry <contact@adrien-givry.com>
Co-authored-by: Adrien Givry <contact@adrien-givry.com>
| 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.
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.
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.
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.
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