support coloring of mesh segments

This commit is contained in:
wmayer
2016-09-07 21:51:05 +02:00
parent 7248683f11
commit 4d0d90d498
5 changed files with 58 additions and 3 deletions

View File

@@ -28,6 +28,8 @@ link_directories(${OCC_LIBRARY_DIR})
set(MeshPartGui_LIBS
MeshPart
PartGui
MeshGui
FreeCADGui
)

View File

@@ -30,11 +30,15 @@
#ifdef FC_OS_WIN32
# define MeshExport __declspec(dllimport)
# define PartExport __declspec(dllimport)
# define MeshGuiExport __declspec(dllimport)
# define PartGuiExport __declspec(dllimport)
# define MeshPartAppExport __declspec(dllimport)
# define MeshPartGuiExport __declspec(dllexport)
#else // for Linux
# define MeshExport
# define PartExport
# define MeshGuiExport
# define PartGuiExport
# define MeshPartAppExport
# define MeshPartGuiExport
#endif
@@ -45,8 +49,8 @@
#endif
#ifdef _PreComp_
// Python
// Python
#include <Python.h>
// standard
@@ -74,7 +78,7 @@
#ifndef __Qt4All__
# include <Gui/Qt4All.h>
#endif
#endif //_PreComp_
#endif // __PRECOMPILED_GUI__

View File

@@ -41,6 +41,8 @@
#include <Gui/ViewProvider.h>
#include <Gui/WaitCursor.h>
#include <Mod/Part/App/PartFeature.h>
#include <Mod/Mesh/Gui/ViewProvider.h>
#include <Mod/Part/Gui/ViewProvider.h>
using namespace MeshPartGui;
@@ -327,6 +329,21 @@ bool Tessellation::accept()
}
}
Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toUtf8());
// if Standard mesher is used and face colors should be applied
if (method == 0) { // Standard
if (ui->meshShapeColors->isChecked()) {
Gui::ViewProvider* vpm = Gui::Application::Instance->getViewProvider
(activeDoc->getActiveObject());
Gui::ViewProvider* vpp = Gui::Application::Instance->getViewProvider
(activeDoc->getObject(shape.toLatin1()));
MeshGui::ViewProviderMesh* vpmesh = dynamic_cast<MeshGui::ViewProviderMesh*>(vpm);
PartGui::ViewProviderPart* vppart = dynamic_cast<PartGui::ViewProviderPart*>(vpp);
if (vpmesh && vppart) {
vpmesh->highlightSegments(vppart->DiffuseColor.getValues());
}
}
}
}
activeDoc->commitTransaction();
}