diff --git a/apps/opencs/view/render/instancemode.cpp b/apps/opencs/view/render/instancemode.cpp index d31327137..e8a7d95d7 100644 --- a/apps/opencs/view/render/instancemode.cpp +++ b/apps/opencs/view/render/instancemode.cpp @@ -27,7 +27,8 @@ int CSVRender::InstanceMode::getSubModeFromId (const std::string& id) const CSVRender::InstanceMode::InstanceMode (WorldspaceWidget *worldspaceWidget, QWidget *parent) : EditMode (worldspaceWidget, QIcon (":placeholder"), Mask_Reference, "Instance editing", - parent), mSubMode (0), mSelectionMode (0), mDragMode (DragMode_None), mDragAxis (-1) + parent), mSubMode (0), mSelectionMode (0), mDragMode (DragMode_None), mDragAxis (-1), + mLocked (false) { } @@ -90,6 +91,12 @@ void CSVRender::InstanceMode::deactivate (CSVWidget::SceneToolbar *toolbar) EditMode::deactivate (toolbar); } +void CSVRender::InstanceMode::setEditLock (bool locked) +{ + mLocked = locked; + +} + void CSVRender::InstanceMode::primaryEditPressed (osg::ref_ptr tag) { if (CSMPrefs::get()["3D Scene Input"]["context-select"].isTrue()) @@ -134,7 +141,7 @@ void CSVRender::InstanceMode::secondarySelectPressed (osg::ref_ptr tag) bool CSVRender::InstanceMode::primaryEditStartDrag (osg::ref_ptr tag) { - if (mDragMode!=DragMode_None) + if (mDragMode!=DragMode_None || mLocked) return false; if (tag && CSMPrefs::get()["3D Scene Input"]["context-select"].isTrue()) @@ -178,6 +185,8 @@ bool CSVRender::InstanceMode::primaryEditStartDrag (osg::ref_ptr tag) bool CSVRender::InstanceMode::secondaryEditStartDrag (osg::ref_ptr tag) { + if (mLocked) + return false; return false; } diff --git a/apps/opencs/view/render/instancemode.hpp b/apps/opencs/view/render/instancemode.hpp index 94bdbb08f..20b685916 100644 --- a/apps/opencs/view/render/instancemode.hpp +++ b/apps/opencs/view/render/instancemode.hpp @@ -26,6 +26,7 @@ namespace CSVRender InstanceSelectionMode *mSelectionMode; DragMode mDragMode; int mDragAxis; + bool mLocked; int getSubModeFromId (const std::string& id) const; @@ -37,6 +38,8 @@ namespace CSVRender virtual void deactivate (CSVWidget::SceneToolbar *toolbar); + virtual void setEditLock (bool locked); + virtual void primaryEditPressed (osg::ref_ptr tag); virtual void secondaryEditPressed (osg::ref_ptr tag);