diff --git a/apps/opencs/view/render/instancemode.cpp b/apps/opencs/view/render/instancemode.cpp
index b6430036b..449d9d7a6 100644
--- a/apps/opencs/view/render/instancemode.cpp
+++ b/apps/opencs/view/render/instancemode.cpp
@@ -9,6 +9,9 @@
#include "../../model/world/idtree.hpp"
#include "../../model/world/commands.hpp"
+#include "../widget/scenetoolbar.hpp"
+#include "../widget/scenetoolmode.hpp"
+
#include "elements.hpp"
#include "object.hpp"
#include "worldspacewidget.hpp"
@@ -16,9 +19,47 @@
CSVRender::InstanceMode::InstanceMode (WorldspaceWidget *worldspaceWidget, QWidget *parent)
: EditMode (worldspaceWidget, QIcon (":placeholder"), Element_Reference, "Instance editing",
- parent)
+ parent), mSubMode (0)
+{
+}
+
+void CSVRender::InstanceMode::activate (CSVWidget::SceneToolbar *toolbar)
+{
+ if (!mSubMode)
+ {
+ mSubMode = new CSVWidget::SceneToolMode (toolbar, "Edit Sub-Mode");
+ mSubMode->addButton (":placeholder", "move",
+ "Move selected instances"
+ "
- Use primary edit to move instances around freely
"
+ "- Use secondary edit to move instances around within the grid
"
+ "
"
+ "Not implemented yet");
+ mSubMode->addButton (":placeholder", "rotate",
+ "Rotate selected instances"
+ "- Use primary edit to rotate instances freely
"
+ "- Use secondary edit to rotate instances within the grid
"
+ "
"
+ "Not implemented yet");
+ mSubMode->addButton (":placeholder", "scale",
+ "Scale selected instances"
+ "- Use primary edit to scale instances freely
"
+ "- Use secondary edit to scale instances along the grid
"
+ "
"
+ "Not implemented yet");
+ }
+
+ EditMode::activate (toolbar);
+
+ toolbar->addTool (mSubMode);
+}
+
+void CSVRender::InstanceMode::deactivate (CSVWidget::SceneToolbar *toolbar)
{
+ toolbar->removeTool (mSubMode);
+ delete mSubMode;
+ mSubMode = 0;
+ EditMode::deactivate (toolbar);
}
void CSVRender::InstanceMode::primaryEditPressed (osg::ref_ptr tag)
diff --git a/apps/opencs/view/render/instancemode.hpp b/apps/opencs/view/render/instancemode.hpp
index 7649c241c..1eec62874 100644
--- a/apps/opencs/view/render/instancemode.hpp
+++ b/apps/opencs/view/render/instancemode.hpp
@@ -3,16 +3,26 @@
#include "editmode.hpp"
+namespace CSVWidget
+{
+ class SceneToolMode;
+}
+
namespace CSVRender
{
class InstanceMode : public EditMode
{
Q_OBJECT
+ CSVWidget::SceneToolMode *mSubMode;
public:
InstanceMode (WorldspaceWidget *worldspaceWidget, QWidget *parent = 0);
+ virtual void activate (CSVWidget::SceneToolbar *toolbar);
+
+ virtual void deactivate (CSVWidget::SceneToolbar *toolbar);
+
virtual void primaryEditPressed (osg::ref_ptr tag);
virtual void secondaryEditPressed (osg::ref_ptr tag);
diff --git a/apps/opencs/view/world/scenesubview.cpp b/apps/opencs/view/world/scenesubview.cpp
index 44fe94d84..7014b1486 100644
--- a/apps/opencs/view/world/scenesubview.cpp
+++ b/apps/opencs/view/world/scenesubview.cpp
@@ -122,7 +122,7 @@ CSVWidget::SceneToolbar* CSVWorld::SceneSubView::makeToolbar (CSVRender::Worldsp
CSVWidget::SceneToolRun *runTool = widget->makeRunTool (toolbar);
toolbar->addTool (runTool);
- toolbar->addTool (widget->makeEditModeSelector (toolbar));
+ toolbar->addTool (widget->makeEditModeSelector (toolbar), runTool);
return toolbar;
}