From ddedae243a1d04cf0b657cc89dd90bc3076bd55e Mon Sep 17 00:00:00 2001 From: mbs Date: Thu, 5 Sep 2024 19:56:04 +0100 Subject: [PATCH] [bos #42871] Clipping plane remains applied after being deleted Clipping planes are stored with the AIS object and should be reset, whenever the clipping plane gets deleted. When there are no more clipping planes, we need to set an empty list in the AIS object to disable the clipping. --- src/OCCViewer/OCCViewer_ViewModel.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index e58abb5e7..a3c3e79f2 100644 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -1706,9 +1706,9 @@ void OCCViewer_Viewer::applyExistingClipPlanesToObject (const Handle(AIS_Interac */ void OCCViewer_Viewer::applyClippingPlanes(bool theUpdateHatch) { - if (myInternalClipPlanes.IsEmpty()) { - return; // Nothing to do - } + // Do not return immediately, if there are no local clipping planes. + // This is necessary to clear the clipping planes from the objects. + // Otherwise, the objects will be clipped by the last set of clipping planes. if (theUpdateHatch) { double hatchScale = computeHatchScale(); @@ -1724,6 +1724,8 @@ void OCCViewer_Viewer::applyClippingPlanes(bool theUpdateHatch) Handle(AIS_InteractiveObject) anObj = anIter.Value(); Handle(ViewerData_AISShape) aShape = Handle(ViewerData_AISShape)::DownCast (anObj); if (!aShape.IsNull() && aShape->IsClippable()) { + // Update the clipping plane of each clippable object. + // If the internal clipping planes list is empty, the object will be displayed as is (unclipped). aShape->SetClipPlanes(new Graphic3d_SequenceOfHClipPlane(myInternalClipPlanes)); } } -- 2.39.2