write custom action class to notify shape node about vbo changes

This commit is contained in:
wmayer
2017-02-11 16:16:26 +01:00
parent 4a0720dd00
commit fe15db6af3
6 changed files with 134 additions and 40 deletions

View File

@@ -247,6 +247,12 @@ void SoBrepFaceSet::doAction(SoAction* action)
}
}
}
// The recommended way to set 'updateVbo' is to reimplement the method 'notify'
// but the class made this method private so that we can't override it.
// So, the alternative way is to write a custom SoAction class.
else if (action->getTypeId() == Gui::SoUpdateVBOAction::getClassTypeId()) {
this->updateVbo = true;
}
inherited::doAction(action);
}

View File

@@ -143,9 +143,7 @@ private:
// Define some VBO pointer for the current mesh
SbBool vboAvailable;
public:
SbBool updateVbo;
private:
uint32_t myvbo[2];
SbBool vboLoaded;
uint32_t indice_array;

View File

@@ -106,6 +106,7 @@
#include <App/Document.h>
#include <Gui/SoFCUnifiedSelection.h>
#include <Gui/SoFCSelectionAction.h>
#include <Gui/Selection.h>
#include <Gui/View3DInventorViewer.h>
#include <Gui/Utilities.h>
@@ -800,8 +801,8 @@ void ViewProviderPartExt::reload()
void ViewProviderPartExt::updateData(const App::Property* prop)
{
if (prop->getTypeId() == Part::PropertyPartShape::getClassTypeId()) {
// vejmarie: Force VBO update of the part
this->faceset->updateVbo = true;
Gui::SoUpdateVBOAction action;
action.apply(this->faceset);
// get the shape to show
const TopoDS_Shape &cShape = static_cast<const Part::PropertyPartShape*>(prop)->getValue();