1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-05 06:45:34 +00:00

do not render deleted exterior cells in scene view

This commit is contained in:
Marc Zinnschlag 2014-06-30 17:33:03 +02:00
parent af59106533
commit 5fb2e1a877
2 changed files with 13 additions and 4 deletions

View file

@ -15,13 +15,18 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
bool modified = false; bool modified = false;
bool setCamera = false; bool setCamera = false;
const CSMWorld::IdCollection<CSMWorld::Cell>& cells = mDocument.getData().getCells();
{ {
// remove // remove
std::map<CSMWorld::CellCoordinates, Cell *>::iterator iter (mCells.begin()); std::map<CSMWorld::CellCoordinates, Cell *>::iterator iter (mCells.begin());
while (iter!=mCells.end()) while (iter!=mCells.end())
{ {
if (!mSelection.has (iter->first)) int index = cells.searchId (iter->first.getId (mWorldspace));
if (!mSelection.has (iter->first) || index==-1 ||
cells.getRecord (index).mState==CSMWorld::RecordBase::State_Deleted)
{ {
delete iter->second; delete iter->second;
mCells.erase (iter++); mCells.erase (iter++);
@ -39,7 +44,10 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
for (CSMWorld::CellSelection::Iterator iter (mSelection.begin()); iter!=mSelection.end(); for (CSMWorld::CellSelection::Iterator iter (mSelection.begin()); iter!=mSelection.end();
++iter) ++iter)
{ {
if (mCells.find (*iter)==mCells.end()) int index = cells.searchId (iter->getId (mWorldspace));
if (index!=0 && cells.getRecord (index).mState!=CSMWorld::RecordBase::State_Deleted &&
mCells.find (*iter)==mCells.end())
{ {
if (setCamera) if (setCamera)
{ {
@ -49,7 +57,7 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
mCells.insert (std::make_pair (*iter, mCells.insert (std::make_pair (*iter,
new Cell (mDocument.getData(), getSceneManager(), new Cell (mDocument.getData(), getSceneManager(),
iter->getId ("std::default")))); iter->getId (mWorldspace))));
modified = true; modified = true;
} }
@ -124,7 +132,7 @@ void CSVRender::PagedWorldspaceWidget::referenceAdded (const QModelIndex& parent
CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc::Document& document) CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc::Document& document)
: WorldspaceWidget (document, parent), mDocument (document) : WorldspaceWidget (document, parent), mDocument (document), mWorldspace ("std::default")
{} {}
CSVRender::PagedWorldspaceWidget::~PagedWorldspaceWidget() CSVRender::PagedWorldspaceWidget::~PagedWorldspaceWidget()

View file

@ -17,6 +17,7 @@ namespace CSVRender
CSMDoc::Document& mDocument; CSMDoc::Document& mDocument;
CSMWorld::CellSelection mSelection; CSMWorld::CellSelection mSelection;
std::map<CSMWorld::CellCoordinates, Cell *> mCells; std::map<CSMWorld::CellCoordinates, Cell *> mCells;
std::string mWorldspace;
private: private: