Snap - modify intersection plane origin to be related to the view location.

This commit is contained in:
Bruno Perdigão
2025-02-14 10:57:50 -03:00
parent 5d8c2f2ec2
commit 5a3a032fe6
+5 -7
View File
@@ -274,14 +274,11 @@ class Snap(bonsai.core.tool.Snap):
)
def select_plane_method():
if not last_polyline_point:
plane_origin = Vector((0, 0, 0))
plane_normal = Vector((0, 0, 1))
if not tool_state.plane_method:
camera_rotation = rv3d.view_rotation
plane_origin = Vector((0, 0, 0))
view_direction = Vector((0, 0, -1)) @ camera_rotation.to_matrix().transposed()
view_rotation = rv3d.view_rotation
view_location = rv3d.view_location
view_direction = Vector((0, 0, -1)) @ view_rotation.to_matrix().transposed()
plane_origin = view_location + view_direction * 10
plane_normal = view_direction.normalized()
if tool_state.plane_method == "XY" or (
@@ -451,6 +448,7 @@ class Snap(bonsai.core.tool.Snap):
tool_state.plane_origin = plane_origin # This will be used along with plane method
intersection = tool.Raycast.ray_cast_to_plane(context, event, plane_origin, plane_normal)
print(intersection)
axis_start = None
axis_end = None