diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp
index 67b61722f..c8d70a85f 100644
--- a/src/Gui/CommandView.cpp
+++ b/src/Gui/CommandView.cpp
@@ -1054,6 +1054,54 @@ void StdCmdViewAxo::activated(int iMsg)
doCommand(Command::Gui,"Gui.activeDocument().activeView().viewAxometric()");
}
+//===========================================================================
+// Std_ViewRotateLeft
+//===========================================================================
+DEF_3DV_CMD(StdCmdViewRotateLeft);
+
+StdCmdViewRotateLeft::StdCmdViewRotateLeft()
+ : Command("Std_ViewRotateLeft")
+{
+ sGroup = QT_TR_NOOP("Standard-View");
+ sMenuText = QT_TR_NOOP("Rotate Left");
+ sToolTipText = QT_TR_NOOP("Rotate the view by 90° counter-clockwise");
+ sWhatsThis = "Std_ViewXX";
+ sStatusTip = QT_TR_NOOP("Rotate the view by 90° counter-clockwise");
+ sPixmap = "view-rotate-left";
+ //sAccel = "Shift Left";
+ eType = Alter3DView;
+}
+
+void StdCmdViewRotateLeft::activated(int iMsg)
+{
+ doCommand(Command::Gui,"Gui.activeDocument().activeView().viewRotateLeft()");
+}
+
+
+//===========================================================================
+// Std_ViewRotateRight
+//===========================================================================
+DEF_3DV_CMD(StdCmdViewRotateRight);
+
+StdCmdViewRotateRight::StdCmdViewRotateRight()
+ : Command("Std_ViewRotateRight")
+{
+ sGroup = QT_TR_NOOP("Standard-View");
+ sMenuText = QT_TR_NOOP("Rotate Right");
+ sToolTipText = QT_TR_NOOP("Rotate the view by 90° clockwise");
+ sWhatsThis = "Std_ViewXX";
+ sStatusTip = QT_TR_NOOP("Rotate the view by 90° clockwise");
+ sPixmap = "view-rotate-right";
+ //sAccel = "Shift Right";
+ eType = Alter3DView;
+}
+
+void StdCmdViewRotateRight::activated(int iMsg)
+{
+ doCommand(Command::Gui,"Gui.activeDocument().activeView().viewRotateRight()");
+}
+
+
//===========================================================================
// Std_ViewFitAll
//===========================================================================
@@ -2030,6 +2078,8 @@ void CreateViewStdCommands(void)
rcCmdMgr.addCommand(new StdCmdViewAxo());
rcCmdMgr.addCommand(new StdCmdViewFitAll());
rcCmdMgr.addCommand(new StdCmdViewFitSelection());
+ rcCmdMgr.addCommand(new StdCmdViewRotateLeft());
+ rcCmdMgr.addCommand(new StdCmdViewRotateRight());
rcCmdMgr.addCommand(new StdCmdViewExample1());
rcCmdMgr.addCommand(new StdCmdViewExample2());
diff --git a/src/Gui/Icons/Makefile.am b/src/Gui/Icons/Makefile.am
index 9366066f5..70c30f0f4 100644
--- a/src/Gui/Icons/Makefile.am
+++ b/src/Gui/Icons/Makefile.am
@@ -86,6 +86,8 @@ EXTRA_DIST = \
view-zoom-in.svg \
view-zoom-out.svg \
view-zoom-selection.svg \
+ view-rotate-left.svg \
+ view-rotate-right.svg \
Tree_Annotation.svg \
Tree_Dimension.svg \
Tree_Python.svg \
diff --git a/src/Gui/Icons/resource.qrc b/src/Gui/Icons/resource.qrc
index f64cb89bd..78a314d16 100644
--- a/src/Gui/Icons/resource.qrc
+++ b/src/Gui/Icons/resource.qrc
@@ -68,6 +68,8 @@
view-zoom-fit.svg
view-zoom-in.svg
view-zoom-out.svg
+ view-rotate-left.svg
+ view-rotate-right.svg
view-measurement.svg
view-zoom-selection.svg
Tree_Annotation.svg
diff --git a/src/Gui/Icons/view-rotate-left.svg b/src/Gui/Icons/view-rotate-left.svg
new file mode 100644
index 000000000..71f10ca01
--- /dev/null
+++ b/src/Gui/Icons/view-rotate-left.svg
@@ -0,0 +1,230 @@
+
+
+
+
diff --git a/src/Gui/Icons/view-rotate-right.svg b/src/Gui/Icons/view-rotate-right.svg
new file mode 100644
index 000000000..4cbb4fc6b
--- /dev/null
+++ b/src/Gui/Icons/view-rotate-right.svg
@@ -0,0 +1,242 @@
+
+
+
+
diff --git a/src/Gui/View3DPy.cpp b/src/Gui/View3DPy.cpp
index 9ef5e9ccb..b1e1e51a6 100644
--- a/src/Gui/View3DPy.cpp
+++ b/src/Gui/View3DPy.cpp
@@ -76,6 +76,8 @@ void View3DInventorPy::init_type()
add_varargs_method("viewRight",&View3DInventorPy::viewRight,"viewRight()");
add_varargs_method("viewTop",&View3DInventorPy::viewTop,"viewTop()");
add_varargs_method("viewAxometric",&View3DInventorPy::viewAxometric,"viewAxometric()");
+ add_varargs_method("viewRotateLeft",&View3DInventorPy::viewRotateLeft,"viewRotateLeft()");
+ add_varargs_method("viewRotateRight",&View3DInventorPy::viewRotateRight,"viewRotateRight()");
add_varargs_method("viewPosition",&View3DInventorPy::viewPosition,"viewPosition()");
add_varargs_method("startAnimating",&View3DInventorPy::startAnimating,"startAnimating()");
add_varargs_method("stopAnimating",&View3DInventorPy::stopAnimating,"stopAnimating()");
@@ -407,6 +409,58 @@ Py::Object View3DInventorPy::viewAxometric(const Py::Tuple& args)
return Py::None();
}
+Py::Object View3DInventorPy::viewRotateLeft(const Py::Tuple& args)
+{
+ if (!PyArg_ParseTuple(args.ptr(), ""))
+ throw Py::Exception();
+
+ try {
+ SoCamera* cam = _view->getViewer()->getCamera();
+ SbRotation rot = cam->orientation.getValue();
+ SbVec3f vdir(0, 0, -1);
+ rot.multVec(vdir, vdir);
+ SbRotation nrot(vdir, M_PI/2);
+ cam->orientation.setValue(rot*nrot);
+ }
+ catch (const Base::Exception& e) {
+ throw Py::Exception(e.what());
+ }
+ catch (const std::exception& e) {
+ throw Py::Exception(e.what());
+ }
+ catch(...) {
+ throw Py::Exception("Unknown C++ exception");
+ }
+
+ return Py::None();
+}
+
+Py::Object View3DInventorPy::viewRotateRight(const Py::Tuple& args)
+{
+ if (!PyArg_ParseTuple(args.ptr(), ""))
+ throw Py::Exception();
+
+ try {
+ SoCamera* cam = _view->getViewer()->getCamera();
+ SbRotation rot = cam->orientation.getValue();
+ SbVec3f vdir(0, 0, -1);
+ rot.multVec(vdir, vdir);
+ SbRotation nrot(vdir, -M_PI/2);
+ cam->orientation.setValue(rot*nrot);
+ }
+ catch (const Base::Exception& e) {
+ throw Py::Exception(e.what());
+ }
+ catch (const std::exception& e) {
+ throw Py::Exception(e.what());
+ }
+ catch(...) {
+ throw Py::Exception("Unknown C++ exception");
+ }
+
+ return Py::None();
+}
+
Py::Object View3DInventorPy::setCameraOrientation(const Py::Tuple& args)
{
PyObject* o;
diff --git a/src/Gui/View3DPy.h b/src/Gui/View3DPy.h
index 3e9e1218b..43fd65318 100644
--- a/src/Gui/View3DPy.h
+++ b/src/Gui/View3DPy.h
@@ -55,6 +55,8 @@ public:
Py::Object viewTop(const Py::Tuple&);
Py::Object viewAxometric(const Py::Tuple&);
Py::Object viewPosition(const Py::Tuple&);
+ Py::Object viewRotateLeft(const Py::Tuple&);
+ Py::Object viewRotateRight(const Py::Tuple&);
Py::Object startAnimating(const Py::Tuple&);
Py::Object stopAnimating(const Py::Tuple&);
Py::Object setAnimationEnabled(const Py::Tuple&);
diff --git a/src/Gui/Workbench.cpp b/src/Gui/Workbench.cpp
index e173b22e2..b3e1115d0 100644
--- a/src/Gui/Workbench.cpp
+++ b/src/Gui/Workbench.cpp
@@ -395,7 +395,8 @@ void StdWorkbench::setupContextMenu(const char* recipient, MenuItem* item) const
StdViews->setCommand( "Standard views" );
*StdViews << "Std_ViewAxo" << "Separator" << "Std_ViewFront" << "Std_ViewTop" << "Std_ViewRight"
- << "Std_ViewRear" << "Std_ViewBottom" << "Std_ViewLeft";
+ << "Std_ViewRear" << "Std_ViewBottom" << "Std_ViewLeft"
+ << "Separator" << "Std_ViewRotateLeft" << "Std_ViewRotateRight";
*item << "Std_ViewFitAll" << "Std_ViewFitSelection" << StdViews
<< "Separator" << "Std_ViewDockUndockFullscreen";
@@ -447,7 +448,8 @@ MenuItem* StdWorkbench::setupMenuBar() const
*stdviews << "Std_ViewFitAll" << "Std_ViewFitSelection" << "Std_ViewAxo"
<< "Separator" << "Std_ViewFront" << "Std_ViewRight"
<< "Std_ViewTop" << "Separator" << "Std_ViewRear"
- << "Std_ViewLeft" << "Std_ViewBottom";
+ << "Std_ViewLeft" << "Std_ViewBottom"
+ << "Separator" << "Std_ViewRotateLeft" << "Std_ViewRotateRight";
// stereo
MenuItem* view3d = new MenuItem;