mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
Fix Subview interface clutter by keeping a map of Scenewidgets.
This commit is contained in:
parent
e51d532795
commit
057982b1f8
@ -43,6 +43,3 @@ void CSVDoc::SubView::closeRequest()
|
||||
{
|
||||
emit closeRequest (this);
|
||||
}
|
||||
|
||||
void CSVDoc::SubView::updateScene()
|
||||
{}
|
||||
|
@ -52,8 +52,6 @@ namespace CSVDoc
|
||||
|
||||
virtual void updateUserSetting (const QString& name, const QStringList& value);
|
||||
|
||||
virtual void updateScene();
|
||||
|
||||
private:
|
||||
|
||||
void closeEvent (QCloseEvent *event);
|
||||
@ -68,8 +66,6 @@ namespace CSVDoc
|
||||
|
||||
void updateSubViewIndicies (SubView *view = 0);
|
||||
|
||||
void refreshSubViews();
|
||||
|
||||
protected slots:
|
||||
|
||||
void closeRequest();
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "../../model/world/idtable.hpp"
|
||||
|
||||
#include "../world/subviews.hpp"
|
||||
#include "../doc/subview.hpp"
|
||||
|
||||
#include "../tools/subviews.hpp"
|
||||
|
||||
@ -301,15 +300,6 @@ void CSVDoc::View::setupUi()
|
||||
setupDebugMenu();
|
||||
}
|
||||
|
||||
void CSVDoc::View::refreshSubViews()
|
||||
{
|
||||
QList<SubView *>::iterator iter = mSubViews.begin();
|
||||
for(; iter != mSubViews.end(); ++iter)
|
||||
{
|
||||
(*iter)->updateScene();
|
||||
}
|
||||
}
|
||||
|
||||
void CSVDoc::View::updateTitle()
|
||||
{
|
||||
std::ostringstream stream;
|
||||
@ -537,8 +527,6 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
|
||||
connect (view, SIGNAL (updateSubViewIndicies (SubView *)),
|
||||
this, SLOT (updateSubViewIndicies (SubView *)));
|
||||
|
||||
connect (view, SIGNAL (refreshSubViews()), this, SLOT (refreshSubViews()));
|
||||
|
||||
view->show();
|
||||
}
|
||||
|
||||
|
@ -139,8 +139,6 @@ namespace CSVDoc
|
||||
// called when subviews are added or removed
|
||||
void updateSubViewIndicies (SubView *view = 0);
|
||||
|
||||
void refreshSubViews();
|
||||
|
||||
private slots:
|
||||
|
||||
void newView();
|
||||
|
@ -66,7 +66,7 @@ namespace CSVRender
|
||||
mOverlaySystem = OverlaySystem::instance().get();
|
||||
mSceneMgr->addRenderQueueListener(mOverlaySystem);
|
||||
|
||||
CSVWorld::PhysicsSystem::instance()->addSceneManager(mSceneMgr);
|
||||
CSVWorld::PhysicsSystem::instance()->addSceneManager(mSceneMgr, this);
|
||||
|
||||
QTimer *timer = new QTimer (this);
|
||||
|
||||
|
@ -527,7 +527,7 @@ void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event)
|
||||
mCurrentMousePos = planeResult.second;
|
||||
CSVWorld::PhysicsSystem::instance()->moveSceneNodes(mGrabbedSceneNode,
|
||||
pos+planeResult.second-mOrigMousePos);
|
||||
emit signalAsModified();
|
||||
updateSceneWidgets();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -748,7 +748,7 @@ void CSVRender::WorldspaceWidget::wheelEvent (QWheelEvent *event)
|
||||
getSceneManager()->getSceneNode(mGrabbedSceneNode)->setPosition(pos+mCurrentMousePos-mOrigMousePos);
|
||||
CSVWorld::PhysicsSystem::instance()->moveSceneNodes(mGrabbedSceneNode,
|
||||
pos+mCurrentMousePos-mOrigMousePos);
|
||||
emit signalAsModified();
|
||||
updateSceneWidgets();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -923,7 +923,19 @@ void CSVRender::WorldspaceWidget::placeObject(const std::string sceneNode, const
|
||||
CSVWorld::PhysicsSystem::instance()->replaceObject(mesh, sceneNode, refId, cellref.mScale, pos, xr*yr*zr);
|
||||
|
||||
// update all SceneWidgets and their SceneManagers
|
||||
emit signalAsModified();
|
||||
updateSceneWidgets();
|
||||
}
|
||||
|
||||
void CSVRender::WorldspaceWidget::updateSceneWidgets()
|
||||
{
|
||||
std::map<Ogre::SceneManager*, CSVRender::SceneWidget *> sceneWidgets =
|
||||
CSVWorld::PhysicsSystem::instance()->sceneWidgets();
|
||||
|
||||
std::map<Ogre::SceneManager*, CSVRender::SceneWidget *>::iterator iter = sceneWidgets.begin();
|
||||
for(; iter != sceneWidgets.end(); ++iter)
|
||||
{
|
||||
(*iter).second->updateScene();
|
||||
}
|
||||
}
|
||||
|
||||
bool CSVRender::WorldspaceWidget::isDebug()
|
||||
|
@ -130,12 +130,14 @@ namespace CSVRender
|
||||
virtual std::string getStartupInstruction() = 0;
|
||||
|
||||
void placeObject(const std::string sceneNode, const Ogre::Vector3 &pos);
|
||||
bool isDebug();
|
||||
std::pair<std::string, Ogre::Vector3> terrainUnderCursor(const int mouseX, const int mouseY);
|
||||
std::pair<std::string, Ogre::Vector3> objectUnderCursor(const int mouseX, const int mouseY);
|
||||
std::pair<bool, Ogre::Vector3> mousePositionOnPlane(const QPoint &pos, const Ogre::Plane &plane);
|
||||
void updateSelectionHighlight(const std::string sceneNode, const Ogre::Vector3 &position);
|
||||
|
||||
void updateSceneWidgets();
|
||||
bool isDebug();
|
||||
|
||||
private slots:
|
||||
|
||||
void selectNavigationMode (const std::string& mode);
|
||||
@ -170,8 +172,6 @@ namespace CSVRender
|
||||
void closeRequest();
|
||||
|
||||
void dataDropped(const std::vector<CSMWorld::UniversalId>& data);
|
||||
|
||||
void signalAsModified();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -276,9 +276,15 @@ namespace CSVWorld
|
||||
return mSceneNodeToMesh[sceneNodeName];
|
||||
}
|
||||
|
||||
void PhysicsSystem::addSceneManager(Ogre::SceneManager *sceneMgr)
|
||||
void PhysicsSystem::addSceneManager(Ogre::SceneManager *sceneMgr, CSVRender::SceneWidget * sceneWidget)
|
||||
{
|
||||
mSceneManagers.push_back(sceneMgr);
|
||||
mSceneWidgets[sceneMgr] = sceneWidget;
|
||||
}
|
||||
|
||||
std::map<Ogre::SceneManager*, CSVRender::SceneWidget *> PhysicsSystem::sceneWidgets()
|
||||
{
|
||||
return mSceneWidgets;
|
||||
}
|
||||
|
||||
void PhysicsSystem::removeSceneManager(Ogre::SceneManager *sceneMgr)
|
||||
@ -292,6 +298,7 @@ namespace CSVWorld
|
||||
break;
|
||||
}
|
||||
}
|
||||
mSceneWidgets.erase(sceneMgr);
|
||||
}
|
||||
|
||||
void PhysicsSystem::toggleDebugRendering(Ogre::SceneManager *sceneMgr)
|
||||
|
@ -35,6 +35,8 @@ namespace CSVWorld
|
||||
std::map<std::string, std::map<Ogre::SceneManager *, std::string> > mRefIdToSceneNode;
|
||||
std::map<std::string, std::string> mSceneNodeToMesh;
|
||||
std::list<Ogre::SceneManager *> mSceneManagers; // FIXME: change to list per OEngine
|
||||
//std::list<CSVRender::SceneWidget *> mSceneWidgets; // FIXME: change to list per OEngine
|
||||
std::map<Ogre::SceneManager*, CSVRender::SceneWidget *> mSceneWidgets;
|
||||
OEngine::Physic::PhysicEngine* mEngine;
|
||||
std::multimap<std::string, Ogre::SceneManager *> mTerrain;
|
||||
|
||||
@ -45,7 +47,7 @@ namespace CSVWorld
|
||||
|
||||
static PhysicsSystem *instance();
|
||||
|
||||
void addSceneManager(Ogre::SceneManager *sceneMgr);
|
||||
void addSceneManager(Ogre::SceneManager *sceneMgr, CSVRender::SceneWidget * scene);
|
||||
void removeSceneManager(Ogre::SceneManager *sceneMgr);
|
||||
|
||||
void addObject(const std::string &mesh,
|
||||
@ -80,6 +82,8 @@ namespace CSVWorld
|
||||
|
||||
std::string sceneNodeToMesh(std::string sceneNodeName);
|
||||
|
||||
std::map<Ogre::SceneManager*, CSVRender::SceneWidget *> sceneWidgets();
|
||||
|
||||
private:
|
||||
|
||||
void moveSceneNodeImpl(const std::string sceneNodeName,
|
||||
|
@ -62,8 +62,6 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
||||
makeConnections(newWidget);
|
||||
}
|
||||
|
||||
connect (worldspaceWidget, SIGNAL (signalAsModified()), this, SIGNAL (refreshSubViews()));
|
||||
|
||||
replaceToolbarAndWorldspace(worldspaceWidget, makeToolbar(worldspaceWidget, whatWidget));
|
||||
|
||||
layout->insertLayout (0, mLayout, 1);
|
||||
@ -133,7 +131,6 @@ CSVWidget::SceneToolbar* CSVWorld::SceneSubView::makeToolbar (CSVRender::Worldsp
|
||||
void CSVWorld::SceneSubView::setEditLock (bool locked)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CSVWorld::SceneSubView::updateEditorSetting(const QString &settingName, const QString &settingValue)
|
||||
@ -151,11 +148,6 @@ void CSVWorld::SceneSubView::useHint (const std::string& hint)
|
||||
mScene->useViewHint (hint);
|
||||
}
|
||||
|
||||
void CSVWorld::SceneSubView::updateScene()
|
||||
{
|
||||
if(mScene) mScene->updateScene();
|
||||
}
|
||||
|
||||
std::string CSVWorld::SceneSubView::getTitle() const
|
||||
{
|
||||
return mTitle;
|
||||
|
@ -60,8 +60,6 @@ namespace CSVWorld
|
||||
|
||||
virtual std::string getTitle() const;
|
||||
|
||||
virtual void updateScene();
|
||||
|
||||
private:
|
||||
|
||||
void makeConnections(CSVRender::PagedWorldspaceWidget* widget);
|
||||
|
Loading…
x
Reference in New Issue
Block a user