Skip to content

Commit

Permalink
+ fix author note, fix various crashes, improve mesh selection stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Aug 1, 2014
1 parent 4032a88 commit 7a3ddd5
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 10 deletions.
4 changes: 4 additions & 0 deletions src/App/Application.cpp
Expand Up @@ -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"));
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/CommandView.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* Copyright (c) 2002 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
Expand Down
8 changes: 8 additions & 0 deletions src/Gui/SplitView3DInventor.cpp
Expand Up @@ -58,6 +58,14 @@ AbstractSplitView::~AbstractSplitView()
}
}

void AbstractSplitView::deleteSelf()
{
for (std::vector<View3DInventorViewer*>::iterator it = _viewer.begin(); it != _viewer.end(); ++it) {
(*it)->setSceneGraph(0);
}
MDIView::deleteSelf();
}

void AbstractSplitView::setupSettings()
{
// attach Parameter Observer
Expand Down
1 change: 1 addition & 0 deletions src/Gui/SplitView3DInventor.h
Expand Up @@ -51,6 +51,7 @@ class GuiExport AbstractSplitView : public MDIView, public ParameterGrp::Observe
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;

Expand Down
2 changes: 1 addition & 1 deletion src/Gui/View3DInventor.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (c) 2004 Jürgen Riegel <juergen.riegel@web.de> *
* Copyright (c) 2004 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
Expand Down
2 changes: 1 addition & 1 deletion src/Gui/View3DInventor.h
Expand Up @@ -70,7 +70,7 @@ class GuiExport View3DInventor : public MDIView, public ParameterGrp::ObserverTy
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();
Expand Down
8 changes: 6 additions & 2 deletions src/Mod/Mesh/App/Core/Evaluation.cpp
Expand Up @@ -754,7 +754,7 @@ void MeshEvalSelfIntersection::GetIntersections(std::vector<std::pair<unsigned l
}
}

bool MeshFixSelfIntersection::Fixup()
std::vector<unsigned long> MeshFixSelfIntersection::GetFacets() const
{
std::vector<unsigned long> indices;
const MeshFacetArray& rFaces = _rclMesh.GetFacets();
Expand All @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions src/Mod/Mesh/App/Core/Evaluation.h
Expand Up @@ -309,6 +309,7 @@ class MeshExport MeshFixSelfIntersection : public MeshValidation
MeshFixSelfIntersection (MeshKernel &rclB, const std::vector<std::pair<unsigned long, unsigned long> >& si)
: MeshValidation(rclB), selfIntersectons(si) {}
virtual ~MeshFixSelfIntersection () {}
std::vector<unsigned long> GetFacets() const;
bool Fixup();

private:
Expand Down
3 changes: 1 addition & 2 deletions src/Mod/Mesh/App/Mesh.cpp
Expand Up @@ -1129,8 +1129,7 @@ void MeshObject::removeSelfIntersections()

if (!selfIntersections.empty()) {
MeshCore::MeshFixSelfIntersection cMeshFix(_kernel, selfIntersections);
cMeshFix.Fixup();
this->_segments.clear();
deleteFacets(cMeshFix.GetFacets());
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/Mod/Mesh/Gui/MeshSelection.cpp
Expand Up @@ -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()
Expand Down Expand Up @@ -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));
}
}

Expand All @@ -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));
}
}

Expand Down

0 comments on commit 7a3ddd5

Please sign in to comment.