Skip to content

Commit

Permalink
Allow blueprint editing of clipping_plane
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed Dec 6, 2024
1 parent 0841c0c commit 89a74cb
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ class VisualBounds2DExt:
def __init__(
self: Any,
*,
x_range: datatypes.Range1DLike,
y_range: datatypes.Range1DLike,
x_range: datatypes.Range1DLike | None = None,
y_range: datatypes.Range1DLike | None = None,
clipping_plane: datatypes.Float32Like | None = None,
):
"""
Create a new instance of the VisualBounds2D archetype.
Expand All @@ -25,10 +26,22 @@ def __init__(
The minimum visible range of the X-axis (usually left and right bounds).
y_range:
The minimum visible range of the Y-axis (usually left and right bounds).
clipping_plane:
The distance to the near clipping plane.
"""

if x_range is not None and y_range is not None:
range = blueprint_components.VisualBounds2D(x_range=x_range, y_range=y_range)
elif x_range is not None or y_range is not None:
raise ValueError("Both x_range and y_range must be specified.")
else:
range = None

with catch_and_log_exceptions(context=self.__class__.__name__):
self.__attrs_init__(range=blueprint_components.VisualBounds2D(x_range=x_range, y_range=y_range))
self.__attrs_init__(
range=range,
clipping_plane=clipping_plane,
)
return
self.__attrs_clear__()

0 comments on commit 89a74cb

Please sign in to comment.