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 <[email protected]>
This commit is contained in:
Zheng, Lei
2026-01-19 10:39:05 -06:00
committed by Chris Hennes
co-authored by Kacper Donat
parent c858e09ca5
commit 72971d48e5
2 changed files with 12 additions and 3 deletions
+9 -3
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) {
+3
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