mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 19:06:41 +00:00
Add context menu for pathgrid editor.
This commit is contained in:
parent
8b6cb73369
commit
f0bbe2c633
2 changed files with 76 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
||||||
#include "pathgridmode.hpp"
|
#include "pathgridmode.hpp"
|
||||||
|
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
#include <components/sceneutil/pathgridutil.hpp>
|
#include <components/sceneutil/pathgridutil.hpp>
|
||||||
|
|
||||||
#include "../../model/world/commands.hpp"
|
#include "../../model/world/commands.hpp"
|
||||||
|
@ -31,8 +33,39 @@ namespace CSVRender
|
||||||
"<li>Other operations may be done with the context menu</li>"
|
"<li>Other operations may be done with the context menu</li>"
|
||||||
"</ul><p>Note: Only a single cell's pathgrid may be edited at a time");
|
"</ul><p>Note: Only a single cell's pathgrid may be edited at a time");
|
||||||
}
|
}
|
||||||
void PathgridMode::primaryEditPressed(const WorldspaceHitResult& hit)
|
|
||||||
|
void PathgridMode::activate(CSVWidget::SceneToolbar* toolbar)
|
||||||
{
|
{
|
||||||
|
mSelectAll = new QAction("Select all other nodes in cell", this);
|
||||||
|
mInvertSelection = new QAction("Invert selection", this);
|
||||||
|
mClearSelection = new QAction("Clear selection", this);
|
||||||
|
mRemoveSelected = new QAction("Remove selected nodes", this);
|
||||||
|
mRemoveSelectedEdges = new QAction("Remove edges between selected nodes", this);
|
||||||
|
|
||||||
|
connect(mSelectAll, SIGNAL(triggered()), this, SLOT(selectAll()));
|
||||||
|
connect(mInvertSelection, SIGNAL(triggered()), this, SLOT(invertSelection()));
|
||||||
|
connect(mClearSelection, SIGNAL(triggered()), this, SLOT(clearSelection()));
|
||||||
|
connect(mRemoveSelected, SIGNAL(triggered()), this, SLOT(removeSelected()));
|
||||||
|
connect(mRemoveSelectedEdges, SIGNAL(triggered()), this, SLOT(removeSelectedEdges()));
|
||||||
|
|
||||||
|
EditMode::activate(toolbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PathgridMode::createContextMenu(QMenu* menu)
|
||||||
|
{
|
||||||
|
if (menu)
|
||||||
|
{
|
||||||
|
menu->addAction(mSelectAll);
|
||||||
|
menu->addAction(mInvertSelection);
|
||||||
|
menu->addAction(mClearSelection);
|
||||||
|
menu->addAction(mRemoveSelected);
|
||||||
|
menu->addAction(mRemoveSelectedEdges);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathgridMode::primaryEditPressed(const WorldspaceHitResult& hitResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathgridMode::secondaryEditPressed(const WorldspaceHitResult& hit)
|
void PathgridMode::secondaryEditPressed(const WorldspaceHitResult& hit)
|
||||||
|
@ -160,4 +193,28 @@ namespace CSVRender
|
||||||
{
|
{
|
||||||
getWorldspaceWidget().reset(Mask_Pathgrid);
|
getWorldspaceWidget().reset(Mask_Pathgrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PathgridMode::selectAll()
|
||||||
|
{
|
||||||
|
// Select rest of nodes in selected cell
|
||||||
|
getWorldspaceWidget().selectAll(Mask_Pathgrid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathgridMode::invertSelection()
|
||||||
|
{
|
||||||
|
getWorldspaceWidget().invertSelection(Mask_Pathgrid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathgridMode::clearSelection()
|
||||||
|
{
|
||||||
|
getWorldspaceWidget().clearSelection(Mask_Pathgrid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathgridMode::removeSelected()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathgridMode::removeSelectedEdges()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@ namespace CSVRender
|
||||||
|
|
||||||
PathgridMode(WorldspaceWidget* worldspace, QWidget* parent=0);
|
PathgridMode(WorldspaceWidget* worldspace, QWidget* parent=0);
|
||||||
|
|
||||||
|
virtual void activate(CSVWidget::SceneToolbar* toolbar);
|
||||||
|
|
||||||
|
virtual bool createContextMenu(QMenu* menu);
|
||||||
|
|
||||||
virtual void primaryEditPressed(const WorldspaceHitResult& hit);
|
virtual void primaryEditPressed(const WorldspaceHitResult& hit);
|
||||||
|
|
||||||
virtual void secondaryEditPressed(const WorldspaceHitResult& hit);
|
virtual void secondaryEditPressed(const WorldspaceHitResult& hit);
|
||||||
|
@ -47,8 +51,22 @@ namespace CSVRender
|
||||||
std::string mLastId;
|
std::string mLastId;
|
||||||
DragMode mDragMode;
|
DragMode mDragMode;
|
||||||
unsigned short mFromNode;
|
unsigned short mFromNode;
|
||||||
|
|
||||||
|
QAction* mSelectAll;
|
||||||
|
QAction* mInvertSelection;
|
||||||
|
QAction* mClearSelection;
|
||||||
|
QAction* mRemoveSelected;
|
||||||
|
QAction* mRemoveSelectedEdges;
|
||||||
|
|
||||||
QString getTooltip();
|
QString getTooltip();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void selectAll();
|
||||||
|
void invertSelection();
|
||||||
|
void clearSelection();
|
||||||
|
void removeSelected();
|
||||||
|
void removeSelectedEdges();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue