mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 22:18:19 +00:00
Merge pull request #8982 from ChillerDragon/pr_qa_aq
Add quick action "Add quads layer"
This commit is contained in:
commit
66e8d1f726
|
@ -330,6 +330,7 @@ public:
|
||||||
void AddGroup();
|
void AddGroup();
|
||||||
void AddTileLayer();
|
void AddTileLayer();
|
||||||
void AddFrontLayer();
|
void AddFrontLayer();
|
||||||
|
void AddQuadsLayer();
|
||||||
void LayerSelectImage();
|
void LayerSelectImage();
|
||||||
bool IsNonGameTileLayerSelected() const;
|
bool IsNonGameTileLayerSelected() const;
|
||||||
void MapDetails();
|
void MapDetails();
|
||||||
|
|
|
@ -565,15 +565,9 @@ CUi::EPopupMenuFunctionResult CEditor::PopupGroup(void *pContext, CUIRect View,
|
||||||
// new quad layer
|
// new quad layer
|
||||||
View.HSplitBottom(5.0f, &View, nullptr);
|
View.HSplitBottom(5.0f, &View, nullptr);
|
||||||
View.HSplitBottom(12.0f, &View, &Button);
|
View.HSplitBottom(12.0f, &View, &Button);
|
||||||
static int s_NewQuadLayerButton = 0;
|
if(pEditor->DoButton_Editor(&pEditor->m_QuickActionAddQuadsLayer, pEditor->m_QuickActionAddQuadsLayer.Label(), 0, &Button, 0, pEditor->m_QuickActionAddQuadsLayer.Description()))
|
||||||
if(pEditor->DoButton_Editor(&s_NewQuadLayerButton, "Add quads layer", 0, &Button, 0, "Creates a new quad layer"))
|
|
||||||
{
|
{
|
||||||
std::shared_ptr<CLayer> pQuadLayer = std::make_shared<CLayerQuads>(pEditor);
|
pEditor->m_QuickActionAddQuadsLayer.Call();
|
||||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->AddLayer(pQuadLayer);
|
|
||||||
int LayerIndex = pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_vpLayers.size() - 1;
|
|
||||||
pEditor->SelectLayer(LayerIndex);
|
|
||||||
pEditor->m_Map.m_vpGroups[pEditor->m_SelectedGroup]->m_Collapse = false;
|
|
||||||
pEditor->m_EditorHistory.RecordAction(std::make_shared<CEditorActionAddLayer>(pEditor, pEditor->m_SelectedGroup, LayerIndex));
|
|
||||||
return CUi::POPUP_CLOSE_CURRENT;
|
return CUi::POPUP_CLOSE_CURRENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,16 @@ void CEditor::AddFrontLayer()
|
||||||
m_EditorHistory.RecordAction(std::make_shared<CEditorActionAddLayer>(this, m_SelectedGroup, LayerIndex));
|
m_EditorHistory.RecordAction(std::make_shared<CEditorActionAddLayer>(this, m_SelectedGroup, LayerIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CEditor::AddQuadsLayer()
|
||||||
|
{
|
||||||
|
std::shared_ptr<CLayer> pQuadLayer = std::make_shared<CLayerQuads>(this);
|
||||||
|
m_Map.m_vpGroups[m_SelectedGroup]->AddLayer(pQuadLayer);
|
||||||
|
int LayerIndex = m_Map.m_vpGroups[m_SelectedGroup]->m_vpLayers.size() - 1;
|
||||||
|
SelectLayer(LayerIndex);
|
||||||
|
m_Map.m_vpGroups[m_SelectedGroup]->m_Collapse = false;
|
||||||
|
m_EditorHistory.RecordAction(std::make_shared<CEditorActionAddLayer>(this, m_SelectedGroup, LayerIndex));
|
||||||
|
}
|
||||||
|
|
||||||
bool CEditor::IsNonGameTileLayerSelected() const
|
bool CEditor::IsNonGameTileLayerSelected() const
|
||||||
{
|
{
|
||||||
std::shared_ptr<CLayer> pLayer = GetSelectedLayer(0);
|
std::shared_ptr<CLayer> pLayer = GetSelectedLayer(0);
|
||||||
|
|
|
@ -177,6 +177,8 @@ REGISTER_QUICK_ACTION(
|
||||||
ALWAYS_FALSE,
|
ALWAYS_FALSE,
|
||||||
DEFAULT_BTN,
|
DEFAULT_BTN,
|
||||||
"Creates a new item layer.")
|
"Creates a new item layer.")
|
||||||
|
REGISTER_QUICK_ACTION(
|
||||||
|
AddQuadsLayer, "Add quads layer", [&]() { AddQuadsLayer(); }, ALWAYS_FALSE, ALWAYS_FALSE, DEFAULT_BTN, "Creates a new quads layer.")
|
||||||
REGISTER_QUICK_ACTION(
|
REGISTER_QUICK_ACTION(
|
||||||
SaveAs,
|
SaveAs,
|
||||||
"Save As",
|
"Save As",
|
||||||
|
|
Loading…
Reference in a new issue