diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.cpp b/src/Mod/Sketcher/Gui/SketcherSettings.cpp index 9734c597af..debb815ea4 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.cpp +++ b/src/Mod/Sketcher/Gui/SketcherSettings.cpp @@ -156,6 +156,7 @@ void SketcherSettingsDisplay::saveSettings() ui->checkBoxTVShowLinks->onSave(); ui->checkBoxTVShowSupport->onSave(); ui->checkBoxTVRestoreCamera->onSave(); + ui->checkBoxTVForceOrtho->onSave(); ui->checkBoxTVSectionView->onSave(); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Part"); @@ -178,6 +179,8 @@ void SketcherSettingsDisplay::loadSettings() ui->checkBoxTVShowLinks->onRestore(); ui->checkBoxTVShowSupport->onRestore(); ui->checkBoxTVRestoreCamera->onRestore(); + ui->checkBoxTVForceOrtho->onRestore(); + this->ui->checkBoxTVForceOrtho->setEnabled(this->ui->checkBoxTVRestoreCamera->isChecked()); ui->checkBoxTVSectionView->onRestore(); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Part"); @@ -211,12 +214,14 @@ void SketcherSettingsDisplay::onBtnTVApplyClicked(bool) " sketch.ViewObject.ShowLinks = %s\n" " sketch.ViewObject.ShowSupport = %s\n" " sketch.ViewObject.RestoreCamera = %s\n" + " sketch.ViewObject.ForceOrtho = %s\n" " sketch.ViewObject.SectionView = %s\n", this->ui->checkBoxTVHideDependent->isChecked() ? "True": "False", this->ui->checkBoxTVShowLinks->isChecked() ? "True": "False", this->ui->checkBoxTVShowSupport->isChecked() ? "True": "False", this->ui->checkBoxTVRestoreCamera->isChecked() ? "True": "False", - this->ui->checkBoxTVSectionView->isChecked() ? "True": "False"); + this->ui->checkBoxTVForceOrtho->isChecked() ? "True": "False", + this->ui->checkBoxTVSectionView->isChecked() ? "True": "False"); } catch (Base::PyException &e){ Base::Console().Error("SketcherSettings::onBtnTVApplyClicked:\n"); e.ReportException(); diff --git a/src/Mod/Sketcher/Gui/SketcherSettingsDisplay.ui b/src/Mod/Sketcher/Gui/SketcherSettingsDisplay.ui index 46ce790e35..4d509de615 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettingsDisplay.ui +++ b/src/Mod/Sketcher/Gui/SketcherSettingsDisplay.ui @@ -230,6 +230,25 @@ Supports all unit systems except 'US customary' and 'Building US/Euro'. + + + + When entering edit mode, force orthographic view of camera. Operates only with camera restoration enabled. + + + Force orthographic camera when entering edit + + + false + + + ForceOrtho + + + Mod/Sketcher/General + + + @@ -445,8 +464,17 @@ Supports all unit systems except 'US customary' and 'Building US/Euro'. checkBoxTVShowLinks checkBoxTVShowSupport checkBoxTVRestoreCamera + checkBoxTVForceOrtho + checkBoxTVSectionView btnTVApply - + + + checkBoxTVRestoreCamera + toggled(bool) + checkBoxTVForceOrtho + setEnabled(bool) + + diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 757919a15d..67732ca60b 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -335,6 +335,7 @@ ViewProviderSketch::ViewProviderSketch() ADD_PROPERTY_TYPE(ShowLinks,(true),"Visibility automation",(App::PropertyType)(App::Prop_None),"If true, all objects used in links to external geometry are shown when opening sketch."); ADD_PROPERTY_TYPE(ShowSupport,(true),"Visibility automation",(App::PropertyType)(App::Prop_None),"If true, all objects this sketch is attached to are shown when opening sketch."); ADD_PROPERTY_TYPE(RestoreCamera,(true),"Visibility automation",(App::PropertyType)(App::Prop_None),"If true, camera position before entering sketch is remembered, and restored after closing it."); + ADD_PROPERTY_TYPE(ForceOrtho,(false),"Visibility automation",(App::PropertyType)(App::Prop_None),"If true, camera type will be forced to orthographic view when entering editing mode."); ADD_PROPERTY_TYPE(SectionView,(false),"Visibility automation",(App::PropertyType)(App::Prop_None),"If true, only objects (or part of) located behind the sketch plane are visible."); ADD_PROPERTY_TYPE(EditingWorkbench,("SketcherWorkbench"),"Visibility automation",(App::PropertyType)(App::Prop_None),"Name of the workbench to activate when editing this sketch."); @@ -344,6 +345,7 @@ ViewProviderSketch::ViewProviderSketch() this->ShowLinks.setValue(hGrp->GetBool("ShowLinks", true)); this->ShowSupport.setValue(hGrp->GetBool("ShowSupport", true)); this->RestoreCamera.setValue(hGrp->GetBool("RestoreCamera", true)); + this->ForceOrtho.setValue(hGrp->GetBool("ForceOrtho", false)); this->SectionView.setValue(hGrp->GetBool("SectionView", false)); // well it is not visibility automation but a good place nevertheless @@ -6889,6 +6891,8 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo "ActiveSketch = App.getDocument('%1').getObject('%2')\n" "if ActiveSketch.ViewObject.RestoreCamera:\n" " ActiveSketch.ViewObject.TempoVis.saveCamera()\n" + " if ActiveSketch.ViewObject.ForceOrtho:\n" + " ActiveSketch.ViewObject.Document.ActiveView.setCameraType('Orthographic')\n" ).arg(QString::fromLatin1(getDocument()->getDocument()->getName())).arg( QString::fromLatin1(getSketchObject()->getNameInDocument())); QByteArray cmdstr_bytearray = cmdstr.toLatin1(); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.h b/src/Mod/Sketcher/Gui/ViewProviderSketch.h index 5d2bfb147d..2486301a62 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.h +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.h @@ -114,6 +114,7 @@ public: App::PropertyBool ShowLinks; App::PropertyBool ShowSupport; App::PropertyBool RestoreCamera; + App::PropertyBool ForceOrtho; App::PropertyBool SectionView; App::PropertyString EditingWorkbench;