Part: Do not recompute visuals if shape did not change
This commit registers last rendered shape within the ViewProvider for Part objects and short-circuits the visuals recomputed if shape did not change. Co-Authored-By: Kacper Donat <kadet1090@gmail.com>
This commit is contained in:
@@ -1467,6 +1467,12 @@ void ViewProviderPartExt::setupCoinGeometry(
|
||||
|
||||
void ViewProviderPartExt::updateVisual()
|
||||
{
|
||||
TopoDS_Shape shape = getRenderedShape().getShape();
|
||||
|
||||
if (lastRenderedShape.IsPartner(shape)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Gui::SoUpdateVBOAction action;
|
||||
action.apply(this->faceset);
|
||||
|
||||
@@ -1483,10 +1489,8 @@ void ViewProviderPartExt::updateVisual()
|
||||
haction.apply(this->nodeset);
|
||||
|
||||
try {
|
||||
TopoDS_Shape cShape = getRenderedShape().getShape();
|
||||
|
||||
setupCoinGeometry(
|
||||
cShape,
|
||||
shape,
|
||||
coords,
|
||||
faceset,
|
||||
norm,
|
||||
@@ -1497,6 +1501,8 @@ void ViewProviderPartExt::updateVisual()
|
||||
NormalsFromUV
|
||||
);
|
||||
|
||||
lastRenderedShape = shape;
|
||||
|
||||
VisualTouched = false;
|
||||
}
|
||||
catch (const Standard_Failure& e) {
|
||||
|
||||
@@ -254,6 +254,9 @@ private:
|
||||
// This is needed to restore old DiffuseColor values since the restore
|
||||
// function is asynchronous
|
||||
App::PropertyColorList _diffuseColor;
|
||||
|
||||
// shape that was last rendered so if it does not change we don't re-render it without need
|
||||
TopoDS_Shape lastRenderedShape;
|
||||
};
|
||||
|
||||
} // namespace PartGui
|
||||
|
||||
Reference in New Issue
Block a user