]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
[bos #42871] Clipping plane remains applied after being deleted master mbs/42871_clipping_plane_bug 37/head
authormbs <martin.bernhard@opencascade.com>
Thu, 5 Sep 2024 18:56:04 +0000 (19:56 +0100)
committermbs <martin.bernhard@opencascade.com>
Thu, 5 Sep 2024 18:56:04 +0000 (19:56 +0100)
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

index e58abb5e73020f4c1051606e76ab858da8267c3e..a3c3e79f2f22949fbf897dfc3e5e86f71a413440 100644 (file)
@@ -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));
     }
   }