mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-08 09:37:53 +00:00
Merge pull request #2256 from unelsson/instance_viewcell
Editor: Implement exterior cell view from Instances table
This commit is contained in:
commit
433893e733
@ -2,6 +2,7 @@
|
||||
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QApplication>
|
||||
@ -615,7 +616,39 @@ void CSVRender::PagedWorldspaceWidget::useViewHint (const std::string& hint)
|
||||
}
|
||||
else if (hint[0]=='r')
|
||||
{
|
||||
/// \todo implement 'r' type hints
|
||||
// syntax r:ref#number (e.g. r:ref#100)
|
||||
char ignore;
|
||||
|
||||
std::istringstream stream (hint.c_str());
|
||||
if (stream >> ignore) // ignore r
|
||||
{
|
||||
char ignore1; // : or ;
|
||||
|
||||
std::string refCode; // ref#number (e.g. ref#100)
|
||||
|
||||
while (stream >> ignore1 >> refCode) {}
|
||||
|
||||
//Find out cell coordinate
|
||||
CSMWorld::IdTable& references = dynamic_cast<CSMWorld::IdTable&> (
|
||||
*mDocument.getData().getTableModel (CSMWorld::UniversalId::Type_References));
|
||||
int cellColumn = references.findColumnIndex(CSMWorld::Columns::ColumnId_Cell);
|
||||
QVariant cell = references.data(references.getModelIndex(refCode, cellColumn)).value<QVariant>();
|
||||
QString cellqs = cell.toString();
|
||||
std::istringstream streamCellCoord (cellqs.toStdString().c_str());
|
||||
|
||||
if (streamCellCoord >> ignore) //ignore #
|
||||
{
|
||||
// Current coordinate
|
||||
int x, y;
|
||||
|
||||
// Loop through all the coordinates to add them to selection
|
||||
while (streamCellCoord >> x >> y)
|
||||
selection.add (CSMWorld::CellCoordinates (x, y));
|
||||
|
||||
// Mark that camera needs setup
|
||||
mCamPositionSet=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setCellSelection (selection);
|
||||
|
Loading…
Reference in New Issue
Block a user