Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Implement exterior cell view from Instances table #2256

Merged
merged 1 commit into from
Mar 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion apps/opencs/view/render/pagedworldspacewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <memory>
#include <sstream>
#include <string>

#include <QMouseEvent>
#include <QApplication>
Expand Down Expand Up @@ -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);
Expand Down