From 58d8515365b5a749daafe74c59067972d6eb43f8 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Sat, 17 Jan 2026 22:49:18 +0100 Subject: [PATCH] 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 --- src/Mod/Part/Gui/ViewProviderExt.cpp | 12 +++++++++--- src/Mod/Part/Gui/ViewProviderExt.h | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Mod/Part/Gui/ViewProviderExt.cpp b/src/Mod/Part/Gui/ViewProviderExt.cpp index b73f592a41..b632d1b702 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.cpp +++ b/src/Mod/Part/Gui/ViewProviderExt.cpp @@ -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) { diff --git a/src/Mod/Part/Gui/ViewProviderExt.h b/src/Mod/Part/Gui/ViewProviderExt.h index f1516afd9f..b5bc9d547b 100644 --- a/src/Mod/Part/Gui/ViewProviderExt.h +++ b/src/Mod/Part/Gui/ViewProviderExt.h @@ -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