2014-03-04 13:47:43 +00:00
|
|
|
#include "worldspacewidget.hpp"
|
|
|
|
|
2014-09-06 14:11:06 +00:00
|
|
|
#include <algorithm>
|
2015-09-18 16:31:33 +00:00
|
|
|
#include <iostream>
|
2014-09-06 14:11:06 +00:00
|
|
|
|
2015-06-12 13:10:12 +00:00
|
|
|
#include <QEvent>
|
|
|
|
#include <QDragEnterEvent>
|
|
|
|
#include <QDragMoveEvent>
|
|
|
|
#include <QDropEvent>
|
|
|
|
#include <QMouseEvent>
|
|
|
|
#include <QKeyEvent>
|
2015-09-26 16:01:49 +00:00
|
|
|
#include <QApplication>
|
2015-11-12 14:05:17 +00:00
|
|
|
#include <QToolTip>
|
2014-05-01 13:09:47 +00:00
|
|
|
|
2015-09-18 16:31:33 +00:00
|
|
|
#include <osgUtil/LineSegmentIntersector>
|
|
|
|
|
2014-07-08 10:39:12 +00:00
|
|
|
#include "../../model/world/universalid.hpp"
|
2014-09-06 14:11:06 +00:00
|
|
|
#include "../../model/world/idtable.hpp"
|
2014-07-08 10:39:12 +00:00
|
|
|
|
2015-12-12 13:49:16 +00:00
|
|
|
#include "../../model/prefs/state.hpp"
|
2015-09-25 11:11:40 +00:00
|
|
|
|
2014-07-08 10:39:12 +00:00
|
|
|
#include "../widget/scenetoolmode.hpp"
|
2014-11-28 08:14:02 +00:00
|
|
|
#include "../widget/scenetooltoggle2.hpp"
|
2014-09-06 14:11:06 +00:00
|
|
|
#include "../widget/scenetoolrun.hpp"
|
2014-07-31 12:05:27 +00:00
|
|
|
|
2015-09-18 16:31:33 +00:00
|
|
|
#include "object.hpp"
|
2016-01-06 13:34:39 +00:00
|
|
|
#include "mask.hpp"
|
2014-11-13 10:12:20 +00:00
|
|
|
#include "editmode.hpp"
|
2015-09-27 14:18:22 +00:00
|
|
|
#include "instancemode.hpp"
|
2014-03-06 09:01:23 +00:00
|
|
|
|
2014-06-29 12:19:10 +00:00
|
|
|
CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidget* parent)
|
2016-03-10 09:29:24 +00:00
|
|
|
: SceneWidget (document.getData().getResourceSystem(), parent, 0, false), mSceneElements(0), mRun(0), mDocument(document),
|
2016-01-21 15:08:04 +00:00
|
|
|
mInteractionMask (0), mEditMode (0), mLocked (false), mDragging (false), mDragX(0), mDragY(0), mDragFactor(0),
|
|
|
|
mDragWheelFactor(0), mDragShiftFactor(0),
|
|
|
|
mToolTipPos (-1, -1), mShowToolTips(false), mToolTipDelay(0)
|
2014-03-10 17:35:49 +00:00
|
|
|
{
|
2014-06-29 12:19:10 +00:00
|
|
|
setAcceptDrops(true);
|
2014-03-10 17:35:49 +00:00
|
|
|
|
2014-06-29 12:19:10 +00:00
|
|
|
QAbstractItemModel *referenceables =
|
|
|
|
document.getData().getTableModel (CSMWorld::UniversalId::Type_Referenceables);
|
2014-05-01 13:09:47 +00:00
|
|
|
|
2014-06-29 12:19:10 +00:00
|
|
|
connect (referenceables, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
|
|
|
this, SLOT (referenceableDataChanged (const QModelIndex&, const QModelIndex&)));
|
|
|
|
connect (referenceables, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)),
|
|
|
|
this, SLOT (referenceableAboutToBeRemoved (const QModelIndex&, int, int)));
|
|
|
|
connect (referenceables, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
|
|
|
|
this, SLOT (referenceableAdded (const QModelIndex&, int, int)));
|
|
|
|
|
|
|
|
QAbstractItemModel *references =
|
|
|
|
document.getData().getTableModel (CSMWorld::UniversalId::Type_References);
|
|
|
|
|
|
|
|
connect (references, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
|
|
|
this, SLOT (referenceDataChanged (const QModelIndex&, const QModelIndex&)));
|
|
|
|
connect (references, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)),
|
|
|
|
this, SLOT (referenceAboutToBeRemoved (const QModelIndex&, int, int)));
|
|
|
|
connect (references, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
|
|
|
|
this, SLOT (referenceAdded (const QModelIndex&, int, int)));
|
2014-09-07 10:55:52 +00:00
|
|
|
|
|
|
|
QAbstractItemModel *debugProfiles =
|
|
|
|
document.getData().getTableModel (CSMWorld::UniversalId::Type_DebugProfiles);
|
|
|
|
|
|
|
|
connect (debugProfiles, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
|
|
|
this, SLOT (debugProfileDataChanged (const QModelIndex&, const QModelIndex&)));
|
|
|
|
connect (debugProfiles, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)),
|
|
|
|
this, SLOT (debugProfileAboutToBeRemoved (const QModelIndex&, int, int)));
|
2015-09-25 11:11:40 +00:00
|
|
|
|
2015-11-12 14:05:17 +00:00
|
|
|
mToolTipDelayTimer.setSingleShot (true);
|
|
|
|
connect (&mToolTipDelayTimer, SIGNAL (timeout()), this, SLOT (showToolTip()));
|
2016-03-10 09:29:24 +00:00
|
|
|
|
|
|
|
CSMPrefs::get()["3D Scene Input"].update();
|
|
|
|
CSMPrefs::get()["Tooltips"].update();
|
2014-10-28 13:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CSVRender::WorldspaceWidget::~WorldspaceWidget ()
|
|
|
|
{
|
2014-03-10 17:35:49 +00:00
|
|
|
}
|
2014-03-06 09:01:23 +00:00
|
|
|
|
2015-12-12 13:49:16 +00:00
|
|
|
void CSVRender::WorldspaceWidget::settingChanged (const CSMPrefs::Setting *setting)
|
|
|
|
{
|
|
|
|
if (*setting=="3D Scene Input/drag-factor")
|
|
|
|
mDragFactor = setting->toDouble();
|
|
|
|
else if (*setting=="3D Scene Input/drag-wheel-factor")
|
|
|
|
mDragWheelFactor = setting->toDouble();
|
|
|
|
else if (*setting=="3D Scene Input/drag-shift-factor")
|
|
|
|
mDragShiftFactor = setting->toDouble();
|
|
|
|
else if (*setting=="Tooltips/scene-delay")
|
|
|
|
mToolTipDelay = setting->toInt();
|
|
|
|
else if (*setting=="Tooltips/scene")
|
|
|
|
mShowToolTips = setting->isTrue();
|
2016-03-10 09:29:24 +00:00
|
|
|
else
|
|
|
|
SceneWidget::settingChanged(setting);
|
2015-12-12 13:49:16 +00:00
|
|
|
}
|
|
|
|
|
2014-03-06 09:01:23 +00:00
|
|
|
|
2014-04-01 08:04:14 +00:00
|
|
|
void CSVRender::WorldspaceWidget::useViewHint (const std::string& hint) {}
|
|
|
|
|
2014-03-06 09:01:23 +00:00
|
|
|
void CSVRender::WorldspaceWidget::selectDefaultNavigationMode()
|
|
|
|
{
|
2016-03-10 21:56:14 +00:00
|
|
|
selectNavigationMode("1st");
|
2014-03-06 09:01:23 +00:00
|
|
|
}
|
|
|
|
|
2014-07-08 10:39:12 +00:00
|
|
|
CSVWidget::SceneToolMode *CSVRender::WorldspaceWidget::makeNavigationSelector (
|
|
|
|
CSVWidget::SceneToolbar *parent)
|
2014-03-06 09:01:23 +00:00
|
|
|
{
|
2014-07-13 12:21:50 +00:00
|
|
|
CSVWidget::SceneToolMode *tool = new CSVWidget::SceneToolMode (parent, "Camera Mode");
|
2014-03-06 09:01:23 +00:00
|
|
|
|
2014-07-13 10:15:05 +00:00
|
|
|
/// \todo replace icons
|
|
|
|
/// \todo consider user-defined button-mapping
|
2014-07-30 15:02:23 +00:00
|
|
|
tool->addButton (":scenetoolbar/1st-person", "1st",
|
2014-07-13 10:15:05 +00:00
|
|
|
"First Person"
|
|
|
|
"<ul><li>Mouse-Look while holding the left button</li>"
|
|
|
|
"<li>WASD movement keys</li>"
|
2016-01-31 13:45:05 +00:00
|
|
|
"<li>Mouse wheel moves the camera forward/backward</li>"
|
|
|
|
"<li>Strafing (also vertically) by holding the left mouse button and control</li>"
|
2014-07-13 10:15:05 +00:00
|
|
|
"<li>Camera is held upright</li>"
|
|
|
|
"<li>Hold shift to speed up movement</li>"
|
|
|
|
"</ul>");
|
2014-07-30 15:02:23 +00:00
|
|
|
tool->addButton (":scenetoolbar/free-camera", "free",
|
2014-07-13 10:15:05 +00:00
|
|
|
"Free Camera"
|
|
|
|
"<ul><li>Mouse-Look while holding the left button</li>"
|
2016-01-31 13:45:05 +00:00
|
|
|
"<li>Strafing (also vertically) via WASD or by holding the left mouse button and control</li>"
|
|
|
|
"<li>Mouse wheel moves the camera forward/backward</li>"
|
2014-07-13 10:15:05 +00:00
|
|
|
"<li>Roll camera with Q and E keys</li>"
|
|
|
|
"<li>Hold shift to speed up movement</li>"
|
|
|
|
"</ul>");
|
2014-07-30 15:02:23 +00:00
|
|
|
tool->addButton (":scenetoolbar/orbiting-camera", "orbit",
|
2014-07-13 10:15:05 +00:00
|
|
|
"Orbiting Camera"
|
|
|
|
"<ul><li>Always facing the centre point</li>"
|
|
|
|
"<li>Rotate around the centre point via WASD or by moving the mouse while holding the left button</li>"
|
|
|
|
"<li>Mouse wheel moves camera away or towards centre point but can not pass through it</li>"
|
|
|
|
"<li>Roll camera with Q and E keys</li>"
|
2016-01-31 13:45:05 +00:00
|
|
|
"<li>Strafing (also vertically) by holding the left mouse button and control (includes relocation of the centre point)</li>"
|
2014-07-13 10:15:05 +00:00
|
|
|
"<li>Hold shift to speed up movement</li>"
|
|
|
|
"</ul>");
|
2014-03-06 09:01:23 +00:00
|
|
|
|
|
|
|
connect (tool, SIGNAL (modeChanged (const std::string&)),
|
|
|
|
this, SLOT (selectNavigationMode (const std::string&)));
|
|
|
|
|
|
|
|
return tool;
|
2014-05-01 13:09:47 +00:00
|
|
|
}
|
|
|
|
|
2014-11-28 08:14:02 +00:00
|
|
|
CSVWidget::SceneToolToggle2 *CSVRender::WorldspaceWidget::makeSceneVisibilitySelector (CSVWidget::SceneToolbar *parent)
|
2014-07-31 12:05:27 +00:00
|
|
|
{
|
2014-11-28 08:14:02 +00:00
|
|
|
mSceneElements = new CSVWidget::SceneToolToggle2 (parent,
|
|
|
|
"Scene Element Visibility", ":scenetoolbar/scene-view-c", ":scenetoolbar/scene-view-");
|
2014-07-31 12:05:27 +00:00
|
|
|
|
|
|
|
addVisibilitySelectorButtons (mSceneElements);
|
|
|
|
|
2016-01-06 13:34:39 +00:00
|
|
|
mSceneElements->setSelectionMask (0xffffffff);
|
2014-07-31 12:05:27 +00:00
|
|
|
|
|
|
|
connect (mSceneElements, SIGNAL (selectionChanged()),
|
|
|
|
this, SLOT (elementSelectionChanged()));
|
|
|
|
|
|
|
|
return mSceneElements;
|
|
|
|
}
|
|
|
|
|
2014-09-06 14:11:06 +00:00
|
|
|
CSVWidget::SceneToolRun *CSVRender::WorldspaceWidget::makeRunTool (
|
|
|
|
CSVWidget::SceneToolbar *parent)
|
|
|
|
{
|
|
|
|
CSMWorld::IdTable& debugProfiles = dynamic_cast<CSMWorld::IdTable&> (
|
|
|
|
*mDocument.getData().getTableModel (CSMWorld::UniversalId::Type_DebugProfiles));
|
|
|
|
|
|
|
|
std::vector<std::string> profiles;
|
|
|
|
|
|
|
|
int idColumn = debugProfiles.findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
|
|
|
int stateColumn = debugProfiles.findColumnIndex (CSMWorld::Columns::ColumnId_Modification);
|
|
|
|
int defaultColumn = debugProfiles.findColumnIndex (
|
|
|
|
CSMWorld::Columns::ColumnId_DefaultProfile);
|
|
|
|
|
|
|
|
int size = debugProfiles.rowCount();
|
|
|
|
|
|
|
|
for (int i=0; i<size; ++i)
|
|
|
|
{
|
|
|
|
int state = debugProfiles.data (debugProfiles.index (i, stateColumn)).toInt();
|
|
|
|
|
|
|
|
bool default_ = debugProfiles.data (debugProfiles.index (i, defaultColumn)).toInt();
|
|
|
|
|
|
|
|
if (state!=CSMWorld::RecordBase::State_Deleted && default_)
|
|
|
|
profiles.push_back (
|
|
|
|
debugProfiles.data (debugProfiles.index (i, idColumn)).
|
|
|
|
toString().toUtf8().constData());
|
|
|
|
}
|
|
|
|
|
|
|
|
std::sort (profiles.begin(), profiles.end());
|
|
|
|
|
|
|
|
mRun = new CSVWidget::SceneToolRun (parent, "Run OpenMW from the current camera position",
|
2014-11-27 08:27:29 +00:00
|
|
|
":scenetoolbar/play", profiles);
|
2014-09-06 14:11:06 +00:00
|
|
|
|
|
|
|
connect (mRun, SIGNAL (runRequest (const std::string&)),
|
|
|
|
this, SLOT (runRequest (const std::string&)));
|
|
|
|
|
|
|
|
return mRun;
|
|
|
|
}
|
|
|
|
|
2014-11-11 14:58:22 +00:00
|
|
|
CSVWidget::SceneToolMode *CSVRender::WorldspaceWidget::makeEditModeSelector (
|
|
|
|
CSVWidget::SceneToolbar *parent)
|
|
|
|
{
|
2015-09-27 12:38:12 +00:00
|
|
|
mEditMode = new CSVWidget::SceneToolMode (parent, "Edit Mode");
|
2014-11-11 14:58:22 +00:00
|
|
|
|
2015-09-27 12:38:12 +00:00
|
|
|
addEditModeSelectorButtons (mEditMode);
|
2014-11-11 14:58:22 +00:00
|
|
|
|
2015-09-27 12:38:12 +00:00
|
|
|
connect (mEditMode, SIGNAL (modeChanged (const std::string&)),
|
|
|
|
this, SLOT (editModeChanged (const std::string&)));
|
|
|
|
|
|
|
|
return mEditMode;
|
2014-11-11 14:58:22 +00:00
|
|
|
}
|
|
|
|
|
2014-09-11 09:27:56 +00:00
|
|
|
CSVRender::WorldspaceWidget::DropType CSVRender::WorldspaceWidget::getDropType (
|
2014-05-02 18:15:46 +00:00
|
|
|
const std::vector< CSMWorld::UniversalId >& data)
|
2014-05-01 13:09:47 +00:00
|
|
|
{
|
2014-09-11 09:27:56 +00:00
|
|
|
DropType output = Type_Other;
|
2014-05-01 13:09:47 +00:00
|
|
|
|
2014-09-11 09:27:56 +00:00
|
|
|
for (std::vector<CSMWorld::UniversalId>::const_iterator iter (data.begin());
|
|
|
|
iter!=data.end(); ++iter)
|
2014-05-01 13:09:47 +00:00
|
|
|
{
|
2014-09-11 09:27:56 +00:00
|
|
|
DropType type = Type_Other;
|
|
|
|
|
|
|
|
if (iter->getType()==CSMWorld::UniversalId::Type_Cell ||
|
|
|
|
iter->getType()==CSMWorld::UniversalId::Type_Cell_Missing)
|
2014-05-01 13:09:47 +00:00
|
|
|
{
|
2014-09-11 09:27:56 +00:00
|
|
|
type = iter->getId().substr (0, 1)=="#" ? Type_CellsExterior : Type_CellsInterior;
|
2014-05-01 13:09:47 +00:00
|
|
|
}
|
2014-09-13 16:54:29 +00:00
|
|
|
else if (iter->getType()==CSMWorld::UniversalId::Type_DebugProfile)
|
|
|
|
type = Type_DebugProfile;
|
2014-09-11 09:27:56 +00:00
|
|
|
|
|
|
|
if (iter==data.begin())
|
|
|
|
output = type;
|
|
|
|
else if (output!=type) // mixed types -> ignore
|
|
|
|
return Type_Other;
|
2014-05-01 13:09:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
2014-09-11 11:04:20 +00:00
|
|
|
CSVRender::WorldspaceWidget::dropRequirments
|
|
|
|
CSVRender::WorldspaceWidget::getDropRequirements (DropType type) const
|
|
|
|
{
|
2014-09-13 16:54:29 +00:00
|
|
|
if (type==Type_DebugProfile)
|
|
|
|
return canHandle;
|
|
|
|
|
2014-09-11 11:04:20 +00:00
|
|
|
return ignored;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSVRender::WorldspaceWidget::handleDrop (const std::vector<CSMWorld::UniversalId>& data,
|
|
|
|
DropType type)
|
|
|
|
{
|
2014-09-13 16:54:29 +00:00
|
|
|
if (type==Type_DebugProfile)
|
|
|
|
{
|
|
|
|
if (mRun)
|
|
|
|
{
|
|
|
|
for (std::vector<CSMWorld::UniversalId>::const_iterator iter (data.begin());
|
|
|
|
iter!=data.end(); ++iter)
|
|
|
|
mRun->addProfile (iter->getId());
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-11 11:04:20 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-11-09 10:29:45 +00:00
|
|
|
unsigned int CSVRender::WorldspaceWidget::getVisibilityMask() const
|
2014-07-31 12:05:27 +00:00
|
|
|
{
|
2016-01-06 13:34:39 +00:00
|
|
|
return mSceneElements->getSelectionMask();
|
2014-07-31 12:05:27 +00:00
|
|
|
}
|
|
|
|
|
2014-11-11 14:58:22 +00:00
|
|
|
void CSVRender::WorldspaceWidget::setInteractionMask (unsigned int mask)
|
|
|
|
{
|
2016-01-06 13:34:39 +00:00
|
|
|
mInteractionMask = mask | Mask_CellMarker | Mask_CellArrow;
|
2014-11-11 14:58:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int CSVRender::WorldspaceWidget::getInteractionMask() const
|
|
|
|
{
|
|
|
|
return mInteractionMask & getVisibilityMask();
|
|
|
|
}
|
|
|
|
|
2015-09-27 12:38:12 +00:00
|
|
|
void CSVRender::WorldspaceWidget::setEditLock (bool locked)
|
|
|
|
{
|
|
|
|
dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent()).setEditLock (locked);
|
2015-09-24 13:51:16 +00:00
|
|
|
}
|
|
|
|
|
2014-07-31 12:05:27 +00:00
|
|
|
void CSVRender::WorldspaceWidget::addVisibilitySelectorButtons (
|
2014-11-28 08:14:02 +00:00
|
|
|
CSVWidget::SceneToolToggle2 *tool)
|
2014-07-31 12:05:27 +00:00
|
|
|
{
|
2016-01-15 14:49:10 +00:00
|
|
|
tool->addButton (Button_Reference, Mask_Reference, "Instances");
|
|
|
|
tool->addButton (Button_Water, Mask_Water, "Water");
|
|
|
|
tool->addButton (Button_Pathgrid, Mask_Pathgrid, "Pathgrid");
|
2014-07-31 12:05:27 +00:00
|
|
|
}
|
|
|
|
|
2014-11-11 14:58:22 +00:00
|
|
|
void CSVRender::WorldspaceWidget::addEditModeSelectorButtons (CSVWidget::SceneToolMode *tool)
|
|
|
|
{
|
|
|
|
/// \todo replace EditMode with suitable subclasses
|
2015-09-27 14:18:22 +00:00
|
|
|
tool->addButton (new InstanceMode (this, tool), "object");
|
2014-11-11 14:58:22 +00:00
|
|
|
tool->addButton (
|
2016-01-06 13:34:39 +00:00
|
|
|
new EditMode (this, QIcon (":placeholder"), Mask_Pathgrid, "Pathgrid editing"),
|
2014-11-11 14:58:22 +00:00
|
|
|
"pathgrid");
|
|
|
|
}
|
|
|
|
|
2014-09-11 11:07:28 +00:00
|
|
|
CSMDoc::Document& CSVRender::WorldspaceWidget::getDocument()
|
|
|
|
{
|
|
|
|
return mDocument;
|
|
|
|
}
|
|
|
|
|
2016-01-10 07:56:15 +00:00
|
|
|
osg::Vec3f CSVRender::WorldspaceWidget::getIntersectionPoint (const QPoint& localPos,
|
|
|
|
unsigned int interactionMask, bool ignoreHidden) const
|
|
|
|
{
|
|
|
|
// (0,0) is considered the lower left corner of an OpenGL window
|
|
|
|
int x = localPos.x();
|
|
|
|
int y = height() - localPos.y();
|
|
|
|
|
|
|
|
osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector (
|
|
|
|
new osgUtil::LineSegmentIntersector (osgUtil::Intersector::WINDOW, x, y));
|
|
|
|
|
|
|
|
intersector->setIntersectionLimit (osgUtil::LineSegmentIntersector::NO_LIMIT);
|
|
|
|
osgUtil::IntersectionVisitor visitor (intersector);
|
|
|
|
|
|
|
|
unsigned int mask = interactionMask;
|
|
|
|
|
|
|
|
if (ignoreHidden)
|
|
|
|
mask &= getVisibilityMask();
|
|
|
|
|
2016-01-15 14:46:10 +00:00
|
|
|
visitor.setTraversalMask (mask);
|
2016-01-10 07:56:15 +00:00
|
|
|
|
|
|
|
mView->getCamera()->accept (visitor);
|
|
|
|
|
|
|
|
for (osgUtil::LineSegmentIntersector::Intersections::iterator iter = intersector->getIntersections().begin();
|
|
|
|
iter!=intersector->getIntersections().end(); ++iter)
|
|
|
|
{
|
|
|
|
// reject back-facing polygons
|
|
|
|
osg::Vec3f normal = osg::Matrix::transform3x3 (
|
|
|
|
iter->getWorldIntersectNormal(), mView->getCamera()->getViewMatrix());
|
|
|
|
|
|
|
|
if (normal.z()>=0)
|
|
|
|
return iter->getWorldIntersectPoint();
|
|
|
|
}
|
|
|
|
|
|
|
|
osg::Matrixd matrix;
|
|
|
|
matrix.preMult (mView->getCamera()->getViewport()->computeWindowMatrix());
|
|
|
|
matrix.preMult (mView->getCamera()->getProjectionMatrix());
|
|
|
|
matrix.preMult (mView->getCamera()->getViewMatrix());
|
|
|
|
matrix = osg::Matrixd::inverse (matrix);
|
|
|
|
|
|
|
|
osg::Vec3d start = matrix.preMult (intersector->getStart());
|
|
|
|
osg::Vec3d end = matrix.preMult (intersector->getEnd());
|
|
|
|
|
|
|
|
osg::Vec3d direction = end-start;
|
|
|
|
direction.normalize();
|
|
|
|
|
2016-01-11 08:03:02 +00:00
|
|
|
return start + direction * CSMPrefs::get()["Scene Drops"]["distance"].toInt();
|
2016-01-10 07:56:15 +00:00
|
|
|
}
|
|
|
|
|
2016-03-05 09:56:54 +00:00
|
|
|
void CSVRender::WorldspaceWidget::abortDrag()
|
|
|
|
{
|
|
|
|
if (mDragging)
|
|
|
|
{
|
|
|
|
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
|
|
|
|
|
|
|
editMode.dragAborted();
|
|
|
|
mDragging = false;
|
2016-03-05 10:14:08 +00:00
|
|
|
mDragMode.clear();
|
2016-03-05 09:56:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-01 13:09:47 +00:00
|
|
|
void CSVRender::WorldspaceWidget::dragEnterEvent (QDragEnterEvent* event)
|
|
|
|
{
|
2015-12-18 11:38:45 +00:00
|
|
|
const CSMWorld::TableMimeData* mime = dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData());
|
|
|
|
if (!mime) // May happen when non-records (e.g. plain text) are dragged and dropped
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (mime->fromDocument (mDocument))
|
|
|
|
{
|
|
|
|
if (mime->holdsType (CSMWorld::UniversalId::Type_Cell) ||
|
|
|
|
mime->holdsType (CSMWorld::UniversalId::Type_Cell_Missing) ||
|
|
|
|
mime->holdsType (CSMWorld::UniversalId::Type_DebugProfile))
|
|
|
|
{
|
|
|
|
// These drops are handled through the subview object.
|
|
|
|
event->accept();
|
|
|
|
}
|
2015-12-18 13:04:53 +00:00
|
|
|
else
|
|
|
|
dynamic_cast<EditMode&> (*mEditMode->getCurrent()).dragEnterEvent (event);
|
2015-12-18 11:38:45 +00:00
|
|
|
}
|
2014-05-01 13:09:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSVRender::WorldspaceWidget::dragMoveEvent(QDragMoveEvent *event)
|
|
|
|
{
|
2015-12-18 11:38:45 +00:00
|
|
|
const CSMWorld::TableMimeData* mime = dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData());
|
|
|
|
if (!mime) // May happen when non-records (e.g. plain text) are dragged and dropped
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (mime->fromDocument (mDocument))
|
|
|
|
{
|
|
|
|
if (mime->holdsType (CSMWorld::UniversalId::Type_Cell) ||
|
|
|
|
mime->holdsType (CSMWorld::UniversalId::Type_Cell_Missing) ||
|
|
|
|
mime->holdsType (CSMWorld::UniversalId::Type_DebugProfile))
|
|
|
|
{
|
|
|
|
// These drops are handled through the subview object.
|
|
|
|
event->accept();
|
|
|
|
}
|
2015-12-18 13:04:53 +00:00
|
|
|
else
|
|
|
|
dynamic_cast<EditMode&> (*mEditMode->getCurrent()).dragMoveEvent (event);
|
2015-12-18 11:38:45 +00:00
|
|
|
}
|
2014-05-01 13:09:47 +00:00
|
|
|
}
|
2014-05-03 12:00:30 +00:00
|
|
|
|
2015-12-12 13:49:16 +00:00
|
|
|
bool CSVRender::WorldspaceWidget::storeMappingSetting (const CSMPrefs::Setting *setting)
|
2015-09-25 11:11:40 +00:00
|
|
|
{
|
2015-12-12 13:49:16 +00:00
|
|
|
static const char * const sMappingSettings[] =
|
2015-09-25 11:11:40 +00:00
|
|
|
{
|
2015-12-12 13:49:16 +00:00
|
|
|
"p-edit", "s-edit",
|
|
|
|
"p-select", "s-select",
|
|
|
|
0
|
|
|
|
};
|
2015-09-25 11:11:40 +00:00
|
|
|
|
2016-03-10 09:29:24 +00:00
|
|
|
if (setting->getParent()->getKey()=="3D Scene Input")
|
|
|
|
{
|
|
|
|
for (int i=0; sMappingSettings[i]; ++i)
|
2015-12-12 13:49:16 +00:00
|
|
|
{
|
2016-03-10 09:29:24 +00:00
|
|
|
if (setting->getKey()==sMappingSettings[i])
|
|
|
|
{
|
|
|
|
QString value = QString::fromUtf8 (setting->toString().c_str());
|
2015-09-25 11:11:40 +00:00
|
|
|
|
2016-03-10 09:29:24 +00:00
|
|
|
Qt::MouseButton button = Qt::NoButton;
|
2015-09-25 11:11:40 +00:00
|
|
|
|
2016-03-10 09:29:24 +00:00
|
|
|
if (value.endsWith ("Left Mouse-Button"))
|
|
|
|
button = Qt::LeftButton;
|
|
|
|
else if (value.endsWith ("Right Mouse-Button"))
|
|
|
|
button = Qt::RightButton;
|
|
|
|
else if (value.endsWith ("Middle Mouse-Button"))
|
|
|
|
button = Qt::MiddleButton;
|
|
|
|
else
|
|
|
|
return false;
|
2015-09-25 11:11:40 +00:00
|
|
|
|
2016-03-10 09:29:24 +00:00
|
|
|
bool ctrl = value.startsWith ("Ctrl-");
|
2015-12-12 13:49:16 +00:00
|
|
|
|
2016-03-10 09:29:24 +00:00
|
|
|
mButtonMapping[std::make_pair (button, ctrl)] = sMappingSettings[i];
|
|
|
|
return true;
|
|
|
|
}
|
2015-12-12 13:49:16 +00:00
|
|
|
}
|
2016-03-10 09:29:24 +00:00
|
|
|
}
|
2015-09-25 11:11:40 +00:00
|
|
|
|
2016-03-10 09:29:24 +00:00
|
|
|
return SceneWidget::storeMappingSetting(setting);
|
2015-09-25 11:11:40 +00:00
|
|
|
}
|
|
|
|
|
2015-11-12 14:05:17 +00:00
|
|
|
osg::ref_ptr<CSVRender::TagBase> CSVRender::WorldspaceWidget::mousePick (const QPoint& localPos)
|
2015-09-26 15:51:41 +00:00
|
|
|
{
|
|
|
|
// (0,0) is considered the lower left corner of an OpenGL window
|
2015-11-12 14:05:17 +00:00
|
|
|
int x = localPos.x();
|
|
|
|
int y = height() - localPos.y();
|
2015-09-26 15:51:41 +00:00
|
|
|
|
|
|
|
osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector (new osgUtil::LineSegmentIntersector(osgUtil::Intersector::WINDOW, x, y));
|
|
|
|
|
|
|
|
intersector->setIntersectionLimit(osgUtil::LineSegmentIntersector::NO_LIMIT);
|
|
|
|
osgUtil::IntersectionVisitor visitor(intersector);
|
|
|
|
|
2016-01-06 13:34:39 +00:00
|
|
|
visitor.setTraversalMask(getInteractionMask());
|
2015-09-26 15:51:41 +00:00
|
|
|
|
|
|
|
mView->getCamera()->accept(visitor);
|
|
|
|
|
|
|
|
for (osgUtil::LineSegmentIntersector::Intersections::iterator it = intersector->getIntersections().begin();
|
|
|
|
it != intersector->getIntersections().end(); ++it)
|
|
|
|
{
|
|
|
|
osgUtil::LineSegmentIntersector::Intersection intersection = *it;
|
|
|
|
|
|
|
|
// reject back-facing polygons
|
|
|
|
osg::Vec3f normal = intersection.getWorldIntersectNormal();
|
|
|
|
normal = osg::Matrix::transform3x3(normal, mView->getCamera()->getViewMatrix());
|
|
|
|
if (normal.z() < 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
for (std::vector<osg::Node*>::iterator it = intersection.nodePath.begin(); it != intersection.nodePath.end(); ++it)
|
|
|
|
{
|
|
|
|
osg::Node* node = *it;
|
|
|
|
if (osg::ref_ptr<CSVRender::TagBase> tag = dynamic_cast<CSVRender::TagBase *>(node->getUserData()))
|
|
|
|
return tag;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ignoring terrain for now
|
|
|
|
// must be terrain, report coordinates
|
|
|
|
// std::cout << "Terrain hit at " << intersection.getWorldIntersectPoint().x() << " " << intersection.getWorldIntersectPoint().y() << std::endl;
|
|
|
|
// return;
|
|
|
|
}
|
|
|
|
|
|
|
|
return osg::ref_ptr<CSVRender::TagBase>();
|
|
|
|
}
|
|
|
|
|
2014-05-03 12:00:30 +00:00
|
|
|
void CSVRender::WorldspaceWidget::dropEvent (QDropEvent* event)
|
|
|
|
{
|
|
|
|
const CSMWorld::TableMimeData* mime = dynamic_cast<const CSMWorld::TableMimeData*> (event->mimeData());
|
2014-06-26 18:49:22 +00:00
|
|
|
if (!mime) // May happen when non-records (e.g. plain text) are dragged and dropped
|
|
|
|
return;
|
2014-05-03 12:00:30 +00:00
|
|
|
|
|
|
|
if (mime->fromDocument (mDocument))
|
|
|
|
{
|
2015-12-18 11:38:45 +00:00
|
|
|
if (mime->holdsType (CSMWorld::UniversalId::Type_Cell) ||
|
|
|
|
mime->holdsType (CSMWorld::UniversalId::Type_Cell_Missing) ||
|
|
|
|
mime->holdsType (CSMWorld::UniversalId::Type_DebugProfile))
|
|
|
|
{
|
|
|
|
emit dataDropped(mime->getData());
|
|
|
|
}
|
2015-12-18 13:04:53 +00:00
|
|
|
else
|
|
|
|
dynamic_cast<EditMode&> (*mEditMode->getCurrent()).dropEvent (event);
|
2015-12-18 11:38:45 +00:00
|
|
|
}
|
2014-06-26 18:49:22 +00:00
|
|
|
}
|
2014-07-31 12:05:27 +00:00
|
|
|
|
2014-09-06 14:11:06 +00:00
|
|
|
void CSVRender::WorldspaceWidget::runRequest (const std::string& profile)
|
|
|
|
{
|
|
|
|
mDocument.startRunning (profile, getStartupInstruction());
|
|
|
|
}
|
|
|
|
|
2014-09-07 10:55:52 +00:00
|
|
|
void CSVRender::WorldspaceWidget::debugProfileDataChanged (const QModelIndex& topLeft,
|
|
|
|
const QModelIndex& bottomRight)
|
|
|
|
{
|
|
|
|
if (!mRun)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CSMWorld::IdTable& debugProfiles = dynamic_cast<CSMWorld::IdTable&> (
|
|
|
|
*mDocument.getData().getTableModel (CSMWorld::UniversalId::Type_DebugProfiles));
|
|
|
|
|
|
|
|
int idColumn = debugProfiles.findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
|
|
|
int stateColumn = debugProfiles.findColumnIndex (CSMWorld::Columns::ColumnId_Modification);
|
|
|
|
|
|
|
|
for (int i=topLeft.row(); i<=bottomRight.row(); ++i)
|
|
|
|
{
|
|
|
|
int state = debugProfiles.data (debugProfiles.index (i, stateColumn)).toInt();
|
|
|
|
|
|
|
|
// As of version 0.33 this case can not happen because debug profiles exist only in
|
|
|
|
// project or session scope, which means they will never be in deleted state. But we
|
|
|
|
// are adding the code for the sake of completeness and to avoid surprises if debug
|
|
|
|
// profile ever get extended to content scope.
|
|
|
|
if (state==CSMWorld::RecordBase::State_Deleted)
|
|
|
|
mRun->removeProfile (debugProfiles.data (
|
|
|
|
debugProfiles.index (i, idColumn)).toString().toUtf8().constData());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSVRender::WorldspaceWidget::debugProfileAboutToBeRemoved (const QModelIndex& parent,
|
|
|
|
int start, int end)
|
|
|
|
{
|
|
|
|
if (parent.isValid())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!mRun)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CSMWorld::IdTable& debugProfiles = dynamic_cast<CSMWorld::IdTable&> (
|
|
|
|
*mDocument.getData().getTableModel (CSMWorld::UniversalId::Type_DebugProfiles));
|
|
|
|
|
|
|
|
int idColumn = debugProfiles.findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
|
|
|
|
|
|
|
for (int i=start; i<=end; ++i)
|
|
|
|
{
|
|
|
|
mRun->removeProfile (debugProfiles.data (
|
|
|
|
debugProfiles.index (i, idColumn)).toString().toUtf8().constData());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-27 12:38:12 +00:00
|
|
|
void CSVRender::WorldspaceWidget::editModeChanged (const std::string& id)
|
|
|
|
{
|
|
|
|
dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent()).setEditLock (mLocked);
|
2015-10-01 10:46:01 +00:00
|
|
|
mDragging = false;
|
2016-03-05 10:14:08 +00:00
|
|
|
mDragMode.clear();
|
2015-09-27 12:38:12 +00:00
|
|
|
}
|
|
|
|
|
2015-11-12 14:05:17 +00:00
|
|
|
void CSVRender::WorldspaceWidget::showToolTip()
|
|
|
|
{
|
|
|
|
if (mShowToolTips)
|
|
|
|
{
|
|
|
|
QPoint pos = QCursor::pos();
|
|
|
|
|
|
|
|
if (osg::ref_ptr<TagBase> tag = mousePick (mapFromGlobal (pos)))
|
|
|
|
{
|
2015-12-12 13:49:16 +00:00
|
|
|
bool hideBasics = CSMPrefs::get()["Tooltips"]["scene-hide-basic"].isTrue();
|
2015-11-12 14:05:17 +00:00
|
|
|
QToolTip::showText (pos, tag->getToolTip (hideBasics), this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-31 12:05:27 +00:00
|
|
|
void CSVRender::WorldspaceWidget::elementSelectionChanged()
|
|
|
|
{
|
2015-03-25 23:27:39 +00:00
|
|
|
setVisibilityMask (getVisibilityMask());
|
2014-07-31 12:29:52 +00:00
|
|
|
flagAsModified();
|
2014-10-08 18:56:44 +00:00
|
|
|
updateOverlay();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSVRender::WorldspaceWidget::updateOverlay()
|
|
|
|
{
|
2014-07-31 12:34:25 +00:00
|
|
|
}
|
2014-10-28 13:50:48 +00:00
|
|
|
|
2014-10-28 23:43:55 +00:00
|
|
|
void CSVRender::WorldspaceWidget::mouseMoveEvent (QMouseEvent *event)
|
|
|
|
{
|
2016-03-10 09:29:24 +00:00
|
|
|
if (mDragging)
|
2015-10-01 10:46:01 +00:00
|
|
|
{
|
|
|
|
int diffX = event->x() - mDragX;
|
|
|
|
int diffY = (height() - event->y()) - mDragY;
|
|
|
|
|
|
|
|
mDragX = event->x();
|
|
|
|
mDragY = height() - event->y();
|
|
|
|
|
2015-10-01 11:42:21 +00:00
|
|
|
double factor = mDragFactor;
|
|
|
|
|
2015-10-27 14:43:52 +00:00
|
|
|
if (event->modifiers() & Qt::ShiftModifier)
|
2015-10-01 11:42:21 +00:00
|
|
|
factor *= mDragShiftFactor;
|
|
|
|
|
2015-10-01 10:46:01 +00:00
|
|
|
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
|
|
|
|
2015-10-01 11:42:21 +00:00
|
|
|
editMode.drag (diffX, diffY, factor);
|
2014-10-28 23:43:55 +00:00
|
|
|
}
|
2016-03-10 09:29:24 +00:00
|
|
|
else if (mDragMode=="p-edit" || mDragMode=="s-edit" || mDragMode=="p-select" || mDragMode=="s-select")
|
|
|
|
{
|
|
|
|
osg::ref_ptr<TagBase> tag = mousePick (event->pos());
|
|
|
|
|
|
|
|
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
|
|
|
|
|
|
|
if (mDragMode=="p-edit")
|
|
|
|
mDragging = editMode.primaryEditStartDrag (tag);
|
|
|
|
else if (mDragMode=="s-edit")
|
|
|
|
mDragging = editMode.secondaryEditStartDrag (tag);
|
|
|
|
else if (mDragMode=="p-select")
|
|
|
|
mDragging = editMode.primarySelectStartDrag (tag);
|
|
|
|
else if (mDragMode=="s-select")
|
|
|
|
mDragging = editMode.secondarySelectStartDrag (tag);
|
|
|
|
|
|
|
|
if (mDragging)
|
|
|
|
{
|
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
|
|
mDragX = event->localPos().x();
|
|
|
|
mDragY = height() - event->localPos().y();
|
|
|
|
#else
|
|
|
|
mDragX = event->posF().x();
|
|
|
|
mDragY = height() - event->posF().y();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (event->globalPos()!=mToolTipPos)
|
|
|
|
{
|
|
|
|
mToolTipPos = event->globalPos();
|
|
|
|
|
|
|
|
if (mShowToolTips)
|
|
|
|
mToolTipDelayTimer.start (mToolTipDelay);
|
|
|
|
}
|
|
|
|
|
|
|
|
SceneWidget::mouseMoveEvent(event);
|
|
|
|
}
|
2014-10-28 23:43:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CSVRender::WorldspaceWidget::mousePressEvent (QMouseEvent *event)
|
|
|
|
{
|
2015-09-26 16:01:49 +00:00
|
|
|
std::string button = mapButton (event);
|
2015-09-18 16:31:33 +00:00
|
|
|
|
2016-03-10 09:29:24 +00:00
|
|
|
if (button=="p-edit" || button=="s-edit" ||
|
|
|
|
button=="p-select" || button=="s-select")
|
|
|
|
{
|
|
|
|
if (!mDragging)
|
|
|
|
mDragMode = button;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
SceneWidget::mousePressEvent(event);
|
2014-10-28 23:43:55 +00:00
|
|
|
}
|
|
|
|
|
2014-10-28 13:50:48 +00:00
|
|
|
void CSVRender::WorldspaceWidget::mouseReleaseEvent (QMouseEvent *event)
|
|
|
|
{
|
2015-10-27 14:30:51 +00:00
|
|
|
std::string button = mapButton (event);
|
2016-03-10 09:29:24 +00:00
|
|
|
mDragMode.clear();
|
2015-10-27 14:30:51 +00:00
|
|
|
|
2016-03-10 09:29:24 +00:00
|
|
|
if (button=="p-edit" || button=="s-edit" ||
|
|
|
|
button=="p-select" || button=="s-select")
|
2014-10-28 13:50:48 +00:00
|
|
|
{
|
2016-03-10 09:29:24 +00:00
|
|
|
if (mDragging)
|
2015-10-01 10:46:01 +00:00
|
|
|
{
|
|
|
|
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
|
|
|
|
|
|
|
editMode.dragCompleted();
|
|
|
|
mDragging = false;
|
2014-10-28 23:43:55 +00:00
|
|
|
}
|
2016-03-10 09:29:24 +00:00
|
|
|
else
|
2015-10-27 14:30:51 +00:00
|
|
|
{
|
2015-11-12 14:05:17 +00:00
|
|
|
osg::ref_ptr<TagBase> tag = mousePick (event->pos());
|
2015-10-27 14:30:51 +00:00
|
|
|
|
2015-10-27 14:43:52 +00:00
|
|
|
handleMouseClick (tag, button, event->modifiers() & Qt::ShiftModifier);
|
2015-10-27 14:30:51 +00:00
|
|
|
}
|
|
|
|
}
|
2016-03-10 09:29:24 +00:00
|
|
|
else
|
|
|
|
SceneWidget::mouseReleaseEvent(event);
|
2014-10-28 13:50:48 +00:00
|
|
|
}
|
|
|
|
|
2014-10-28 23:43:55 +00:00
|
|
|
void CSVRender::WorldspaceWidget::wheelEvent (QWheelEvent *event)
|
|
|
|
{
|
2015-10-01 11:19:48 +00:00
|
|
|
if (mDragging)
|
|
|
|
{
|
2015-10-01 11:42:21 +00:00
|
|
|
double factor = mDragWheelFactor;
|
|
|
|
|
2015-10-27 14:43:52 +00:00
|
|
|
if (event->modifiers() & Qt::ShiftModifier)
|
2015-10-01 11:42:21 +00:00
|
|
|
factor *= mDragShiftFactor;
|
|
|
|
|
2015-10-01 11:19:48 +00:00
|
|
|
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
|
|
|
|
2015-10-01 11:42:21 +00:00
|
|
|
editMode.dragWheel (event->delta(), factor);
|
2015-10-01 11:19:48 +00:00
|
|
|
}
|
2016-03-10 09:29:24 +00:00
|
|
|
else
|
|
|
|
SceneWidget::wheelEvent(event);
|
2014-10-29 12:02:38 +00:00
|
|
|
}
|
2014-11-03 10:24:47 +00:00
|
|
|
|
|
|
|
void CSVRender::WorldspaceWidget::keyPressEvent (QKeyEvent *event)
|
|
|
|
{
|
|
|
|
if(event->key() == Qt::Key_Escape)
|
|
|
|
{
|
2016-03-05 09:56:54 +00:00
|
|
|
abortDrag();
|
2014-11-03 10:24:47 +00:00
|
|
|
}
|
|
|
|
else
|
2016-03-14 03:51:44 +00:00
|
|
|
SceneWidget::keyPressEvent(event);
|
2014-11-03 10:24:47 +00:00
|
|
|
}
|
2015-10-25 14:16:22 +00:00
|
|
|
|
2015-10-27 14:43:52 +00:00
|
|
|
void CSVRender::WorldspaceWidget::handleMouseClick (osg::ref_ptr<TagBase> tag, const std::string& button, bool shift)
|
2015-10-25 14:16:22 +00:00
|
|
|
{
|
|
|
|
EditMode& editMode = dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent());
|
|
|
|
|
|
|
|
if (button=="p-edit")
|
|
|
|
editMode.primaryEditPressed (tag);
|
|
|
|
else if (button=="s-edit")
|
|
|
|
editMode.secondaryEditPressed (tag);
|
2015-10-29 10:20:06 +00:00
|
|
|
else if (button=="p-select")
|
|
|
|
editMode.primarySelectPressed (tag);
|
|
|
|
else if (button=="s-select")
|
|
|
|
editMode.secondarySelectPressed (tag);
|
2015-10-25 14:16:22 +00:00
|
|
|
}
|
2016-03-01 14:48:34 +00:00
|
|
|
|
|
|
|
CSVRender::EditMode *CSVRender::WorldspaceWidget::getEditMode()
|
|
|
|
{
|
|
|
|
return dynamic_cast<CSVRender::EditMode *> (mEditMode->getCurrent());
|
|
|
|
}
|