|
|
|
@ -275,6 +275,107 @@ void CSVRender::PagedWorldspaceWidget::referenceAdded (const QModelIndex& parent
|
|
|
|
|
flagAsModified();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVRender::PagedWorldspaceWidget::pathgridDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& pathgrids = mDocument.getData().getPathgrids();
|
|
|
|
|
|
|
|
|
|
if (topLeft.parent().isValid())
|
|
|
|
|
{
|
|
|
|
|
int row = topLeft.parent().row();
|
|
|
|
|
|
|
|
|
|
const CSMWorld::Pathgrid& pathgrid = pathgrids.getRecord(row).get();
|
|
|
|
|
CSMWorld::CellCoordinates coords = CSMWorld::CellCoordinates(pathgrid.mData.mX, pathgrid.mData.mY);
|
|
|
|
|
|
|
|
|
|
std::map<CSMWorld::CellCoordinates, Cell*>::iterator searchResult = mCells.find(coords);
|
|
|
|
|
if (searchResult != mCells.end())
|
|
|
|
|
{
|
|
|
|
|
searchResult->second->pathgridDataChanged(topLeft, bottomRight);
|
|
|
|
|
flagAsModified();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVRender::PagedWorldspaceWidget::pathgridRemoved (const QModelIndex& parent, int start, int end)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& pathgrids = mDocument.getData().getPathgrids();
|
|
|
|
|
|
|
|
|
|
if (parent.isValid())
|
|
|
|
|
{
|
|
|
|
|
// Pathgrid data was modified
|
|
|
|
|
int row = parent.row();
|
|
|
|
|
|
|
|
|
|
const CSMWorld::Pathgrid& pathgrid = pathgrids.getRecord(row).get();
|
|
|
|
|
CSMWorld::CellCoordinates coords = CSMWorld::CellCoordinates(pathgrid.mData.mX, pathgrid.mData.mY);
|
|
|
|
|
|
|
|
|
|
std::map<CSMWorld::CellCoordinates, Cell*>::iterator searchResult = mCells.find(coords);
|
|
|
|
|
if (searchResult != mCells.end())
|
|
|
|
|
{
|
|
|
|
|
searchResult->second->pathgridRowRemoved(parent, start, end);
|
|
|
|
|
flagAsModified();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVRender::PagedWorldspaceWidget::pathgridAboutToBeRemoved (const QModelIndex& parent, int start, int end)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& pathgrids = mDocument.getData().getPathgrids();
|
|
|
|
|
|
|
|
|
|
if (!parent.isValid())
|
|
|
|
|
{
|
|
|
|
|
// Pathgrid going to be deleted
|
|
|
|
|
for (int row = start; row <= end; ++row)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::Pathgrid& pathgrid = pathgrids.getRecord(row).get();
|
|
|
|
|
CSMWorld::CellCoordinates coords = CSMWorld::CellCoordinates(pathgrid.mData.mX, pathgrid.mData.mY);
|
|
|
|
|
|
|
|
|
|
std::map<CSMWorld::CellCoordinates, Cell*>::iterator searchResult = mCells.find(coords);
|
|
|
|
|
if (searchResult != mCells.end())
|
|
|
|
|
{
|
|
|
|
|
searchResult->second->pathgridRemoved();
|
|
|
|
|
flagAsModified();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVRender::PagedWorldspaceWidget::pathgridAdded(const QModelIndex& parent, int start, int end)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& pathgrids = mDocument.getData().getPathgrids();
|
|
|
|
|
|
|
|
|
|
if (!parent.isValid())
|
|
|
|
|
{
|
|
|
|
|
// Pathgrid added theoretically, unable to test until it is possible to add pathgrids
|
|
|
|
|
for (int row = start; row <= end; ++row)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::Pathgrid& pathgrid = pathgrids.getRecord(row).get();
|
|
|
|
|
CSMWorld::CellCoordinates coords = CSMWorld::CellCoordinates(pathgrid.mData.mX, pathgrid.mData.mY);
|
|
|
|
|
|
|
|
|
|
std::map<CSMWorld::CellCoordinates, Cell*>::iterator searchResult = mCells.find(coords);
|
|
|
|
|
if (searchResult != mCells.end())
|
|
|
|
|
{
|
|
|
|
|
searchResult->second->pathgridAdded(pathgrid);
|
|
|
|
|
flagAsModified();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Pathgrid data was modified
|
|
|
|
|
int row = parent.row();
|
|
|
|
|
|
|
|
|
|
const CSMWorld::Pathgrid& pathgrid = pathgrids.getRecord(row).get();
|
|
|
|
|
CSMWorld::CellCoordinates coords = CSMWorld::CellCoordinates(pathgrid.mData.mX, pathgrid.mData.mY);
|
|
|
|
|
|
|
|
|
|
std::map<CSMWorld::CellCoordinates, Cell*>::iterator searchResult = mCells.find(coords);
|
|
|
|
|
if (searchResult != mCells.end())
|
|
|
|
|
{
|
|
|
|
|
searchResult->second->pathgridRowAdded(parent, start, end);
|
|
|
|
|
flagAsModified();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string CSVRender::PagedWorldspaceWidget::getStartupInstruction()
|
|
|
|
|
{
|
|
|
|
|
osg::Vec3d eye, center, up;
|
|
|
|
|