|
|
|
@ -254,7 +254,6 @@ namespace CSVRender
|
|
|
|
|
int posY = clampToCell(static_cast<int>(localCoords.y()));
|
|
|
|
|
int posZ = clampToCell(static_cast<int>(localCoords.z()));
|
|
|
|
|
|
|
|
|
|
int recordIndex = mPathgridCollection.getIndex (mId);
|
|
|
|
|
int parentColumn = mPathgridCollection.findColumnIndex(CSMWorld::Columns::ColumnId_PathgridPoints);
|
|
|
|
|
|
|
|
|
|
int posXColumn = mPathgridCollection.searchNestedColumnIndex(parentColumn,
|
|
|
|
@ -266,14 +265,13 @@ namespace CSVRender
|
|
|
|
|
int posZColumn = mPathgridCollection.searchNestedColumnIndex(parentColumn,
|
|
|
|
|
CSMWorld::Columns::ColumnId_PathgridPosZ);
|
|
|
|
|
|
|
|
|
|
QModelIndex parent = model->index(recordIndex, parentColumn);
|
|
|
|
|
int row = static_cast<int>(source->mPoints.size());
|
|
|
|
|
|
|
|
|
|
// Add node
|
|
|
|
|
commands.push(new CSMWorld::AddNestedCommand(*model, mId, row, parentColumn));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, model->index(row, posXColumn, parent), posX));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, model->index(row, posYColumn, parent), posY));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, model->index(row, posZColumn, parent), posZ));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, mId, row, posXColumn, parentColumn, posX));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, mId, row, posYColumn, parentColumn, posY));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, mId, row, posZColumn, parentColumn, posZ));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -296,7 +294,6 @@ namespace CSVRender
|
|
|
|
|
CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel(
|
|
|
|
|
CSMWorld::UniversalId::Type_Pathgrids));
|
|
|
|
|
|
|
|
|
|
int recordIndex = mPathgridCollection.getIndex(mId);
|
|
|
|
|
int parentColumn = mPathgridCollection.findColumnIndex(CSMWorld::Columns::ColumnId_PathgridPoints);
|
|
|
|
|
|
|
|
|
|
int posXColumn = mPathgridCollection.searchNestedColumnIndex(parentColumn,
|
|
|
|
@ -308,20 +305,18 @@ namespace CSVRender
|
|
|
|
|
int posZColumn = mPathgridCollection.searchNestedColumnIndex(parentColumn,
|
|
|
|
|
CSMWorld::Columns::ColumnId_PathgridPosZ);
|
|
|
|
|
|
|
|
|
|
QModelIndex parent = model->index(recordIndex, parentColumn);
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < mSelected.size(); ++i)
|
|
|
|
|
{
|
|
|
|
|
const CSMWorld::Pathgrid::Point& point = source->mPoints[mSelected[i]];
|
|
|
|
|
int row = static_cast<int>(mSelected[i]);
|
|
|
|
|
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, model->index(row, posXColumn, parent),
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, mId, row, posXColumn, parentColumn,
|
|
|
|
|
clampToCell(point.mX + offsetX)));
|
|
|
|
|
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, model->index(row, posYColumn, parent),
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, mId, row, posYColumn, parentColumn,
|
|
|
|
|
clampToCell(point.mY + offsetY)));
|
|
|
|
|
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, model->index(row, posZColumn, parent),
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, mId, row, posZColumn, parentColumn,
|
|
|
|
|
clampToCell(point.mZ + offsetZ)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -565,7 +560,6 @@ namespace CSVRender
|
|
|
|
|
CSMWorld::IdTree* model = dynamic_cast<CSMWorld::IdTree*>(mData.getTableModel(
|
|
|
|
|
CSMWorld::UniversalId::Type_Pathgrids));
|
|
|
|
|
|
|
|
|
|
int recordIndex = mPathgridCollection.getIndex(mId);
|
|
|
|
|
int parentColumn = mPathgridCollection.findColumnIndex(CSMWorld::Columns::ColumnId_PathgridEdges);
|
|
|
|
|
|
|
|
|
|
int edge0Column = mPathgridCollection.searchNestedColumnIndex(parentColumn,
|
|
|
|
@ -574,21 +568,19 @@ namespace CSVRender
|
|
|
|
|
int edge1Column = mPathgridCollection.searchNestedColumnIndex(parentColumn,
|
|
|
|
|
CSMWorld::Columns::ColumnId_PathgridEdge1);
|
|
|
|
|
|
|
|
|
|
QModelIndex parent = model->index(recordIndex, parentColumn);
|
|
|
|
|
|
|
|
|
|
if (edgeExists(source, node1, node2) == -1)
|
|
|
|
|
{
|
|
|
|
|
// Set first edge last since that reorders the edge list
|
|
|
|
|
commands.push(new CSMWorld::AddNestedCommand(*model, mId, 0, parentColumn));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, model->index(0, edge1Column, parent), node2));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, model->index(0, edge0Column, parent), node1));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, mId, 0, edge1Column, parentColumn, node2));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, mId, 0, edge0Column, parentColumn, node1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (edgeExists(source, node2, node1) == -1)
|
|
|
|
|
{
|
|
|
|
|
commands.push(new CSMWorld::AddNestedCommand(*model, mId, 0, parentColumn));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, model->index(0, edge1Column, parent), node1));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, model->index(0, edge0Column, parent), node2));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, mId, 0, edge1Column, parentColumn, node1));
|
|
|
|
|
commands.push(new CSMWorld::ModifyNestedCommand(*model, mId, 0, edge0Column, parentColumn, node2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|