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:
Zheng, Lei
2026-01-17 22:49:18 +01:00
committed by Chris Hennes
parent fbb8e07e60
commit 58d8515365
2 changed files with 12 additions and 3 deletions

View File

@@ -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) {

View File

@@ -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