2015-09-27 14:18:22 +00:00
|
|
|
|
|
|
|
#include "instancemode.hpp"
|
|
|
|
|
2015-12-15 09:40:00 +00:00
|
|
|
#include "../../model/prefs/state.hpp"
|
2015-09-29 14:07:14 +00:00
|
|
|
|
2015-09-27 14:18:22 +00:00
|
|
|
#include "elements.hpp"
|
|
|
|
#include "object.hpp"
|
2015-09-29 11:53:47 +00:00
|
|
|
#include "worldspacewidget.hpp"
|
2015-09-27 14:18:22 +00:00
|
|
|
|
|
|
|
CSVRender::InstanceMode::InstanceMode (WorldspaceWidget *worldspaceWidget, QWidget *parent)
|
|
|
|
: EditMode (worldspaceWidget, QIcon (":placeholder"), Element_Reference, "Instance editing",
|
2015-12-15 09:40:00 +00:00
|
|
|
parent)
|
2015-09-27 14:18:22 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-09-29 14:07:14 +00:00
|
|
|
void CSVRender::InstanceMode::primaryEditPressed (osg::ref_ptr<TagBase> tag)
|
2015-09-27 14:18:22 +00:00
|
|
|
{
|
2015-12-15 09:40:00 +00:00
|
|
|
if (CSMPrefs::get()["3D Scene Input"]["context-select"].isTrue())
|
2015-10-29 10:20:06 +00:00
|
|
|
primarySelectPressed (tag);
|
2015-09-29 14:07:14 +00:00
|
|
|
}
|
2015-09-27 14:18:22 +00:00
|
|
|
|
2015-09-29 14:07:14 +00:00
|
|
|
void CSVRender::InstanceMode::secondaryEditPressed (osg::ref_ptr<TagBase> tag)
|
|
|
|
{
|
2015-12-15 09:40:00 +00:00
|
|
|
if (CSMPrefs::get()["3D Scene Input"]["context-select"].isTrue())
|
2015-10-29 10:20:06 +00:00
|
|
|
secondarySelectPressed (tag);
|
2015-09-27 14:18:22 +00:00
|
|
|
}
|
|
|
|
|
2015-10-29 10:20:06 +00:00
|
|
|
void CSVRender::InstanceMode::primarySelectPressed (osg::ref_ptr<TagBase> tag)
|
|
|
|
{
|
2015-10-29 10:27:01 +00:00
|
|
|
getWorldspaceWidget().clearSelection (Element_Reference);
|
|
|
|
|
2015-10-29 10:20:06 +00:00
|
|
|
if (tag)
|
|
|
|
{
|
|
|
|
if (CSVRender::ObjectTag *objectTag = dynamic_cast<CSVRender::ObjectTag *> (tag.get()))
|
|
|
|
{
|
2015-10-29 10:27:01 +00:00
|
|
|
// hit an Object, select it
|
2015-10-29 10:20:06 +00:00
|
|
|
CSVRender::Object* object = objectTag->mObject;
|
2015-10-29 10:27:01 +00:00
|
|
|
object->setSelected (true);
|
2015-10-29 10:20:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSVRender::InstanceMode::secondarySelectPressed (osg::ref_ptr<TagBase> tag)
|
2015-09-27 14:18:22 +00:00
|
|
|
{
|
|
|
|
if (tag)
|
|
|
|
{
|
|
|
|
if (CSVRender::ObjectTag *objectTag = dynamic_cast<CSVRender::ObjectTag *> (tag.get()))
|
|
|
|
{
|
|
|
|
// hit an Object, toggle its selection state
|
|
|
|
CSVRender::Object* object = objectTag->mObject;
|
|
|
|
object->setSelected (!object->getSelected());
|
2015-09-29 11:53:47 +00:00
|
|
|
return;
|
2015-09-27 14:18:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|