Merge pull request #8857 from ChillerDragon/pr_action_load_current_map

Add quick action "Load Current Map"
This commit is contained in:
Dennis Felsing 2024-09-01 07:05:55 +00:00 committed by GitHub
commit b5c11bc860
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 10 deletions

View file

@ -68,17 +68,9 @@ CUi::EPopupMenuFunctionResult CEditor::PopupMenuFile(void *pContext, CUIRect Vie
View.HSplitTop(2.0f, nullptr, &View); View.HSplitTop(2.0f, nullptr, &View);
View.HSplitTop(12.0f, &Slot, &View); View.HSplitTop(12.0f, &Slot, &View);
if(pEditor->DoButton_MenuItem(&s_OpenCurrentMapButton, "Load Current Map", 0, &Slot, 0, "Opens the current in game map for editing (ctrl+alt+l)")) if(pEditor->DoButton_MenuItem(&s_OpenCurrentMapButton, pEditor->m_QuickActionLoadCurrentMap.Label(), 0, &Slot, 0, pEditor->m_QuickActionLoadCurrentMap.Description()))
{ {
if(pEditor->HasUnsavedData()) pEditor->m_QuickActionLoadCurrentMap.Call();
{
pEditor->m_PopupEventType = POPEVENT_LOADCURRENT;
pEditor->m_PopupEventActivated = true;
}
else
{
pEditor->LoadCurrentMap();
}
return CUi::POPUP_CLOSE_CURRENT; return CUi::POPUP_CLOSE_CURRENT;
} }

View file

@ -29,6 +29,24 @@ REGISTER_QUICK_ACTION(
ALWAYS_FALSE, ALWAYS_FALSE,
DEFAULT_BTN, DEFAULT_BTN,
"Saves the current map under a new name (ctrl+shift+s)") "Saves the current map under a new name (ctrl+shift+s)")
REGISTER_QUICK_ACTION(
LoadCurrentMap,
"Load Current Map",
[&]() {
if(HasUnsavedData())
{
m_PopupEventType = POPEVENT_LOADCURRENT;
m_PopupEventActivated = true;
}
else
{
LoadCurrentMap();
}
},
ALWAYS_FALSE,
ALWAYS_FALSE,
DEFAULT_BTN,
"Opens the current in game map for editing (ctrl+alt+l)")
REGISTER_QUICK_ACTION( REGISTER_QUICK_ACTION(
Envelopes, Envelopes,
"Envelopes", "Envelopes",