mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-24 14:23:51 +00:00
Changes made to DialogueSubview pathgrid tables are now reflected on PagedWorldspaceWidget.
This commit is contained in:
parent
b46086912c
commit
3102a17522
11 changed files with 55 additions and 71 deletions
|
@ -12,7 +12,6 @@
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
|
|
||||||
#include "universalid.hpp"
|
#include "universalid.hpp"
|
||||||
//#include "nestedtablewrapper.hpp"
|
|
||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
class QAbstractItemModel;
|
class QAbstractItemModel;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "pathgridcommands.hpp"
|
#include "pathgridcommands.hpp"
|
||||||
|
|
||||||
#include "../../view/render/cell.hpp"
|
#include "../../view/render/cell.hpp"
|
||||||
|
|
||||||
#include "idtree.hpp"
|
#include "idtree.hpp"
|
||||||
#include "nestedtablewrapper.hpp"
|
#include "nestedtablewrapper.hpp"
|
||||||
|
|
||||||
|
@ -43,6 +44,5 @@ CSMWorld::SignalHandler::SignalHandler (CSVRender::Cell *parent) : mParent(paren
|
||||||
|
|
||||||
void CSMWorld::SignalHandler::connectToCommand(const CSMWorld::ModifyPathgridCommand *command)
|
void CSMWorld::SignalHandler::connectToCommand(const CSMWorld::ModifyPathgridCommand *command)
|
||||||
{
|
{
|
||||||
connect (command, SIGNAL(undoActioned()),
|
connect (command, SIGNAL(undoActioned()), this, SLOT(rebuildPathgrid()));
|
||||||
this, SLOT(rebuildPathgrid()));
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace CSMWorld
|
||||||
|
|
||||||
void connectToCommand(const ModifyPathgridCommand *command);
|
void connectToCommand(const ModifyPathgridCommand *command);
|
||||||
|
|
||||||
private slots:
|
public slots:
|
||||||
|
|
||||||
void rebuildPathgrid();
|
void rebuildPathgrid();
|
||||||
|
|
||||||
|
|
|
@ -307,9 +307,34 @@ float CSVRender::Cell::getTerrainHeightAt(const Ogre::Vector3 &pos) const
|
||||||
return -std::numeric_limits<float>::max();
|
return -std::numeric_limits<float>::max();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVRender::Cell::pathgridDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight)
|
||||||
|
{
|
||||||
|
CSMWorld::IdTree *pathgrids = dynamic_cast<CSMWorld::IdTree *>(
|
||||||
|
mDocument.getData().getTableModel(CSMWorld::UniversalId::Type_Pathgrid));
|
||||||
|
|
||||||
|
int idColumn = pathgrids->findColumnIndex(CSMWorld::Columns::ColumnId_Id);
|
||||||
|
int colPaths = pathgrids->findColumnIndex(CSMWorld::Columns::ColumnId_PathgridPoints);
|
||||||
|
//int colEdges = pathgrids->findColumnIndex(CSMWorld::Columns::ColumnId_PathgridEdges);
|
||||||
|
|
||||||
|
// FIXME: how to detect adds/deletes/modifies?
|
||||||
|
|
||||||
|
for (int i=topLeft.row(); i<=bottomRight.row(); ++i)
|
||||||
|
{
|
||||||
|
std::string cell = Misc::StringUtils::lowerCase (pathgrids->data (
|
||||||
|
pathgrids->index (i, idColumn)).toString().toUtf8().constData());
|
||||||
|
|
||||||
|
if (cell==mId && colPaths >= topLeft.column() && colPaths <= bottomRight.column())
|
||||||
|
{
|
||||||
|
if (!mModel)
|
||||||
|
setupPathgrid();
|
||||||
|
|
||||||
|
mHandler->rebuildPathgrid();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME:
|
// FIXME:
|
||||||
// - adding edges (need the ability to select a pathgrid and highlight)
|
// - adding edges (need the ability to select a pathgrid and highlight)
|
||||||
// - save to document & signals
|
|
||||||
// - repainting edges while moving
|
// - repainting edges while moving
|
||||||
void CSVRender::Cell::setupPathgrid()
|
void CSVRender::Cell::setupPathgrid()
|
||||||
{
|
{
|
||||||
|
@ -434,7 +459,7 @@ void CSVRender::Cell::pathgridPointAdded(const Ogre::Vector3 &pos, bool interior
|
||||||
|
|
||||||
pathgrid.mData.mS2 += 1; // increment the number of points
|
pathgrid.mData.mS2 += 1; // increment the number of points
|
||||||
|
|
||||||
// FIXME: possible issue if this cell is deleted and undo() is actioned afterwards
|
// TODO: check for possible issue if this cell is deleted and undo() is actioned afterwards
|
||||||
CSMWorld::ModifyPathgridCommand *cmd = new CSMWorld::ModifyPathgridCommand(*mModel,
|
CSMWorld::ModifyPathgridCommand *cmd = new CSMWorld::ModifyPathgridCommand(*mModel,
|
||||||
mProxyModel->getParentId(), mProxyModel->getParentColumn(),
|
mProxyModel->getParentId(), mProxyModel->getParentColumn(),
|
||||||
new CSMWorld::PathgridPointsWrap(pathgrid));
|
new CSMWorld::PathgridPointsWrap(pathgrid));
|
||||||
|
@ -493,7 +518,7 @@ void CSVRender::Cell::pathgridPointRemoved(const std::string &name)
|
||||||
<< pathgridId + "_" + QString::number(index).toStdString() << std::endl;
|
<< pathgridId + "_" + QString::number(index).toStdString() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: possible issue if this cell is deleted and undo() is actioned afterwards
|
// TODO: check for possible issue if this cell is deleted and undo() is actioned afterwards
|
||||||
CSMWorld::ModifyPathgridCommand *cmd = new CSMWorld::ModifyPathgridCommand(*mModel,
|
CSMWorld::ModifyPathgridCommand *cmd = new CSMWorld::ModifyPathgridCommand(*mModel,
|
||||||
mProxyModel->getParentId(), mProxyModel->getParentColumn(),
|
mProxyModel->getParentId(), mProxyModel->getParentColumn(),
|
||||||
new CSMWorld::PathgridPointsWrap(pathgrid));
|
new CSMWorld::PathgridPointsWrap(pathgrid));
|
||||||
|
@ -536,7 +561,7 @@ void CSVRender::Cell::pathgridPointMoved(const std::string &name,
|
||||||
pathgrid.mPoints[index].mY = y;
|
pathgrid.mPoints[index].mY = y;
|
||||||
pathgrid.mPoints[index].mZ = newPos.z;
|
pathgrid.mPoints[index].mZ = newPos.z;
|
||||||
|
|
||||||
// FIXME: possible issue if this cell is deleted and undo() is actioned afterwards
|
// TODO: check for possible issue if this cell is deleted and undo() is actioned afterwards
|
||||||
CSMWorld::ModifyPathgridCommand *cmd = new CSMWorld::ModifyPathgridCommand(*mModel,
|
CSMWorld::ModifyPathgridCommand *cmd = new CSMWorld::ModifyPathgridCommand(*mModel,
|
||||||
mProxyModel->getParentId(), mProxyModel->getParentColumn(),
|
mProxyModel->getParentId(), mProxyModel->getParentColumn(),
|
||||||
new CSMWorld::PathgridPointsWrap(pathgrid));
|
new CSMWorld::PathgridPointsWrap(pathgrid));
|
||||||
|
|
|
@ -111,6 +111,8 @@ namespace CSVRender
|
||||||
const Ogre::Vector3 &newPos, bool interior = false);
|
const Ogre::Vector3 &newPos, bool interior = false);
|
||||||
void pathgridPointRemoved(const std::string &name);
|
void pathgridPointRemoved(const std::string &name);
|
||||||
|
|
||||||
|
void pathgridDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// for drawing pathgrid points & lines
|
// for drawing pathgrid points & lines
|
||||||
|
|
|
@ -330,23 +330,13 @@ void CSVRender::PagedWorldspaceWidget::referenceAdded (const QModelIndex& parent
|
||||||
flagAsModified();
|
flagAsModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
//void CSVRender::PagedWorldspaceWidget::pathgridAdded (const QModelIndex& parent,
|
void CSVRender::PagedWorldspaceWidget::pathgridDataChanged (const QModelIndex& topLeft,
|
||||||
// int start, int end)
|
const QModelIndex& bottomRight)
|
||||||
//{
|
{
|
||||||
// // FIXME:
|
for (std::map<CSMWorld::CellCoordinates, Cell *>::iterator iter (mCells.begin());
|
||||||
//}
|
iter!=mCells.end(); ++iter)
|
||||||
//
|
iter->second->pathgridDataChanged (topLeft, bottomRight);
|
||||||
//void CSVRender::PagedWorldspaceWidget::pathgridDataChanged (const QModelIndex& topLeft,
|
}
|
||||||
// const QModelIndex& bottomRight)
|
|
||||||
//{
|
|
||||||
// // FIXME:
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//void CSVRender::PagedWorldspaceWidget::pathgridAboutToBeRemoved (const QModelIndex& parent,
|
|
||||||
// int start, int end)
|
|
||||||
//{
|
|
||||||
// // FIXME:
|
|
||||||
//}
|
|
||||||
|
|
||||||
CSVRender::Cell *CSVRender::PagedWorldspaceWidget::findCell(const std::string &cellId)
|
CSVRender::Cell *CSVRender::PagedWorldspaceWidget::findCell(const std::string &cellId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,12 +53,6 @@ namespace CSVRender
|
||||||
|
|
||||||
virtual void referenceAdded (const QModelIndex& index, int start, int end);
|
virtual void referenceAdded (const QModelIndex& index, int start, int end);
|
||||||
|
|
||||||
//virtual void pathgridAdded (const QModelIndex& parent, int start, int end);
|
|
||||||
|
|
||||||
//virtual void pathgridDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
|
||||||
|
|
||||||
//virtual void pathgridAboutToBeRemoved (const QModelIndex& parent, int start, int end);
|
|
||||||
|
|
||||||
virtual std::string getStartupInstruction();
|
virtual std::string getStartupInstruction();
|
||||||
|
|
||||||
Cell *findCell(const std::string &cellId);
|
Cell *findCell(const std::string &cellId);
|
||||||
|
@ -103,7 +97,6 @@ namespace CSVRender
|
||||||
|
|
||||||
virtual void mouseDoubleClickEvent (QMouseEvent *event);
|
virtual void mouseDoubleClickEvent (QMouseEvent *event);
|
||||||
|
|
||||||
// FIXME: temporary only until signals from the document is implemented
|
|
||||||
virtual void pathgridInserted (const std::string &referenceId, const Ogre::Vector3 &pos);
|
virtual void pathgridInserted (const std::string &referenceId, const Ogre::Vector3 &pos);
|
||||||
virtual void pathgridMoved (const std::string &pgName, const Ogre::Vector3 &pos);
|
virtual void pathgridMoved (const std::string &pgName, const Ogre::Vector3 &pos);
|
||||||
virtual void pathgridAboutToBeRemoved (const std::string &pgName);
|
virtual void pathgridAboutToBeRemoved (const std::string &pgName);
|
||||||
|
@ -121,6 +114,8 @@ namespace CSVRender
|
||||||
virtual void cellAdded (const QModelIndex& index, int start, int end);
|
virtual void cellAdded (const QModelIndex& index, int start, int end);
|
||||||
|
|
||||||
virtual void flagAsModSlot();
|
virtual void flagAsModSlot();
|
||||||
|
|
||||||
|
virtual void pathgridDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,23 +166,11 @@ void CSVRender::UnpagedWorldspaceWidget::addVisibilitySelectorButtons (
|
||||||
tool->addButton (Element_Fog, "Fog");
|
tool->addButton (Element_Fog, "Fog");
|
||||||
}
|
}
|
||||||
|
|
||||||
//void CSVRender::UnpagedWorldspaceWidget::pathgridAdded (const QModelIndex& parent,
|
void CSVRender::UnpagedWorldspaceWidget::pathgridDataChanged (const QModelIndex& topLeft,
|
||||||
// int start, int end)
|
const QModelIndex& bottomRight)
|
||||||
//{
|
{
|
||||||
// // FIXME:
|
// FIXME:
|
||||||
//}
|
}
|
||||||
//
|
|
||||||
//void CSVRender::UnpagedWorldspaceWidget::pathgridDataChanged (const QModelIndex& topLeft,
|
|
||||||
// const QModelIndex& bottomRight)
|
|
||||||
//{
|
|
||||||
// // FIXME:
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//void CSVRender::UnpagedWorldspaceWidget::pathgridAboutToBeRemoved (const QModelIndex& parent,
|
|
||||||
// int start, int end)
|
|
||||||
//{
|
|
||||||
// // FIXME:
|
|
||||||
//}
|
|
||||||
|
|
||||||
std::string CSVRender::UnpagedWorldspaceWidget::getStartupInstruction()
|
std::string CSVRender::UnpagedWorldspaceWidget::getStartupInstruction()
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,12 +58,6 @@ namespace CSVRender
|
||||||
|
|
||||||
virtual void referenceAdded (const QModelIndex& index, int start, int end);
|
virtual void referenceAdded (const QModelIndex& index, int start, int end);
|
||||||
|
|
||||||
//virtual void pathgridAdded (const QModelIndex& index, int start, int end);
|
|
||||||
|
|
||||||
//virtual void pathgridDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
|
||||||
|
|
||||||
//virtual void pathgridAboutToBeRemoved (const QModelIndex& parent, int start, int end);
|
|
||||||
|
|
||||||
virtual std::string getStartupInstruction();
|
virtual std::string getStartupInstruction();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -78,6 +72,8 @@ namespace CSVRender
|
||||||
|
|
||||||
virtual void flagAsModSlot();
|
virtual void flagAsModSlot();
|
||||||
|
|
||||||
|
virtual void pathgridDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void cellChanged(const CSMWorld::UniversalId& id);
|
void cellChanged(const CSMWorld::UniversalId& id);
|
||||||
|
|
|
@ -56,15 +56,11 @@ CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidg
|
||||||
connect (debugProfiles, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)),
|
connect (debugProfiles, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)),
|
||||||
this, SLOT (debugProfileAboutToBeRemoved (const QModelIndex&, int, int)));
|
this, SLOT (debugProfileAboutToBeRemoved (const QModelIndex&, int, int)));
|
||||||
|
|
||||||
//QAbstractItemModel *pathgrids =
|
QAbstractItemModel *pathgrids =
|
||||||
//document.getData().getTableModel (CSMWorld::UniversalId::Type_Pathgrid);
|
document.getData().getTableModel (CSMWorld::UniversalId::Type_Pathgrid);
|
||||||
|
|
||||||
//connect (pathgrids, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
|
connect (pathgrids, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
||||||
//this, SLOT (pathgridAdded (const QModelIndex&, int, int)));
|
this, SLOT (pathgridDataChanged (const QModelIndex&, const QModelIndex&)));
|
||||||
//connect (pathgrids, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
|
||||||
//this, SLOT (pathgridDataChanged (const QModelIndex&, const QModelIndex&)));
|
|
||||||
//connect (pathgrids, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)),
|
|
||||||
//this, SLOT (pathgridAboutToBeRemoved (const QModelIndex&, int, int)));
|
|
||||||
|
|
||||||
mPhysics = document.getPhysics(); // create physics if one doesn't exist
|
mPhysics = document.getPhysics(); // create physics if one doesn't exist
|
||||||
mPhysics->addSceneManager(getSceneManager(), this);
|
mPhysics->addSceneManager(getSceneManager(), this);
|
||||||
|
@ -460,17 +456,14 @@ void CSVRender::WorldspaceWidget::keyPressEvent (QKeyEvent *event)
|
||||||
SceneWidget::keyPressEvent(event);
|
SceneWidget::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: temporary until signals from the document are implemented
|
|
||||||
void CSVRender::WorldspaceWidget::pathgridAboutToBeRemoved (const std::string &pgName)
|
void CSVRender::WorldspaceWidget::pathgridAboutToBeRemoved (const std::string &pgName)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: temporary until signals from the document are implemented
|
|
||||||
void CSVRender::WorldspaceWidget::pathgridMoved (const std::string &pgName, const Ogre::Vector3 &newPos)
|
void CSVRender::WorldspaceWidget::pathgridMoved (const std::string &pgName, const Ogre::Vector3 &newPos)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: temporary until signals from the document are implemented
|
|
||||||
void CSVRender::WorldspaceWidget::pathgridInserted (const std::string &name, const Ogre::Vector3 &pos)
|
void CSVRender::WorldspaceWidget::pathgridInserted (const std::string &name, const Ogre::Vector3 &pos)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,11 +163,7 @@ namespace CSVRender
|
||||||
|
|
||||||
void debugProfileAboutToBeRemoved (const QModelIndex& parent, int start, int end);
|
void debugProfileAboutToBeRemoved (const QModelIndex& parent, int start, int end);
|
||||||
|
|
||||||
//virtual void pathgridAdded (const QModelIndex& index, int start, int end) = 0;
|
virtual void pathgridDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight) = 0;
|
||||||
|
|
||||||
//virtual void pathgridDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight) = 0;
|
|
||||||
|
|
||||||
//virtual void pathgridAboutToBeRemoved (const QModelIndex& parent, int start, int end) = 0;
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue