mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-29 21:45:32 +00:00
Added shortcuts for loading a cell relative to the camera,
Removed Ctl+V binding for "Verify" because that is associated with paste.
This commit is contained in:
parent
65201badf6
commit
96a3c278fd
3 changed files with 79 additions and 1 deletions
|
@ -222,7 +222,7 @@ void CSMPrefs::State::declare()
|
|||
declareShortcut ("document-file-newaddon", "Create new addon", QKeySequence());
|
||||
declareShortcut ("document-file-open", "Open", QKeySequence());
|
||||
declareShortcut ("document-file-save", "Save", QKeySequence(Qt::ControlModifier | Qt::Key_S));
|
||||
declareShortcut ("document-file-verify", "Verify", QKeySequence(Qt::ControlModifier | Qt::Key_V));
|
||||
declareShortcut ("document-file-verify", "Verify", QKeySequence());
|
||||
declareShortcut ("document-file-merge", "Merge", QKeySequence());
|
||||
declareShortcut ("document-file-errorlog", "Load error log", QKeySequence());
|
||||
declareShortcut ("document-file-metadata", "Meta Data", QKeySequence());
|
||||
|
@ -320,6 +320,11 @@ void CSMPrefs::State::declare()
|
|||
declareShortcut ("scene-select-primary", "Primary select", QKeySequence(Qt::MiddleButton));
|
||||
declareShortcut ("scene-select-secondary", "Secondary select",
|
||||
QKeySequence(Qt::ControlModifier | (int)Qt::MiddleButton));
|
||||
declareShortcut ("scene-load-cam-cell", "Load camera cell", QKeySequence(Qt::KeypadModifier | Qt::Key_5));
|
||||
declareShortcut ("scene-load-cam-eastcell", "Load east cell", QKeySequence(Qt::KeypadModifier | Qt::Key_6));
|
||||
declareShortcut ("scene-load-cam-northcell", "Load north cell", QKeySequence(Qt::KeypadModifier | Qt::Key_8));
|
||||
declareShortcut ("scene-load-cam-westcell", "Load west cell", QKeySequence(Qt::KeypadModifier | Qt::Key_4));
|
||||
declareShortcut ("scene-load-cam-southcell", "Load south cell", QKeySequence(Qt::KeypadModifier | Qt::Key_2));
|
||||
declareShortcut ("scene-edit-abort", "Abort", QKeySequence(Qt::Key_Escape));
|
||||
declareShortcut ("scene-focus-toolbar", "Toggle toolbar focus", QKeySequence(Qt::Key_T));
|
||||
declareShortcut ("scene-render-stats", "Debug rendering stats", QKeySequence(Qt::Key_F3));
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
#include <components/esm/loadland.hpp>
|
||||
|
||||
#include "../../model/prefs/shortcut.hpp"
|
||||
|
||||
#include "../../model/world/tablemimedata.hpp"
|
||||
#include "../../model/world/idtable.hpp"
|
||||
|
||||
|
@ -433,6 +435,24 @@ void CSVRender::PagedWorldspaceWidget::moveCellSelection (int x, int y)
|
|||
mSelection = newSelection;
|
||||
}
|
||||
|
||||
void CSVRender::PagedWorldspaceWidget::addCellToSceneFromCamera (int offsetX, int offsetY)
|
||||
{
|
||||
const int CellSize = 8192;
|
||||
|
||||
osg::Vec3f eye, center, up;
|
||||
getCamera()->getViewMatrixAsLookAt(eye, center, up);
|
||||
|
||||
int cellX = (int)std::floor(center.x() / CellSize) + offsetX;
|
||||
int cellY = (int)std::floor(center.y() / CellSize) + offsetY;
|
||||
|
||||
CSMWorld::CellCoordinates cellCoordinates(cellX, cellY);
|
||||
|
||||
if (mCells.find(cellCoordinates) == mCells.end())
|
||||
{
|
||||
addCellToScene(cellCoordinates);
|
||||
}
|
||||
}
|
||||
|
||||
CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc::Document& document)
|
||||
: WorldspaceWidget (document, parent), mDocument (document), mWorldspace ("std::default"),
|
||||
mControlElements(NULL), mDisplayCellCoord(true)
|
||||
|
@ -446,6 +466,22 @@ CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc
|
|||
this, SLOT (cellRemoved (const QModelIndex&, int, int)));
|
||||
connect (cells, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
|
||||
this, SLOT (cellAdded (const QModelIndex&, int, int)));
|
||||
|
||||
// Shortcuts
|
||||
CSMPrefs::Shortcut* loadCameraCellShortcut = new CSMPrefs::Shortcut("scene-load-cam-cell", this);
|
||||
connect(loadCameraCellShortcut, SIGNAL(activated()), this, SLOT(loadCameraCell()));
|
||||
|
||||
CSMPrefs::Shortcut* loadCameraEastCellShortcut = new CSMPrefs::Shortcut("scene-load-cam-eastcell", this);
|
||||
connect(loadCameraEastCellShortcut, SIGNAL(activated()), this, SLOT(loadEastCell()));
|
||||
|
||||
CSMPrefs::Shortcut* loadCameraNorthCellShortcut = new CSMPrefs::Shortcut("scene-load-cam-northcell", this);
|
||||
connect(loadCameraNorthCellShortcut, SIGNAL(activated()), this, SLOT(loadNorthCell()));
|
||||
|
||||
CSMPrefs::Shortcut* loadCameraWestCellShortcut = new CSMPrefs::Shortcut("scene-load-cam-westcell", this);
|
||||
connect(loadCameraWestCellShortcut, SIGNAL(activated()), this, SLOT(loadWestCell()));
|
||||
|
||||
CSMPrefs::Shortcut* loadCameraSouthCellShortcut = new CSMPrefs::Shortcut("scene-load-cam-southcell", this);
|
||||
connect(loadCameraSouthCellShortcut, SIGNAL(activated()), this, SLOT(loadSouthCell()));
|
||||
}
|
||||
|
||||
CSVRender::PagedWorldspaceWidget::~PagedWorldspaceWidget()
|
||||
|
@ -718,3 +754,28 @@ void CSVRender::PagedWorldspaceWidget::cellAdded (const QModelIndex& index, int
|
|||
if (adjustCells())
|
||||
flagAsModified();
|
||||
}
|
||||
|
||||
void CSVRender::PagedWorldspaceWidget::loadCameraCell()
|
||||
{
|
||||
addCellToSceneFromCamera(0, 0);
|
||||
}
|
||||
|
||||
void CSVRender::PagedWorldspaceWidget::loadEastCell()
|
||||
{
|
||||
addCellToSceneFromCamera(1, 0);
|
||||
}
|
||||
|
||||
void CSVRender::PagedWorldspaceWidget::loadNorthCell()
|
||||
{
|
||||
addCellToSceneFromCamera(0, 1);
|
||||
}
|
||||
|
||||
void CSVRender::PagedWorldspaceWidget::loadWestCell()
|
||||
{
|
||||
addCellToSceneFromCamera(-1, 0);
|
||||
}
|
||||
|
||||
void CSVRender::PagedWorldspaceWidget::loadSouthCell()
|
||||
{
|
||||
addCellToSceneFromCamera(0, -1);
|
||||
}
|
||||
|
|
|
@ -74,6 +74,8 @@ namespace CSVRender
|
|||
/// \note Does not update the view or any cell marker
|
||||
void moveCellSelection (int x, int y);
|
||||
|
||||
void addCellToSceneFromCamera (int offsetX, int offsetY);
|
||||
|
||||
public:
|
||||
|
||||
PagedWorldspaceWidget (QWidget *parent, CSMDoc::Document& document);
|
||||
|
@ -152,6 +154,16 @@ namespace CSVRender
|
|||
|
||||
virtual void cellAdded (const QModelIndex& index, int start, int end);
|
||||
|
||||
void loadCameraCell();
|
||||
|
||||
void loadEastCell();
|
||||
|
||||
void loadNorthCell();
|
||||
|
||||
void loadWestCell();
|
||||
|
||||
void loadSouthCell();
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue