diff --git a/src/Mod/Part/Gui/SoBrepEdgeSet.cpp b/src/Mod/Part/Gui/SoBrepEdgeSet.cpp index 6ff150313b..5940eebb70 100644 --- a/src/Mod/Part/Gui/SoBrepEdgeSet.cpp +++ b/src/Mod/Part/Gui/SoBrepEdgeSet.cpp @@ -196,13 +196,18 @@ void SoBrepEdgeSet::renderSelection(SoGLRenderAction *action) int num = (int)this->sl.size(); if (num > 0) { - cindices = &(this->sl[0]); - numcindices = (int)this->sl.size(); - if (!validIndexes(coords, this->sl)) { - SoDebugError::postWarning("SoBrepEdgeSet::renderSelection", "selectionIndex out of range"); + if (this->sl[0] < 0) { + renderShape(static_cast(coords), cindices, numcindices); } else { - renderShape(static_cast(coords), cindices, numcindices); + cindices = &(this->sl[0]); + numcindices = (int)this->sl.size(); + if (!validIndexes(coords, this->sl)) { + SoDebugError::postWarning("SoBrepEdgeSet::renderSelection", "selectionIndex out of range"); + } + else { + renderShape(static_cast(coords), cindices, numcindices); + } } } state->pop(); @@ -275,25 +280,28 @@ void SoBrepEdgeSet::doAction(SoAction* action) this->selectionColor = selaction->getColor(); if (selaction->getType() == Gui::SoSelectionElementAction::All) { - const int32_t* cindices = this->coordIndex.getValues(0); - int numcindices = this->coordIndex.getNum(); - unsigned int num = std::count_if(cindices, cindices+numcindices, - std::bind2nd(std::equal_to(), -1)); + //const int32_t* cindices = this->coordIndex.getValues(0); + //int numcindices = this->coordIndex.getNum(); + //unsigned int num = std::count_if(cindices, cindices+numcindices, + // std::bind2nd(std::equal_to(), -1)); + //this->sl.clear(); + //this->selectionIndex.setNum(num); + //int32_t* v = this->selectionIndex.startEditing(); + //for (unsigned int i=0; iselectionIndex.finishEditing(); + + //int numsegm = this->selectionIndex.getNum(); + //if (numsegm > 0) { + // const int32_t* selsegm = this->selectionIndex.getValues(0); + // const int32_t* cindices = this->coordIndex.getValues(0); + // int numcindices = this->coordIndex.getNum(); + // createIndexArray(selsegm, numsegm, cindices, numcindices, this->sl); + //} + this->selectionIndex.setValue(-1); // all this->sl.clear(); - this->selectionIndex.setNum(num); - int32_t* v = this->selectionIndex.startEditing(); - for (unsigned int i=0; iselectionIndex.finishEditing(); - - int numsegm = this->selectionIndex.getNum(); - if (numsegm > 0) { - const int32_t* selsegm = this->selectionIndex.getValues(0); - const int32_t* cindices = this->coordIndex.getValues(0); - int numcindices = this->coordIndex.getNum(); - createIndexArray(selsegm, numsegm, cindices, numcindices, this->sl); - } + this->sl.push_back(-1); return; } else if (selaction->getType() == Gui::SoSelectionElementAction::None) { diff --git a/src/Mod/Part/Gui/SoBrepFaceSet.cpp b/src/Mod/Part/Gui/SoBrepFaceSet.cpp index 6be57c100f..07e540c4cb 100644 --- a/src/Mod/Part/Gui/SoBrepFaceSet.cpp +++ b/src/Mod/Part/Gui/SoBrepFaceSet.cpp @@ -219,12 +219,13 @@ void SoBrepFaceSet::doAction(SoAction* action) Gui::SoSelectionElementAction* selaction = static_cast(action); this->selectionColor = selaction->getColor(); if (selaction->getType() == Gui::SoSelectionElementAction::All) { - int num = this->partIndex.getNum(); - this->selectionIndex.setNum(num); - int32_t* v = this->selectionIndex.startEditing(); - for (int i=0; iselectionIndex.finishEditing(); + //int num = this->partIndex.getNum(); + //this->selectionIndex.setNum(num); + //int32_t* v = this->selectionIndex.startEditing(); + //for (int i=0; iselectionIndex.finishEditing(); + this->selectionIndex.setValue(-1); // all PRIVATE(this)->updateVbo = true; return; } @@ -933,11 +934,19 @@ void SoBrepFaceSet::renderSelection(SoGLRenderAction *action) } // coords - int length = (int)pindices[id]*4; + int length=0; int start=0; - for (int j=0;j(coords), &(cindices[start]), length, - &(pindices[id]), 1, normals_s, nindices_s, &mb, mindices, &tb, tindices, nbind, mbind, doTextures?1:0); + &(pindices[id]), numparts, normals_s, nindices_s, &mb, mindices, &tb, tindices, nbind, mbind, doTextures?1:0); } state->pop();