Commit 6e995a62 authored by Jan Möbius's avatar Jan Möbius

Use shift+Mousewheel to shrink or grow vertex and face selections on meshes. (...

Use shift+Mousewheel to shrink or grow vertex and face selections on meshes. ( Thanks to Vladimir Chalupecky for the code)



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15912 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 7e9bc81c
......@@ -1620,6 +1620,57 @@ void MeshObjectSelectionPlugin::slotKeyShortcutEvent(int _key, Qt::KeyboardModif
}
}
void MeshObjectSelectionPlugin::slotMouseWheelEvent(QWheelEvent* event, std::string const& mode) {
// Get currently active primitive type
SelectionInterface::PrimitiveType type = 0u;
emit getActivePrimitiveType(type);
// Only handle supported primitive types
if((type & allSupportedTypes_) == 0) {
// No supported type is active
return;
}
// Decide, if all or only target objects should be handled
bool targetsOnly = false;
emit targetObjectsOnly(targetsOnly);
PluginFunctions::IteratorRestriction restriction =
(targetsOnly ? PluginFunctions::TARGET_OBJECTS : PluginFunctions::ALL_OBJECTS);
if(event->modifiers() == Qt::ShiftModifier) {
if (event->delta() > 0) {
for (PluginFunctions::ObjectIterator o_it(restriction, DataType(DATA_TRIANGLE_MESH | DATA_POLY_MESH));
o_it != PluginFunctions::objectsEnd(); ++o_it) {
if (o_it->visible()) {
if(type & vertexType_)
growVertexSelection(o_it->id());
if(type & faceType_)
growFaceSelection(o_it->id());
}
emit updatedObject(o_it->id(), UPDATE_SELECTION);
emit createBackup(o_it->id(), "Grow Selection", UPDATE_SELECTION);
}
} else {
for (PluginFunctions::ObjectIterator o_it(restriction, DataType(DATA_TRIANGLE_MESH | DATA_POLY_MESH));
o_it != PluginFunctions::objectsEnd(); ++o_it) {
if (o_it->visible()) {
if(type & vertexType_)
shrinkVertexSelection(o_it->id());
if(type & faceType_)
shrinkFaceSelection(o_it->id());
}
emit updatedObject(o_it->id(), UPDATE_SELECTION);
emit createBackup(o_it->id(), "Shrink Selection", UPDATE_SELECTION);
}
}
}
}
void MeshObjectSelectionPlugin::lassoSelect(QRegion& _region,
PrimitiveType _primitiveType,
bool _deselection) {
......
......@@ -47,6 +47,7 @@
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/KeyInterface.hh>
#include <OpenFlipper/BasePlugin/MouseInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
#include <OpenFlipper/BasePlugin/ToolbarInterface.hh>
......@@ -66,11 +67,13 @@
#include "ConversionDialog.hh"
class MeshObjectSelectionPlugin : public QObject, BaseInterface, KeyInterface, LoadSaveInterface,
INIInterface, BackupInterface, ScriptInterface, LoggingInterface, SelectionInterface
INIInterface, BackupInterface, ScriptInterface, LoggingInterface, SelectionInterface,
MouseInterface
{
Q_OBJECT
Q_INTERFACES(BaseInterface)
Q_INTERFACES(KeyInterface)
Q_INTERFACES(MouseInterface)
Q_INTERFACES(INIInterface)
Q_INTERFACES(BackupInterface)
Q_INTERFACES(ScriptInterface)
......@@ -163,6 +166,9 @@ private slots:
void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers);
// MouseInterface
void slotMouseWheelEvent(QWheelEvent* event, std::string const& mode);
public:
// BaseInterface
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment