Add quick action "Load Current Map"

This commit is contained in:
ChillerDragon 2024-09-01 08:15:58 +08:00
parent 36f0bcc509
commit e20250cd65
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(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_PopupEventType = POPEVENT_LOADCURRENT;
pEditor->m_PopupEventActivated = true;
}
else
{
pEditor->LoadCurrentMap();
}
pEditor->m_QuickActionLoadCurrentMap.Call();
return CUi::POPUP_CLOSE_CURRENT;
}

View file

@ -29,6 +29,24 @@ REGISTER_QUICK_ACTION(
ALWAYS_FALSE,
DEFAULT_BTN,
"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(
Envelopes,
"Envelopes",