How to toggle a clip plane?

I am trying to set a clip plane for walls and other items that are behind a third person actor in an attempt to prevent them from blocking the camera when rotating the actor.

self.camLens.set_near(x) almost does exactly what I want. I tried nudging the x value up until I got the desired effect, but at that point some strange/undesirable visual effects are also introduced. So I am now attempting to do it myself with a clip plane. I have four vertical clip planes that are created similar to the below example:

clip_plane_east = Plane((8, 0, 0), (8, 0, 1), (8, 1, 0))
clip_plane_east_node = PlaneNode('plane-east', clip_plane_east)
clip_plane_node_path = self.render.attach_new_node(clip_plane_east_node)
clip_plane_node_path.show()  # shows the plane's location/boundaries for testing
self.render.set_clip_plane(clip_plane_node_path)

Is there a way to toggle it from active to inactive and vice versa? I don’t mean clip_plane_node_path.show()/clip_plane_node_path.hide() to show the boundaries/grid for testing. I want to know how to remove the clipping plane and then put it back to toggle the parts of the render that I want to be visible/invisible.

I thought about just removing the node and adding it back, but I can’t seem to find it in the tree with self.scene.ls() or with .find() - clip_plane_node_path prints ‘render/plane-east’.

Thanks!

Ah never mind I may have gotten it…

I am using this to activate it

clip_plane_east_node.set_clip_effect(1)

and this to deactivate it (although I don’t see 0 mentioned in the docs):

clip_plane_east_node.set_clip_effect(0)

Please note that passing 0 doesn’t entirely disable the clip plane. Objects entirely outside the plane will still be culled away. It just means that it won’t be applied during rendering, as in, it won’t render an object that is half inside the plane as being cut open.

To entirely disable a clip plane, you need to use render.clear_clip_plane.

Thank you! I ended up not doing that in the long run… but it’s good to know.