Skip to content

Clipping

A plane gizmo edits one plane of one visual by dragging in a 3D canvas. Viewer.add_clipping_plane_gizmo and Viewer.add_render_plane_gizmo return a controller; CellierController.get_plane_gizmo returns the one a canvas has. A canvas has one gizmo, of either kind. See Clip a visual with planes.

cellier.clipping.PlaneGizmoController

One gizmo on one plane of one visual, in one 3D canvas.

The part of a session that does not depend on the kind of plane: the drag's interaction scope, the subscriptions and closing. Build one with CellierController.add_clipping_plane_gizmo or add_render_plane_gizmo; end it with close. A canvas holds one at a time.

A drag is one plane interaction on the visual (PlaneInteractionEvent). The camera controller is left alone: the gizmo takes only the drags that start on a handle.

Parameters:

Name Type Description Default
cellier_controller CellierController

The controller the visual and the canvas belong to.

required
visual_id UUID

The visual whose plane is edited.

required
canvas_id UUID

A 3D canvas of the visual's scene.

required
plane_id UUID

The id of the plane to edit.

required
screen_size float

The gizmo's size on screen, in logical pixels.

100.0
on_closed Callable[[PlaneGizmoController], None] or None

Called once, when the session has closed.

None

Raises:

Type Description
KeyError

If the canvas or the visual is not registered, or the visual has no plane with that id.

ValueError

If the canvas is in 2D, the visual is not in the canvas's scene, or the plane cannot have a gizmo in this view.

id property

id: UUID

The session's id: the source_id of the changes it makes.

visual_id property

visual_id: UUID

The visual whose plane is edited.

canvas_id property

canvas_id: UUID

The canvas the gizmo is drawn in.

plane_id property

plane_id: UUID

The id of the plane edited.

closed property

closed: bool

Whether the session has ended.

dragging property

dragging: bool

Whether a handle is held.

close

close() -> None

End the session: remove the gizmo and end a drag in progress.

Safe to call more than once.

cellier.clipping.ClippingPlaneGizmoController

Bases: PlaneGizmoController

One gizmo on one clipping plane of one visual, in one 3D canvas.

Build one with CellierController.add_clipping_plane_gizmo; end it with close. A canvas holds one gizmo at a time.

  • Dragging the arrow along the normal, or a rotation ring that tilts the normal, assigns the plane, once per frame. Sliding the gizmo within the plane or spinning it about the normal moves the gizmo only.
  • A plane changed from anywhere else (a slider, an assignment) moves the gizmo.
  • A drag is one plane interaction on the visual (PlaneInteractionEvent).
  • It closes itself when its plane or its visual is removed, when the canvas leaves 3D, and when the plane gains a component on an axis the view does not show.

Parameters:

Name Type Description Default
cellier_controller CellierController

The controller the visual and the canvas belong to.

required
visual_id UUID

The visual whose plane is edited.

required
canvas_id UUID

A 3D canvas of the visual's scene.

required
plane_id UUID

The id of the ClippingPlane to edit.

required
screen_size float

The gizmo's size on screen, in logical pixels.

100.0
on_closed Callable[[ClippingPlaneGizmoController], None] or None

Called once, when the session has closed.

None

Raises:

Type Description
KeyError

If the canvas or the visual is not registered, or the visual has no plane with that id.

ValueError

If the canvas is in 2D, the visual is not in the canvas's scene, or the plane has a component on an axis the view does not show.

id property

id: UUID

The session's id: the source_id of the changes it makes.

visual_id property

visual_id: UUID

The visual whose plane is edited.

canvas_id property

canvas_id: UUID

The canvas the gizmo is drawn in.

plane_id property

plane_id: UUID

The id of the plane edited.

closed property

closed: bool

Whether the session has ended.

dragging property

dragging: bool

Whether a handle is held.

anchor property

anchor: tuple[float, float, float]

Where the gizmo sits on the plane, in rendered (x, y, z).

close

close() -> None

End the session: remove the gizmo and end a drag in progress.

Safe to call more than once.

cellier.clipping.RenderPlaneGizmoController

Bases: PlaneGizmoController

One gizmo on one render plane of one visual, in one 3D canvas.

Build one with CellierController.add_render_plane_gizmo; end it with close. A canvas holds one gizmo at a time.

The gizmo carries the plane's whole pose: it sits at the plane's origin, its axis 0 is the normal and its axes 1 and 2 are in_plane_axis_0 and in_plane_axis_1. Every handle changes the model, once per frame:

  • a translate handle moves origin, along the normal or within the plane;
  • a rotation ring turns the in-plane axes about origin;
  • a scale handle on an in-plane axis multiplies that axis's extent, symmetrically about origin. On release the factor stays in the extent and the gizmo's scale goes back to 1. An axis with an unbounded side has no scale handle.

A plane changed from anywhere else moves the gizmo. A drag is one plane interaction on the visual (PlaneInteractionEvent). The session closes itself when its plane or its visual is removed, when the canvas leaves 3D, when the visual leaves the "plane" render mode, and when the plane's axes stop being the displayed ones.

Parameters:

Name Type Description Default
cellier_controller CellierController

The controller the visual and the canvas belong to.

required
visual_id UUID

The visual whose plane is edited.

required
canvas_id UUID

A 3D canvas of the visual's scene.

required
plane_id UUID

The id of the RenderPlane to edit. It may be disabled.

required
screen_size float

The gizmo's size on screen, in logical pixels.

100.0
on_closed Callable[[RenderPlaneGizmoController], None] or None

Called once, when the session has closed.

None

Raises:

Type Description
KeyError

If the canvas or the visual is not registered, or the visual has no render plane with that id.

ValueError

If the canvas is in 2D, the visual is not in the canvas's scene or not in the "plane" render mode, or the plane's axes are not the ones the view displays.

id property

id: UUID

The session's id: the source_id of the changes it makes.

visual_id property

visual_id: UUID

The visual whose plane is edited.

canvas_id property

canvas_id: UUID

The canvas the gizmo is drawn in.

plane_id property

plane_id: UUID

The id of the plane edited.

closed property

closed: bool

Whether the session has ended.

dragging property

dragging: bool

Whether a handle is held.

close

close() -> None

End the session: remove the gizmo and end a drag in progress.

Safe to call more than once.