+ handle case if each face has its own color and a face has no triangles

+ do not write out fields of SoFCUnifiedSelection node
+ show wait cursor when importing parts

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5406 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
wmayer 2012-01-14 01:19:33 +00:00
parent 3ced7cba97
commit 197f875375
4 changed files with 33 additions and 0 deletions

View File

@ -169,6 +169,20 @@ const char* SoFCUnifiedSelection::getFileFormatName(void) const
return "Separator";
}
void SoFCUnifiedSelection::write(SoWriteAction * action)
{
SoOutput * out = action->getOutput();
if (out->getStage() == SoOutput::WRITE) {
// Do not write out the fields of this class
if (this->writeHeader(out, TRUE, FALSE)) return;
SoGroup::doAction((SoAction *)action);
this->writeFooter(out);
}
else {
inherited::write(action);
}
}
int SoFCUnifiedSelection::getPriority(const SoPickedPoint* p)
{
const SoDetail* detail = p->getDetail();

View File

@ -72,6 +72,7 @@ public:
};
const char* getFileFormatName(void) const;
void write(SoWriteAction * action);
SoSFColor colorHighlight;
SoSFColor colorSelection;

View File

@ -47,6 +47,7 @@
#include <Gui/Selection.h>
#include <Gui/View3DInventor.h>
#include <Gui/View3DInventorViewer.h>
#include <Gui/WaitCursor.h>
#include "../App/PartFeature.h"
#include "DlgPartImportStepImp.h"
@ -452,6 +453,7 @@ void CmdPartImport::activated(int iMsg)
QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString(), QString(), filter.join(QLatin1String(";;")));
if (!fn.isEmpty()) {
Gui::WaitCursor wc;
App::Document* pDoc = getDocument();
if (!pDoc) return; // no document
openCommand("Import Part");

View File

@ -391,6 +391,14 @@ void SoBrepFaceSet::renderShape(const SoGLCoordinateElement * const vertexlist,
int matnr = 0;
int trinr = 0;
pi = piptr < piendptr ? *piptr++ : -1;
while (pi == 0) {
// It may happen that a part has no triangles
pi = piptr < piendptr ? *piptr++ : -1;
if (mbind == PER_PART)
matnr++;
else if (mbind == PER_PART_INDEXED)
matindices++;
}
glBegin(GL_TRIANGLES);
while (viptr + 2 < viendptr) {
@ -503,6 +511,14 @@ void SoBrepFaceSet::renderShape(const SoGLCoordinateElement * const vertexlist,
trinr++;
if (pi == trinr) {
pi = piptr < piendptr ? *piptr++ : -1;
while (pi == 0) {
// It may happen that a part has no triangles
pi = piptr < piendptr ? *piptr++ : -1;
if (mbind == PER_PART)
matnr++;
else if (mbind == PER_PART_INDEXED)
matindices++;
}
trinr = 0;
}
}