From 7a3ddd5bae60dfde56d5ca8254cd5b42593cb91e Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 1 Aug 2014 16:39:59 +0200 Subject: [PATCH] + fix author note, fix various crashes, improve mesh selection stuff --- src/App/Application.cpp | 4 ++++ src/Gui/CommandView.cpp | 2 +- src/Gui/SplitView3DInventor.cpp | 8 ++++++++ src/Gui/SplitView3DInventor.h | 1 + src/Gui/View3DInventor.cpp | 2 +- src/Gui/View3DInventor.h | 2 +- src/Mod/Mesh/App/Core/Evaluation.cpp | 8 ++++++-- src/Mod/Mesh/App/Core/Evaluation.h | 1 + src/Mod/Mesh/App/Mesh.cpp | 3 +-- src/Mod/Mesh/Gui/MeshSelection.cpp | 10 +++++++--- 10 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 591e1980c..60e281027 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -1208,6 +1208,10 @@ void Application::initApplication(void) ("User parameter:BaseApp/Preferences/Units"); UnitsApi::setSchema((UnitSystem)hGrp->GetInt("UserSchema",0)); +#if defined (_DEBUG) + Console().Log("Application is built with debug information\n"); +#endif + // starting the init script Console().Log("Run App init script\n"); Interpreter().runString(Base::ScriptFactory().ProduceScript("FreeCADInit")); diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index b55e7fd29..913296ada 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (c) 2002 Jürgen Riegel * + * Copyright (c) 2002 Jürgen Riegel * * * * This file is part of the FreeCAD CAx development system. * * * diff --git a/src/Gui/SplitView3DInventor.cpp b/src/Gui/SplitView3DInventor.cpp index 33879ffb2..3d071254c 100644 --- a/src/Gui/SplitView3DInventor.cpp +++ b/src/Gui/SplitView3DInventor.cpp @@ -58,6 +58,14 @@ AbstractSplitView::~AbstractSplitView() } } +void AbstractSplitView::deleteSelf() +{ + for (std::vector::iterator it = _viewer.begin(); it != _viewer.end(); ++it) { + (*it)->setSceneGraph(0); + } + MDIView::deleteSelf(); +} + void AbstractSplitView::setupSettings() { // attach Parameter Observer diff --git a/src/Gui/SplitView3DInventor.h b/src/Gui/SplitView3DInventor.h index 2131f93a1..2a3373e94 100644 --- a/src/Gui/SplitView3DInventor.h +++ b/src/Gui/SplitView3DInventor.h @@ -51,6 +51,7 @@ public: virtual bool onHasMsg(const char* pMsg) const; virtual void OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::MessageType Reason); virtual void onUpdate(void); + virtual void deleteSelf(); View3DInventorViewer *getViewer(unsigned int) const; diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index a39c791f3..61d417f79 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (c) 2004 Jürgen Riegel * + * Copyright (c) 2004 Jürgen Riegel * * * * This file is part of the FreeCAD CAx development system. * * * diff --git a/src/Gui/View3DInventor.h b/src/Gui/View3DInventor.h index a8cb9bfa5..e1471dfbe 100644 --- a/src/Gui/View3DInventor.h +++ b/src/Gui/View3DInventor.h @@ -70,7 +70,7 @@ public: View3DInventor(Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags=0); ~View3DInventor(); - /// Mesage handler + /// Message handler virtual bool onMsg(const char* pMsg, const char** ppReturn); virtual bool onHasMsg(const char* pMsg) const; virtual void deleteSelf(); diff --git a/src/Mod/Mesh/App/Core/Evaluation.cpp b/src/Mod/Mesh/App/Core/Evaluation.cpp index d6184e5c3..e9befdcb1 100644 --- a/src/Mod/Mesh/App/Core/Evaluation.cpp +++ b/src/Mod/Mesh/App/Core/Evaluation.cpp @@ -754,7 +754,7 @@ void MeshEvalSelfIntersection::GetIntersections(std::vector MeshFixSelfIntersection::GetFacets() const { std::vector indices; const MeshFacetArray& rFaces = _rclMesh.GetFacets(); @@ -781,8 +781,12 @@ bool MeshFixSelfIntersection::Fixup() std::sort(indices.begin(), indices.end()); indices.erase(std::unique(indices.begin(), indices.end()), indices.end()); - _rclMesh.DeleteFacets(indices); + return indices; +} +bool MeshFixSelfIntersection::Fixup() +{ + _rclMesh.DeleteFacets(GetFacets()); return true; } diff --git a/src/Mod/Mesh/App/Core/Evaluation.h b/src/Mod/Mesh/App/Core/Evaluation.h index 2444021dc..2c8e8accd 100644 --- a/src/Mod/Mesh/App/Core/Evaluation.h +++ b/src/Mod/Mesh/App/Core/Evaluation.h @@ -309,6 +309,7 @@ public: MeshFixSelfIntersection (MeshKernel &rclB, const std::vector >& si) : MeshValidation(rclB), selfIntersectons(si) {} virtual ~MeshFixSelfIntersection () {} + std::vector GetFacets() const; bool Fixup(); private: diff --git a/src/Mod/Mesh/App/Mesh.cpp b/src/Mod/Mesh/App/Mesh.cpp index 4add7a0b1..00cb10d2c 100644 --- a/src/Mod/Mesh/App/Mesh.cpp +++ b/src/Mod/Mesh/App/Mesh.cpp @@ -1129,8 +1129,7 @@ void MeshObject::removeSelfIntersections() if (!selfIntersections.empty()) { MeshCore::MeshFixSelfIntersection cMeshFix(_kernel, selfIntersections); - cMeshFix.Fixup(); - this->_segments.clear(); + deleteFacets(cMeshFix.GetFacets()); } } diff --git a/src/Mod/Mesh/Gui/MeshSelection.cpp b/src/Mod/Mesh/Gui/MeshSelection.cpp index 395c7f4b9..b879b48cd 100644 --- a/src/Mod/Mesh/Gui/MeshSelection.cpp +++ b/src/Mod/Mesh/Gui/MeshSelection.cpp @@ -198,8 +198,10 @@ void MeshSelection::startDeselection() void MeshSelection::stopSelection() { Gui::View3DInventorViewer* viewer = getViewer(); - if (viewer) + if (viewer) { stopInteractiveCallback(viewer); + viewer->navigationStyle()->stopSelection(); + } } void MeshSelection::fullSelection() @@ -317,9 +319,10 @@ void MeshSelection::selectTriangle() Gui::View3DInventorViewer* viewer = this->getViewer(); if (viewer) { - viewer->setEditingCursor(QCursor(Qt::OpenHandCursor)); stopInteractiveCallback(viewer); + viewer->navigationStyle()->stopSelection(); startInteractiveCallback(viewer, pickFaceCallback); + viewer->setEditingCursor(QCursor(Qt::PointingHandCursor)); } } @@ -329,9 +332,10 @@ void MeshSelection::deselectTriangle() Gui::View3DInventorViewer* viewer = this->getViewer(); if (viewer) { - viewer->setEditingCursor(QCursor(Qt::OpenHandCursor)); stopInteractiveCallback(viewer); + viewer->navigationStyle()->stopSelection(); startInteractiveCallback(viewer, pickFaceCallback); + viewer->setEditingCursor(QCursor(Qt::PointingHandCursor)); } }