Moved selectNavigationMode to SceneWidget class, centralized camera selection.

openmw-39
Aesylwinn 9 years ago
parent 9afb0e0f90
commit ebdc212886

@ -6,8 +6,6 @@
#include <QMouseEvent>
#include <QApplication>
#include <osgGA/TrackballManipulator>
#include <components/esm/loadland.hpp>
#include "../../model/world/tablemimedata.hpp"
@ -117,7 +115,7 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
/// \todo do not overwrite manipulator object
/// \todo move code to useViewHint function
if (modified && wasEmpty)
mView->setCameraManipulator(new osgGA::TrackballManipulator);
selectNavigationMode("trackball");
return modified;
}

@ -1,7 +1,5 @@
#include "previewwidget.hpp"
#include <osgGA/TrackballManipulator>
#include "../../model/world/data.hpp"
#include "../../model/world/idtable.hpp"
@ -9,7 +7,7 @@ CSVRender::PreviewWidget::PreviewWidget (CSMWorld::Data& data,
const std::string& id, bool referenceable, QWidget *parent)
: SceneWidget (data.getResourceSystem(), parent), mData (data), mObject(data, mRootNode, id, referenceable)
{
mView->setCameraManipulator(new osgGA::TrackballManipulator);
selectNavigationMode("trackball");
QAbstractItemModel *referenceables =
mData.getTableModel (CSMWorld::UniversalId::Type_Referenceables);

@ -12,6 +12,9 @@
#include <osgViewer/ViewerEventHandlers>
#include <osg/LightModel>
#include <osgGA/TrackballManipulator>
#include <osgGA/FirstPersonManipulator>
#include <components/resource/scenemanager.hpp>
#include <components/resource/resourcesystem.hpp>
#include <components/sceneutil/lightmanager.hpp>
@ -282,6 +285,18 @@ void SceneWidget::settingChanged (const CSMPrefs::Setting *setting)
storeMappingSetting(setting);
}
void SceneWidget::selectNavigationMode (const std::string& mode)
{
if (mode=="1st")
mView->setCameraManipulator(new osgGA::FirstPersonManipulator);
else if (mode=="free")
mView->setCameraManipulator(new osgGA::FirstPersonManipulator);
else if (mode=="orbit")
mView->setCameraManipulator(new osgGA::OrbitManipulator);
else if (mode=="trackball")
mView->setCameraManipulator(new osgGA::TrackballManipulator);
}
bool SceneWidget::storeMappingSetting (const CSMPrefs::Setting *setting)
{
if (setting->getParent()->getKey()!="3D Scene Input")

@ -110,6 +110,8 @@ namespace CSVRender
virtual void settingChanged (const CSMPrefs::Setting *setting);
void selectNavigationMode (const std::string& mode);
private slots:
void selectLightingMode (const std::string& mode);

@ -51,7 +51,7 @@ CSVRender::UnpagedWorldspaceWidget::UnpagedWorldspaceWidget (const std::string&
mCell.reset (new Cell (document.getData(), mRootNode, mCellId));
mView->setCameraManipulator(new osgGA::TrackballManipulator);
selectNavigationMode("trackball");
}
void CSVRender::UnpagedWorldspaceWidget::cellDataChanged (const QModelIndex& topLeft,

@ -12,9 +12,6 @@
#include <QApplication>
#include <QToolTip>
#include <osgGA/TrackballManipulator>
#include <osgGA/FirstPersonManipulator>
#include <osgUtil/LineSegmentIntersector>
#include "../../model/world/universalid.hpp"
@ -94,21 +91,12 @@ void CSVRender::WorldspaceWidget::settingChanged (const CSMPrefs::Setting *setti
SceneWidget::settingChanged(setting);
}
void CSVRender::WorldspaceWidget::selectNavigationMode (const std::string& mode)
{
if (mode=="1st")
mView->setCameraManipulator(new osgGA::FirstPersonManipulator);
else if (mode=="free")
mView->setCameraManipulator(new osgGA::FirstPersonManipulator);
else if (mode=="orbit")
mView->setCameraManipulator(new osgGA::OrbitManipulator);
}
void CSVRender::WorldspaceWidget::useViewHint (const std::string& hint) {}
void CSVRender::WorldspaceWidget::selectDefaultNavigationMode()
{
mView->setCameraManipulator(new osgGA::FirstPersonManipulator);
selectNavigationMode("1st");
}
CSVWidget::SceneToolMode *CSVRender::WorldspaceWidget::makeNavigationSelector (

@ -213,8 +213,6 @@ namespace CSVRender
private slots:
void selectNavigationMode (const std::string& mode);
virtual void referenceableDataChanged (const QModelIndex& topLeft,
const QModelIndex& bottomRight) = 0;

Loading…
Cancel
Save