From: mbs Date: Thu, 5 Sep 2024 18:56:04 +0000 (+0100) Subject: [bos #42871] Clipping plane remains applied after being deleted X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ddedae243a1d04cf0b657cc89dd90bc3076bd55e;p=modules%2Fgui.git [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. --- 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)); } }