This commit is contained in:
Andrej730
2025-11-18 16:12:59 +05:00
parent 8647f9c357
commit 1db4a79a6d
3 changed files with 6 additions and 4 deletions
@@ -2016,7 +2016,7 @@ class DecorationsHandler:
return # Don't draw decorations in local view
# disable decorations when not in camera view
if context.region_data.view_perspective != 'CAMERA':
if context.region_data.view_perspective != "CAMERA":
return
if not DrawingsData.is_loaded:
+2 -2
View File
@@ -172,11 +172,11 @@ class Polyline(bonsai.core.tool.Polyline):
angle = tool.Cad.angle_3_vectors(
second_to_last_point, last_point, mouse_vector, new_angle=None, degrees=True
)
angle_round_threshold = 1000 # Avoids rounding when distance is too big
angle_round_threshold = 1000 # Avoids rounding when distance is too big
# Round angle to the nearest 0.05
angle = round(angle / 0.05) * 0.05 if distance < angle_round_threshold else angle
orientation_angle = tool.Cad.angle_3_vectors(
world_second_to_last_point, last_point, mouse_vector, new_angle=None, degrees=True
)
+3 -1
View File
@@ -181,7 +181,9 @@ class Raycast(bonsai.core.tool.Raycast):
mouse_pos = event.mouse_region_x, event.mouse_region_y
view_vector = tool.Cad.region_2d_to_vector_3d_np(region, rv3d, mouse_pos)
ray_origin = tool.Cad.region_2d_to_origin_3d_np(region, rv3d, mouse_pos, clamp=10) # TODO clamp is hardcoded but might be necessary to adapt
ray_origin = tool.Cad.region_2d_to_origin_3d_np(
region, rv3d, mouse_pos, clamp=10
) # TODO clamp is hardcoded but might be necessary to adapt
ray_target = ray_origin + view_vector
ray_direction = ray_target - ray_origin