diff --git a/src/Gui/DlgSettingsNavigation.ui b/src/Gui/DlgSettingsNavigation.ui
index 50c102ac58..e7970a673e 100644
--- a/src/Gui/DlgSettingsNavigation.ui
+++ b/src/Gui/DlgSettingsNavigation.ui
@@ -361,7 +361,7 @@ Turntable: the part will be rotated around the z-axis.
-
- New document scale
+ Camera zoom
diff --git a/src/Gui/View3DPy.cpp b/src/Gui/View3DPy.cpp
index 75f294ede9..155a0291a3 100644
--- a/src/Gui/View3DPy.cpp
+++ b/src/Gui/View3DPy.cpp
@@ -738,22 +738,8 @@ Py::Object View3DInventorPy::viewDefaultOrientation(const Py::Tuple& args)
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
scale = hGrp->GetFloat("NewDocumentCameraScale",100.0);
}
- if (scale > 1e-7) {
- double f = 0.0; //focal dist
- if (cam->isOfType(SoOrthographicCamera::getClassTypeId())){
- static_cast(cam)->height = scale;
- f = scale;
- } else if (cam->isOfType(SoPerspectiveCamera::getClassTypeId())){
- //nothing to do
- double ang = static_cast(cam)->heightAngle.getValue();
- f = 0.5 * scale / sin(ang * 0.5);
- }
- SbVec3f lookDir;
- rot.multVec(SbVec3f(0,0,-1), lookDir);
- SbVec3f pos = lookDir * -f;
- cam->focalDistance = f;
- cam->position = pos;
- }
+
+ setDefaultCameraHeight(scale);
}
catch (const Base::Exception& e) {
throw Py::RuntimeError(e.what());
@@ -768,6 +754,31 @@ Py::Object View3DInventorPy::viewDefaultOrientation(const Py::Tuple& args)
return Py::None();
}
+void View3DInventorPy::setDefaultCameraHeight(float scale)
+{
+ if (scale > 1e-7) {
+ SoCamera* cam = getView3DIventorPtr()->getViewer()->getCamera();
+ SbRotation rot = cam->orientation.getValue();
+
+ double f = 0.0; //focal dist
+ if (cam->isOfType(SoOrthographicCamera::getClassTypeId())){
+ static_cast(cam)->height = scale;
+ f = scale;
+ }
+ else if (cam->isOfType(SoPerspectiveCamera::getClassTypeId())){
+ //nothing to do
+ double ang = static_cast(cam)->heightAngle.getValue();
+ f = 0.5 * scale / sin(ang * 0.5);
+ }
+
+ SbVec3f lookDir;
+ rot.multVec(SbVec3f(0,0,-1), lookDir);
+ SbVec3f pos = lookDir * -f;
+ cam->focalDistance = f;
+ cam->position = pos;
+ }
+}
+
Py::Object View3DInventorPy::viewRotateLeft(const Py::Tuple& args)
{
if (!PyArg_ParseTuple(args.ptr(), ""))
diff --git a/src/Gui/View3DPy.h b/src/Gui/View3DPy.h
index 52f96a10ff..d0f94fb521 100644
--- a/src/Gui/View3DPy.h
+++ b/src/Gui/View3DPy.h
@@ -146,6 +146,7 @@ public:
Py::Object getCornerCrossSize(const Py::Tuple& args);
private:
+ void setDefaultCameraHeight(float);
static void eventCallback(void * ud, SoEventCallback * n);
static void eventCallbackPivy(void * ud, SoEventCallback * n);
static void eventCallbackPivyEx(void * ud, SoEventCallback * n);