From 72bb33c2c479ef82eebe5c07450c0f4388848891 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 26 Sep 2015 12:24:41 +0200 Subject: [PATCH] filter mouse interaction by interaction mask --- apps/opencs/view/render/worldspacewidget.cpp | 21 ++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/opencs/view/render/worldspacewidget.cpp b/apps/opencs/view/render/worldspacewidget.cpp index 378b5bea9..246f6a4bf 100644 --- a/apps/opencs/view/render/worldspacewidget.cpp +++ b/apps/opencs/view/render/worldspacewidget.cpp @@ -463,18 +463,27 @@ void CSVRender::WorldspaceWidget::mousePressEvent (QMouseEvent *event) for (std::vector::iterator it = intersection.nodePath.begin(); it != intersection.nodePath.end(); ++it) { osg::Node* node = *it; - if (CSVRender::ObjectTag* holder = dynamic_cast(node->getUserData())) + if (CSVRender::TagBase* tag = dynamic_cast(node->getUserData())) { - // hit an Object, toggle its selection state - CSVRender::Object* obj = holder->mObject; - obj->setSelected(!obj->getSelected()); + if (!(tag->getElement() && mInteractionMask)) + break; // not interested -> continue looking + + // hit something marked with a tag + if (CSVRender::ObjectTag *objectTag = dynamic_cast (tag)) + { + // hit an Object, toggle its selection state + CSVRender::Object* object = objectTag->mObject; + object->setSelected (!object->getSelected()); + } + return; } } +// ignoring terrain for now // must be terrain, report coordinates - std::cout << "Terrain hit at " << intersection.getWorldIntersectPoint().x() << " " << intersection.getWorldIntersectPoint().y() << std::endl; - return; +// std::cout << "Terrain hit at " << intersection.getWorldIntersectPoint().x() << " " << intersection.getWorldIntersectPoint().y() << std::endl; +// return; } }