forked from mirror/openmw-tes3mp
added visual element selector toolbar button
This commit is contained in:
parent
a25758c3b1
commit
439ba57d46
7 changed files with 87 additions and 3 deletions
|
@ -126,7 +126,9 @@ namespace CSVRender
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mWindow = Ogre::Root::getSingleton().createRenderWindow(windowTitle.str(), this->width(), this->height(), false, ¶ms);
|
mWindow = Ogre::Root::getSingleton().createRenderWindow(windowTitle.str(), this->width(), this->height(), false, ¶ms);
|
||||||
mWindow->addViewport(mCamera)->setBackgroundColour(Ogre::ColourValue(0.3,0.3,0.3,1));
|
|
||||||
|
mViewport = mWindow->addViewport (mCamera);
|
||||||
|
mViewport->setBackgroundColour (Ogre::ColourValue (0.3,0.3,0.3,1));
|
||||||
|
|
||||||
Ogre::Real aspectRatio = Ogre::Real(width()) / Ogre::Real(height());
|
Ogre::Real aspectRatio = Ogre::Real(width()) / Ogre::Real(height());
|
||||||
mCamera->setAspectRatio(aspectRatio);
|
mCamera->setAspectRatio(aspectRatio);
|
||||||
|
@ -141,6 +143,11 @@ namespace CSVRender
|
||||||
Ogre::Root::getSingleton().destroySceneManager (mSceneMgr);
|
Ogre::Root::getSingleton().destroySceneManager (mSceneMgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SceneWidget::setVisibilityMask (unsigned int mask)
|
||||||
|
{
|
||||||
|
mViewport->setVisibilityMask (mask);
|
||||||
|
}
|
||||||
|
|
||||||
void SceneWidget::setNavigation (Navigation *navigation)
|
void SceneWidget::setNavigation (Navigation *navigation)
|
||||||
{
|
{
|
||||||
if ((mNavigation = navigation))
|
if ((mNavigation = navigation))
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace Ogre
|
||||||
class Camera;
|
class Camera;
|
||||||
class SceneManager;
|
class SceneManager;
|
||||||
class RenderWindow;
|
class RenderWindow;
|
||||||
|
class Viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CSVWidget
|
namespace CSVWidget
|
||||||
|
@ -42,6 +43,8 @@ namespace CSVRender
|
||||||
///< \attention The created tool is not added to the toolbar (via addTool). Doing that
|
///< \attention The created tool is not added to the toolbar (via addTool). Doing that
|
||||||
/// is the responsibility of the calling function.
|
/// is the responsibility of the calling function.
|
||||||
|
|
||||||
|
virtual void setVisibilityMask (unsigned int mask);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void setNavigation (Navigation *navigation);
|
void setNavigation (Navigation *navigation);
|
||||||
|
@ -85,6 +88,7 @@ namespace CSVRender
|
||||||
Ogre::Camera* mCamera;
|
Ogre::Camera* mCamera;
|
||||||
Ogre::SceneManager* mSceneMgr;
|
Ogre::SceneManager* mSceneMgr;
|
||||||
Ogre::RenderWindow* mWindow;
|
Ogre::RenderWindow* mWindow;
|
||||||
|
Ogre::Viewport *mViewport;
|
||||||
|
|
||||||
Navigation *mNavigation;
|
Navigation *mNavigation;
|
||||||
Lighting *mLighting;
|
Lighting *mLighting;
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
#include "../../model/world/idtable.hpp"
|
#include "../../model/world/idtable.hpp"
|
||||||
#include "../../model/world/tablemimedata.hpp"
|
#include "../../model/world/tablemimedata.hpp"
|
||||||
|
|
||||||
|
#include "../widget/scenetooltoggle.hpp"
|
||||||
|
|
||||||
|
#include "elements.hpp"
|
||||||
|
|
||||||
void CSVRender::UnpagedWorldspaceWidget::update()
|
void CSVRender::UnpagedWorldspaceWidget::update()
|
||||||
{
|
{
|
||||||
const CSMWorld::Record<CSMWorld::Cell>& record =
|
const CSMWorld::Record<CSMWorld::Cell>& record =
|
||||||
|
@ -25,6 +29,14 @@ void CSVRender::UnpagedWorldspaceWidget::update()
|
||||||
flagAsModified();
|
flagAsModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVRender::UnpagedWorldspaceWidget::addVisibilitySelectorButtons (
|
||||||
|
CSVWidget::SceneToolToggle *tool)
|
||||||
|
{
|
||||||
|
WorldspaceWidget::addVisibilitySelectorButtons (tool);
|
||||||
|
|
||||||
|
tool->addButton (":armor.png", Element_Fog, ":armor.png", "Fog");
|
||||||
|
}
|
||||||
|
|
||||||
CSVRender::UnpagedWorldspaceWidget::UnpagedWorldspaceWidget (const std::string& cellId, CSMDoc::Document& document, QWidget* parent)
|
CSVRender::UnpagedWorldspaceWidget::UnpagedWorldspaceWidget (const std::string& cellId, CSMDoc::Document& document, QWidget* parent)
|
||||||
: WorldspaceWidget (document, parent), mCellId (cellId)
|
: WorldspaceWidget (document, parent), mCellId (cellId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,6 +32,10 @@ namespace CSVRender
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void addVisibilitySelectorButtons (CSVWidget::SceneToolToggle *tool);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
UnpagedWorldspaceWidget (const std::string& cellId, CSMDoc::Document& document,
|
UnpagedWorldspaceWidget (const std::string& cellId, CSMDoc::Document& document,
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
#include "../../model/world/universalid.hpp"
|
#include "../../model/world/universalid.hpp"
|
||||||
|
|
||||||
#include "../widget/scenetoolmode.hpp"
|
#include "../widget/scenetoolmode.hpp"
|
||||||
|
#include "../widget/scenetooltoggle.hpp"
|
||||||
|
|
||||||
|
#include "elements.hpp"
|
||||||
|
|
||||||
CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidget* parent)
|
CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidget* parent)
|
||||||
: SceneWidget (parent), mDocument(document)
|
: SceneWidget (parent), mDocument(document)
|
||||||
|
@ -94,6 +97,21 @@ CSVWidget::SceneToolMode *CSVRender::WorldspaceWidget::makeNavigationSelector (
|
||||||
return tool;
|
return tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CSVWidget::SceneToolToggle *CSVRender::WorldspaceWidget::makeSceneVisibilitySelector (CSVWidget::SceneToolbar *parent)
|
||||||
|
{
|
||||||
|
mSceneElements= new CSVWidget::SceneToolToggle (parent,
|
||||||
|
"Scene Element Visibility", ":door.png");
|
||||||
|
|
||||||
|
addVisibilitySelectorButtons (mSceneElements);
|
||||||
|
|
||||||
|
mSceneElements->setSelection (0xffffffff);
|
||||||
|
|
||||||
|
connect (mSceneElements, SIGNAL (selectionChanged()),
|
||||||
|
this, SLOT (elementSelectionChanged()));
|
||||||
|
|
||||||
|
return mSceneElements;
|
||||||
|
}
|
||||||
|
|
||||||
CSVRender::WorldspaceWidget::dropType CSVRender::WorldspaceWidget::getDropType (
|
CSVRender::WorldspaceWidget::dropType CSVRender::WorldspaceWidget::getDropType (
|
||||||
const std::vector< CSMWorld::UniversalId >& data)
|
const std::vector< CSMWorld::UniversalId >& data)
|
||||||
{
|
{
|
||||||
|
@ -147,6 +165,20 @@ CSVRender::WorldspaceWidget::dropType CSVRender::WorldspaceWidget::getDropType (
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int CSVRender::WorldspaceWidget::getElementMask() const
|
||||||
|
{
|
||||||
|
return mSceneElements->getSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVRender::WorldspaceWidget::addVisibilitySelectorButtons (
|
||||||
|
CSVWidget::SceneToolToggle *tool)
|
||||||
|
{
|
||||||
|
tool->addButton (":activator.png", Element_Reference, ":activator.png", "References");
|
||||||
|
tool->addButton (":armor.png", Element_Terrain, ":armor.png", "Terrain");
|
||||||
|
tool->addButton (":armor.png", Element_Water, ":armor.png", "Water");
|
||||||
|
tool->addButton (":armor.png", Element_Pathgrid, ":armor.png", "Pathgrid");
|
||||||
|
}
|
||||||
|
|
||||||
void CSVRender::WorldspaceWidget::dragEnterEvent (QDragEnterEvent* event)
|
void CSVRender::WorldspaceWidget::dragEnterEvent (QDragEnterEvent* event)
|
||||||
{
|
{
|
||||||
event->accept();
|
event->accept();
|
||||||
|
@ -157,7 +189,6 @@ void CSVRender::WorldspaceWidget::dragMoveEvent(QDragMoveEvent *event)
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CSVRender::WorldspaceWidget::dropEvent (QDropEvent* event)
|
void CSVRender::WorldspaceWidget::dropEvent (QDropEvent* event)
|
||||||
{
|
{
|
||||||
const CSMWorld::TableMimeData* mime = dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData());
|
const CSMWorld::TableMimeData* mime = dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData());
|
||||||
|
@ -169,3 +200,8 @@ void CSVRender::WorldspaceWidget::dropEvent (QDropEvent* event)
|
||||||
emit dataDropped(mime->getData());
|
emit dataDropped(mime->getData());
|
||||||
} //not handling drops from different documents at the moment
|
} //not handling drops from different documents at the moment
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVRender::WorldspaceWidget::elementSelectionChanged()
|
||||||
|
{
|
||||||
|
setVisibilityMask (getElementMask());
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ namespace CSMWorld
|
||||||
namespace CSVWidget
|
namespace CSVWidget
|
||||||
{
|
{
|
||||||
class SceneToolMode;
|
class SceneToolMode;
|
||||||
|
class SceneToolToggle;
|
||||||
class SceneToolbar;
|
class SceneToolbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +29,7 @@ namespace CSVRender
|
||||||
CSVRender::Navigation1st m1st;
|
CSVRender::Navigation1st m1st;
|
||||||
CSVRender::NavigationFree mFree;
|
CSVRender::NavigationFree mFree;
|
||||||
CSVRender::NavigationOrbit mOrbit;
|
CSVRender::NavigationOrbit mOrbit;
|
||||||
|
CSVWidget::SceneToolToggle *mSceneElements;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -53,6 +55,11 @@ namespace CSVRender
|
||||||
///< \attention The created tool is not added to the toolbar (via addTool). Doing that
|
///< \attention The created tool is not added to the toolbar (via addTool). Doing that
|
||||||
/// is the responsibility of the calling function.
|
/// is the responsibility of the calling function.
|
||||||
|
|
||||||
|
/// \attention The created tool is not added to the toolbar (via addTool). Doing
|
||||||
|
/// that is the responsibility of the calling function.
|
||||||
|
CSVWidget::SceneToolToggle *makeSceneVisibilitySelector (
|
||||||
|
CSVWidget::SceneToolbar *parent);
|
||||||
|
|
||||||
void selectDefaultNavigationMode();
|
void selectDefaultNavigationMode();
|
||||||
|
|
||||||
static dropType getDropType(const std::vector<CSMWorld::UniversalId>& data);
|
static dropType getDropType(const std::vector<CSMWorld::UniversalId>& data);
|
||||||
|
@ -64,8 +71,13 @@ namespace CSVRender
|
||||||
|
|
||||||
virtual void handleDrop(const std::vector<CSMWorld::UniversalId>& data) = 0;
|
virtual void handleDrop(const std::vector<CSMWorld::UniversalId>& data) = 0;
|
||||||
|
|
||||||
|
virtual unsigned int getElementMask() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const CSMDoc::Document& mDocument; //for checking if drop comes from same document
|
|
||||||
|
virtual void addVisibilitySelectorButtons (CSVWidget::SceneToolToggle *tool);
|
||||||
|
|
||||||
|
const CSMDoc::Document& mDocument;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -92,6 +104,10 @@ namespace CSVRender
|
||||||
|
|
||||||
virtual void referenceAdded (const QModelIndex& index, int start, int end) = 0;
|
virtual void referenceAdded (const QModelIndex& index, int start, int end) = 0;
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
|
||||||
|
void elementSelectionChanged();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void closeRequest();
|
void closeRequest();
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "../widget/scenetoolbar.hpp"
|
#include "../widget/scenetoolbar.hpp"
|
||||||
#include "../widget/scenetoolmode.hpp"
|
#include "../widget/scenetoolmode.hpp"
|
||||||
|
#include "../widget/scenetooltoggle.hpp"
|
||||||
|
|
||||||
#include "tablebottombox.hpp"
|
#include "tablebottombox.hpp"
|
||||||
#include "creator.hpp"
|
#include "creator.hpp"
|
||||||
|
@ -107,6 +108,10 @@ CSVWidget::SceneToolbar* CSVWorld::SceneSubView::makeToolbar (CSVRender::Worldsp
|
||||||
CSVWidget::SceneToolMode *lightingTool = widget->makeLightingSelector (toolbar);
|
CSVWidget::SceneToolMode *lightingTool = widget->makeLightingSelector (toolbar);
|
||||||
toolbar->addTool (lightingTool);
|
toolbar->addTool (lightingTool);
|
||||||
|
|
||||||
|
CSVWidget::SceneToolToggle *sceneVisibilityTool =
|
||||||
|
widget->makeSceneVisibilitySelector (toolbar);
|
||||||
|
toolbar->addTool (sceneVisibilityTool);
|
||||||
|
|
||||||
/* Add buttons specific to the type. For now no need for it.
|
/* Add buttons specific to the type. For now no need for it.
|
||||||
*
|
*
|
||||||
switch (type)
|
switch (type)
|
||||||
|
|
Loading…
Reference in a new issue