mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Fix #5464
This commit is contained in:
@@ -85,6 +85,12 @@ class Raycast(bonsai.core.tool.Raycast):
|
||||
def get_viewport_ray_data(cls, context, event, mouse_pos=None):
|
||||
region = context.region
|
||||
rv3d = context.region_data
|
||||
original_perspective = rv3d.view_perspective
|
||||
|
||||
# TODO The raycast was working for orthographic view, but not when you are inside a camera view. This solution feels hacky,
|
||||
# but it temporarily switches the perspective_matrix from camera to the perspective_matrix from ortho view.
|
||||
if original_perspective == "CAMERA":
|
||||
rv3d.view_perspective = "ORTHO"
|
||||
if not mouse_pos:
|
||||
mouse_pos = event.mouse_region_x, event.mouse_region_y
|
||||
|
||||
@@ -93,6 +99,9 @@ class Raycast(bonsai.core.tool.Raycast):
|
||||
ray_target = ray_origin + view_vector
|
||||
ray_direction = ray_target - ray_origin
|
||||
|
||||
if original_perspective == "CAMERA":
|
||||
rv3d.view_perspective = "CAMERA"
|
||||
|
||||
return ray_origin, ray_target, ray_direction
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user