From f19e21a22400ea1931c763ee7587f0849f48556e Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Sat, 7 Sep 2019 19:52:12 +0300 Subject: [PATCH] PartDesign: change view sizing on new sketch --- src/Gui/ViewProviderOrigin.cpp | 6 ++++++ src/Gui/ViewProviderOrigin.h | 2 +- src/Mod/PartDesign/Gui/Command.cpp | 18 ------------------ 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/Gui/ViewProviderOrigin.cpp b/src/Gui/ViewProviderOrigin.cpp index d2e3038849..6f480c8fb6 100644 --- a/src/Gui/ViewProviderOrigin.cpp +++ b/src/Gui/ViewProviderOrigin.cpp @@ -154,6 +154,12 @@ void ViewProviderOrigin::resetTemporaryVisibility() { tempVisMap.clear (); } +double ViewProviderOrigin::defaultSize() +{ + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); + return 0.25 * hGrp->GetFloat("NewDocumentCameraScale",100.0); +} + bool ViewProviderOrigin::isTemporaryVisibility() { return !tempVisMap.empty(); } diff --git a/src/Gui/ViewProviderOrigin.h b/src/Gui/ViewProviderOrigin.h index f639627348..8429078e52 100644 --- a/src/Gui/ViewProviderOrigin.h +++ b/src/Gui/ViewProviderOrigin.h @@ -75,7 +75,7 @@ public: } /// Returns default size. Use this if it is not possible to determine appropriate size by other means - static double defaultSize() {return 10.;} + static double defaultSize(); protected: virtual void onChanged(const App::Property* prop); virtual bool onDelete(const std::vector &); diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index 50f53f9584..3b82ed94a4 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -720,24 +720,6 @@ void CmdPartDesignNewSketch::activated(int iMsg) Base::Console().Error("Failed to create a Body object"); return; } - - // The method 'SoCamera::viewBoundingBox' is still declared as protected in Coin3d versions - // older than 4.0. -#if COIN_MAJOR_VERSION >= 4 - // if no part feature was there then auto-adjust the camera - Gui::Document* guidoc = Gui::Application::Instance->getDocument(doc); - Gui::View3DInventor* view = guidoc ? qobject_cast(guidoc->getActiveView()) : nullptr; - if (view) { - SoCamera* camera = view->getViewer()->getCamera(); - SbViewportRegion vpregion = view->getViewer()->getViewportRegion(); - float aspectratio = vpregion.getViewportAspectRatio(); - - float size = Gui::ViewProviderOrigin::defaultSize(); - SbBox3f bbox; - bbox.setBounds(-size,-size,-size,size,size,size); - camera->viewBoundingBox(bbox, aspectratio, 1.0f); - } -#endif } // At this point, we have pcActiveBody