From 1f63355c06e36a978eedb10cdf57996c83f2f20d Mon Sep 17 00:00:00 2001 From: Adrian Date: Fri, 15 May 2020 14:27:17 -0400 Subject: [PATCH] Improve Axis Cross behavior and expose parameter to 3D View preferences --- src/Gui/AboutApplication.ui | 1 + src/Gui/CommandView.cpp | 8 +------- src/Gui/DlgSettings3DView.ui | 20 ++++++++++++++++++-- src/Gui/DlgSettings3DViewImp.cpp | 2 ++ src/Gui/Document.cpp | 6 ++++++ src/Mod/Mesh/App/MeshTestsApp.py | 1 + 6 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/Gui/AboutApplication.ui b/src/Gui/AboutApplication.ui index 22994214ab..8e7802ccc9 100644 --- a/src/Gui/AboutApplication.ui +++ b/src/Gui/AboutApplication.ui @@ -308,6 +308,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">People</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Abdullah Tahiriyo</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Adrián Insaurralde</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Ajinkya Dahale</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Alexander Golubev (fat-zer)</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Alexander Gryson</p> diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 855139e7d2..037299271a 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -1908,10 +1908,6 @@ void StdCmdViewCreate::activated(int iMsg) Q_UNUSED(iMsg); getActiveGuiDocument()->createView(View3DInventor::getClassTypeId()); getActiveGuiDocument()->getActiveView()->viewAll(); - - ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); - if (hViewGrp->GetBool("ShowAxisCross")) - doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(True)"); } bool StdCmdViewCreate::isActive(void) @@ -2067,6 +2063,7 @@ StdCmdAxisCross::StdCmdAxisCross() sToolTipText = QT_TR_NOOP("Toggle axis cross"); sStatusTip = QT_TR_NOOP("Toggle axis cross"); sWhatsThis = "Std_AxisCross"; + sAccel = "A,C"; } void StdCmdAxisCross::activated(int iMsg) @@ -2078,9 +2075,6 @@ void StdCmdAxisCross::activated(int iMsg) doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(True)"); else doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(False)"); - - ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); - hViewGrp->SetBool("ShowAxisCross", view->getViewer()->hasAxisCross()); } } diff --git a/src/Gui/DlgSettings3DView.ui b/src/Gui/DlgSettings3DView.ui index 25c45f3814..e92bcc345e 100644 --- a/src/Gui/DlgSettings3DView.ui +++ b/src/Gui/DlgSettings3DView.ui @@ -6,8 +6,8 @@ 0 0 - 477 - 407 + 499 + 520 @@ -43,6 +43,22 @@ lower right corner within opened files + + + + <html><head/><body><p>Axis cross will be shown by default at file</p><p>open or creation.</p></body></html> + + + Show axis cross by default + + + ShowAxisCross + + + View + + + diff --git a/src/Gui/DlgSettings3DViewImp.cpp b/src/Gui/DlgSettings3DViewImp.cpp index 90db0ba8ce..cd0c07b745 100644 --- a/src/Gui/DlgSettings3DViewImp.cpp +++ b/src/Gui/DlgSettings3DViewImp.cpp @@ -89,6 +89,7 @@ void DlgSettings3DViewImp::saveSettings() hGrp->SetInt("MarkerSize", vBoxMarkerSize.toInt()); ui->CheckBox_CornerCoordSystem->onSave(); + ui->CheckBox_ShowAxisCross->onSave(); ui->CheckBox_WbByTab->onSave(); ui->CheckBox_ShowFPS->onSave(); ui->CheckBox_useVBO->onSave(); @@ -103,6 +104,7 @@ void DlgSettings3DViewImp::saveSettings() void DlgSettings3DViewImp::loadSettings() { ui->CheckBox_CornerCoordSystem->onRestore(); + ui->CheckBox_ShowAxisCross->onRestore(); ui->CheckBox_WbByTab->onRestore(); ui->CheckBox_ShowFPS->onRestore(); ui->CheckBox_useVBO->onRestore(); diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 336f7e01a0..79f84c3b68 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -1648,6 +1648,10 @@ MDIView *Document::createView(const Base::Type& typeId) const char *ppReturn = 0; view3D->onMsg(cameraSettings.c_str(),&ppReturn); } + ParameterGrp::handle hViewGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); + if (hViewGrp->GetBool("ShowAxisCross",false)){ + view3D->getViewer()->setAxisCross(true); + } getMainWindow()->addWindow(view3D); return view3D; } @@ -1666,6 +1670,8 @@ Gui::MDIView* Document::cloneView(Gui::MDIView* oldview) std::string overrideMode = firstView->getViewer()->getOverrideMode(); view3D->getViewer()->setOverrideMode(overrideMode); + view3D->getViewer()->setAxisCross(firstView->getViewer()->hasAxisCross()); + // attach the viewproviders. we need to make sure that we only attach the toplevel ones // and not viewproviders which are claimed by other providers. To ensure this we first // add all providers and then remove the ones already claimed diff --git a/src/Mod/Mesh/App/MeshTestsApp.py b/src/Mod/Mesh/App/MeshTestsApp.py index f40f20643a..824384df88 100644 --- a/src/Mod/Mesh/App/MeshTestsApp.py +++ b/src/Mod/Mesh/App/MeshTestsApp.py @@ -124,6 +124,7 @@ class PivyTestCases(unittest.TestCase): from pivy import coin; import FreeCADGui Mesh.show(planarMeshObject) view=FreeCADGui.ActiveDocument.ActiveView + view.setAxisCross(False) pc=coin.SoGetPrimitiveCountAction() pc.apply(view.getSceneGraph()) self.failUnless(pc.getTriangleCount() == 2)